-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_webhook_api.sh
More file actions
executable file
·56 lines (48 loc) · 1.93 KB
/
test_webhook_api.sh
File metadata and controls
executable file
·56 lines (48 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# Test webhook API endpoints
API_URL="http://localhost:8000"
echo "=========================================="
echo "🧪 Testing Webhook API Endpoints"
echo "=========================================="
echo ""
# Check if server is running
if ! curl -s "$API_URL/health" > /dev/null 2>&1; then
echo "❌ Server is not running!"
echo " Start server: python start_api_server.py"
echo " Or use debugger: Python: Start API Server (with Webhooks)"
exit 1
fi
echo "✅ Server is running"
echo ""
# Test 1: Get webhook status
echo "📊 Test 1: Get Webhook Status"
echo " GET $API_URL/api/v1/webhooks/status"
curl -s "$API_URL/api/v1/webhooks/status" | python3 -m json.tool
echo ""
# Test 2: Test Slack webhook (if configured)
if [ -f .env ] && grep -q "SENTINEL_SLACK_WEBHOOK_URL" .env && ! grep -q "^SENTINEL_SLACK_WEBHOOK_URL=$" .env; then
echo "📨 Test 2: Test Slack Webhook"
echo " POST $API_URL/api/v1/webhooks/test?provider=slack"
curl -s -X POST "$API_URL/api/v1/webhooks/test?provider=slack" | python3 -m json.tool
echo ""
echo "💡 Check your Slack channel: #all-aitubby"
else
echo "⚠️ Test 2: Slack webhook not configured"
echo " Add SENTINEL_SLACK_WEBHOOK_URL to .env file"
fi
echo ""
# Test 3: Test PagerDuty (if configured)
if [ -f .env ] && grep -q "SENTINEL_PAGERDUTY_INTEGRATION_KEY" .env && ! grep -q "^SENTINEL_PAGERDUTY_INTEGRATION_KEY=$" .env; then
echo "📨 Test 3: Test PagerDuty Integration"
echo " POST $API_URL/api/v1/webhooks/test?provider=pagerduty"
curl -s -X POST "$API_URL/api/v1/webhooks/test?provider=pagerduty" | python3 -m json.tool
echo ""
echo "💡 Check your PagerDuty dashboard"
else
echo "⚠️ Test 3: PagerDuty not configured"
echo " Add SENTINEL_PAGERDUTY_INTEGRATION_KEY to .env file"
fi
echo ""
echo "=========================================="
echo "✅ Testing Complete"
echo "=========================================="