Overview
Webhooks enable Mission Control to push events to your external services in real-time. Configure webhook endpoints to receive notifications about tasks, agents, activities, and security events.Webhooks use HMAC-SHA256 signatures for security and include automatic retry with exponential backoff.
Quick Start
1
Create Webhook
2
Verify Signature in Your Handler
Validate incoming webhooks using the HMAC signature:
3
Test Webhook
Event Types
Subscribe to specific events or use* for all events.
Activity Events
Agent Events
Notification Events
Security Events
Wildcard
Webhook Payload Format
All webhooks deliver JSON with this structure:string
Event type identifier
number
Unix timestamp (seconds) when event occurred
object
Event-specific payload. Structure varies by event type.
HTTP Headers
Mission Control sends these headers with every webhook:Signature Verification
Mission Control signs all webhook payloads using HMAC-SHA256.Signature Format
Verification Algorithm
1
Extract Components
- Get
X-MC-Signatureheader - Get raw request body (UTF-8 string, before parsing JSON)
- Get webhook
secretfrom creation response
2
Compute Expected Signature
3
Compare Using Constant-Time Function
Helper Function
Mission Control exports a verification helper:Retry Logic
Webhooks automatically retry on failure with exponential backoff.Retry Schedule
Total attempts: 6 (1 initial + 5 retries)
Retries include ±20% jitter to prevent thundering herd issues.
Success Criteria
A delivery is considered successful if:- HTTP status code: 200-299
- Response received within 10 seconds
Failure Criteria
A delivery fails if:- HTTP status code: ≥300 or connection error
- Request times out after 10 seconds
- Network error (DNS, connection refused, etc.)
Circuit Breaker
After 5 consecutive failures (configurable viaMC_WEBHOOK_MAX_RETRIES):
- Webhook is automatically disabled
- No further deliveries are attempted
- Log entry:
Webhook circuit breaker tripped — disabled after exhausting retries
- Resets
consecutive_failuresto 0 - Sets
enabledtotrue - Allows new deliveries
Management API
List Webhooks
Update Webhook
number
required
Webhook ID to update
string
New webhook name
string
New endpoint URL
array
New event subscriptions
boolean
Enable or disable webhook
boolean
Generate new secret (returns in response)
boolean
Reset circuit breaker and re-enable webhook
Delete Webhook
View Delivery History
Manual Retry
Environment Configuration
Best Practices
Idempotency
Webhooks may deliver the same event multiple times (retries). Design handlers to be idempotent:
Fast Response
Respond quickly (< 1s) to avoid timeouts:
Secret Rotation
Rotate webhook secrets periodically:
- Create new webhook with new secret
- Update your handler to accept both secrets
- Wait for old deliveries to drain (24h)
- Delete old webhook
Monitor Failures
Set up alerts for:
consecutive_failures > 3circuit_open = true- Sudden spike in failed deliveries
Troubleshooting
Webhook deliveries fail with 'Invalid signature'
Webhook deliveries fail with 'Invalid signature'
Cause: Your handler’s signature verification is incorrect.Debug steps:
- Ensure you’re using raw body (before JSON parsing)
- Log both signatures for comparison:
- Verify secret matches (check for leading/trailing whitespace)
- Use
timingSafeEqual()for comparison
Circuit breaker keeps tripping
Circuit breaker keeps tripping
Cause: Your endpoint is unreliable or timing out.Solutions:
- Check webhook delivery logs:
GET /api/webhooks/deliveries?webhook_id=1 - Ensure your handler responds within 10 seconds
- Return 200 status code on success
- Check for network/firewall issues
- Temporarily disable circuit breaker:
MC_WEBHOOK_MAX_RETRIES=999
Not receiving events for specific event types
Not receiving events for specific event types
Cause: Event not in subscription list or event mapping issue.Debug:
- List webhook config:
GET /api/webhooks - Check
eventsarray includes the event type - Update subscription:
- Test delivery:
POST /api/webhooks/test
EVENT_MAP in /src/lib/webhooks.ts:36).Retries not working
Retries not working
Cause: Scheduler not running or deliveries not recorded.Check scheduler:Manually trigger retry processing:
Security Considerations
HTTPS Only
Use HTTPS endpoints in production:Mission Control allows HTTP for local development only.
IP Whitelisting
Restrict webhook requests to Mission Control server IPs:
Rate Limiting
Protect your webhook endpoint:
Logging
Log all webhook deliveries for audit:
Related Docs
CLI Integration
Real-time events via Server-Sent Events
GitHub Sync
Webhook automation examples
Event Bus
Internal event system