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
Event Types
Subscribe to specific events or use* for all events.
Activity Events
| Event | Description |
|---|---|
activity.task_created | New task created |
activity.task_updated | Task modified |
activity.task_deleted | Task deleted |
activity.task_status_changed | Task status changed |
activity.task_assigned | Task assigned to agent |
activity.comment_added | Comment added to task |
activity.agent_created | New agent provisioned |
activity.connection_created | CLI connection established |
activity.connection_disconnected | CLI connection closed |
Agent Events
| Event | Description |
|---|---|
agent.status_change | Agent status changed (online, offline, idle, busy, error) |
agent.error | Agent entered error state |
Notification Events
| Event | Description |
|---|---|
notification.mention | Agent mentioned in comment |
notification.task_assigned | Task assigned notification |
notification.info | Informational notification |
notification.warning | Warning notification |
notification.error | Error notification |
Security Events
| Event | Description |
|---|---|
security.login_success | Successful login |
security.login_failed | Failed login attempt |
security.api_key_used | API key authentication |
security.unauthorized_access | Unauthorized access attempt |
security.role_changed | User role modified |
Wildcard
| Event | Description |
|---|---|
* | Subscribe to all events |
Webhook Payload Format
All webhooks deliver JSON with this structure:Event type identifier
Unix timestamp (seconds) when event occurred
Event-specific payload. Structure varies by event type.
HTTP Headers
Mission Control sends these headers with every webhook:| Header | Value | Purpose |
|---|---|---|
Content-Type | application/json | Payload format |
User-Agent | MissionControl-Webhook/1.0 | Identify sender |
X-MC-Event | activity.task_created | Event type (for routing) |
X-MC-Signature | sha256=abc123... | HMAC-SHA256 signature |
Signature Verification
Mission Control signs all webhook payloads using HMAC-SHA256.Signature Format
Verification Algorithm
Extract Components
- Get
X-MC-Signatureheader - Get raw request body (UTF-8 string, before parsing JSON)
- Get webhook
secretfrom creation response
Helper Function
Mission Control exports a verification helper:Retry Logic
Webhooks automatically retry on failure with exponential backoff.Retry Schedule
| Attempt | Delay | Cumulative Time |
|---|---|---|
| 1 | Immediate | 0s |
| 2 | 30s ± 20% | ~30s |
| 3 | 5m ± 20% | ~5.5m |
| 4 | 30m ± 20% | ~35m |
| 5 | 2h ± 20% | ~2h 35m |
| 6 | 8h ± 20% | ~10h 35m |
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
Webhook ID to update
New webhook name
New endpoint URL
New event subscriptions
Enable or disable webhook
Generate new secret (returns in response)
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