Summary
Add webhook URL endpoints that trigger agent schedule executions from external systems. Each schedule can optionally expose a unique webhook URL with an embedded HMAC signature and expiration date, allowing external services (CI/CD, form submissions, CRMs, monitoring alerts) to initiate agent work without API authentication.
Motivation
Currently agents can only be triggered via: UI chat, cron schedules, MCP tools, or Slack. There's no way for arbitrary external systems to trigger agent work via a simple HTTP POST. Webhooks are the universal integration pattern for this.
Design
Webhook URL Format
POST /api/webhooks/{schedule_id}/{signature}
signature = HMAC-SHA256(schedule_id + expiration, secret_key), base64url-encoded
- URL is self-contained — no auth header needed
- Optional expiration date embedded in the signature payload
Schedule Integration
- Each schedule gets an optional "webhook trigger" toggle
- When enabled, generates a unique webhook URL with configurable expiration (default: 90 days, or no expiry)
- Calling the webhook triggers the schedule exactly once (same as manual trigger)
- The schedule's message is used as the task prompt (webhook payload can optionally override/append context)
- Respects existing execution slot limits and queueing
Webhook Payload (optional body)
{
"context": "Additional context appended to the schedule message",
"metadata": { "source": "github", "event": "push" }
}
context is appended to the schedule's message as additional input
metadata is stored on the execution record for traceability
Security
- HMAC-SHA256 signature prevents URL guessing/tampering
- Expiration date prevents stale URLs from being used indefinitely
- Rate limiting per webhook URL (e.g., 10 calls/minute)
- Webhook URLs can be regenerated (invalidates old URL)
- Execution is logged with
triggered_by: "webhook" for audit trail
API Endpoints
| Method |
Path |
Auth |
Description |
| POST |
/api/webhooks/{schedule_id}/{signature} |
None (signature) |
Trigger execution |
| POST |
/api/agents/{name}/schedules/{id}/webhook |
JWT |
Generate/regenerate webhook URL |
| DELETE |
/api/agents/{name}/schedules/{id}/webhook |
JWT |
Revoke webhook URL |
| GET |
/api/agents/{name}/schedules/{id}/webhook |
JWT |
Get webhook URL and status |
Database
Add columns to agent_schedules:
webhook_secret — per-schedule HMAC secret
webhook_expires_at — optional expiration timestamp
webhook_enabled — toggle
UI
- Webhook URL section in schedule detail/edit panel
- Copy-to-clipboard button for the URL
- Expiration date picker
- Regenerate/revoke buttons
Acceptance Criteria
Summary
Add webhook URL endpoints that trigger agent schedule executions from external systems. Each schedule can optionally expose a unique webhook URL with an embedded HMAC signature and expiration date, allowing external services (CI/CD, form submissions, CRMs, monitoring alerts) to initiate agent work without API authentication.
Motivation
Currently agents can only be triggered via: UI chat, cron schedules, MCP tools, or Slack. There's no way for arbitrary external systems to trigger agent work via a simple HTTP POST. Webhooks are the universal integration pattern for this.
Design
Webhook URL Format
signature= HMAC-SHA256(schedule_id + expiration, secret_key), base64url-encodedSchedule Integration
Webhook Payload (optional body)
{ "context": "Additional context appended to the schedule message", "metadata": { "source": "github", "event": "push" } }contextis appended to the schedule's message as additional inputmetadatais stored on the execution record for traceabilitySecurity
triggered_by: "webhook"for audit trailAPI Endpoints
/api/webhooks/{schedule_id}/{signature}/api/agents/{name}/schedules/{id}/webhook/api/agents/{name}/schedules/{id}/webhook/api/agents/{name}/schedules/{id}/webhookDatabase
Add columns to
agent_schedules:webhook_secret— per-schedule HMAC secretwebhook_expires_at— optional expiration timestampwebhook_enabled— toggleUI
Acceptance Criteria
contextis appended to schedule messagetriggered_by: "webhook"appears in execution records