Overview
Crewship webhooks let you:- Incoming webhooks: Trigger runs via HTTP POST requests from external systems
- Outgoing webhooks: Receive notifications when runs complete
Incoming Webhooks
Incoming webhooks provide unique URLs that trigger runs when called. Use them to integrate with:- CI/CD pipelines (GitHub Actions, GitLab CI, etc.)
- Scheduling services (cron jobs, cloud schedulers)
- No-code automation tools (Zapier, Make, n8n)
- Custom integrations
Creating an Incoming Webhook
- Go to your deployment in the Console
- Click Webhooks
- Click Add Incoming Webhook
- Enter a name and select the environment (production/staging)
- Copy the generated webhook URL
Triggering a Run
Send a POST request to the webhook URL with your run input:202 response means the run is actually executing.
Example: GitHub Actions
Trigger a crew run on every push to main:Example: Scheduled Runs
Use a cron service or cloud scheduler to trigger runs on a schedule:Outgoing Webhooks
Outgoing webhooks notify external systems when runs complete. Use them to:- Send Slack/Discord notifications
- Update databases or dashboards
- Trigger downstream workflows
- Log results to external systems
Creating an Outgoing Webhook
- Go to your deployment in the Console
- Click Webhooks
- Click Add Outgoing Webhook
- Enter a name, target URL, and select events
- Save the signing secret securely
Events
| Event | Description |
|---|---|
run.succeeded | Run completed successfully |
run.failed | Run failed with an error |
Webhook Payload
When a run completes, Crewship sends a POST request to your URL:Security Headers
Every outgoing webhook request includes these headers:| Header | Description |
|---|---|
X-Crewship-Event | Event type (e.g., run.succeeded) |
X-Crewship-Delivery | Unique delivery ID for debugging |
X-Crewship-Timestamp | Unix timestamp when request was signed |
X-Crewship-Signature | HMAC-SHA256 signature for verification |
Verifying Signatures
Always verify webhook signatures to ensure requests are from Crewship:Python Example
Delivery Logs
View delivery attempts in the Console:- Go to your deployment → Webhooks
- Find your outgoing webhook
- Click Deliveries
- Status (succeeded/failed)
- HTTP response code
- Error message (if failed)
- Timestamp
Managing Webhooks
Regenerating Secrets
If your webhook secret is compromised:- Go to your webhook in the Console
- Click Regenerate Secret
- Update your integration with the new secret
Disabling Webhooks
Toggle the Enabled switch to temporarily disable a webhook without deleting it.Environment Filtering
Webhooks are scoped to an environment (production or staging). Create separate webhooks if you need different behavior per environment.Best Practices
Always verify signatures
Always verify signatures
Never process outgoing webhooks without verifying the signature. This prevents attackers from sending fake webhook payloads.
Respond quickly
Respond quickly
Return a 2xx response within 30 seconds. Crewship waits for your response before marking the delivery as complete.
Handle duplicates
Handle duplicates
Use the
X-Crewship-Delivery header to deduplicate. In rare cases, the same event may be delivered twice.Keep secrets secure
Keep secrets secure
Store webhook secrets in environment variables or a secrets manager. Never commit them to version control.
Testing Webhooks
Use webhook.site to test outgoing webhooks:- Go to webhook.site and copy your unique URL
- Create an outgoing webhook with that URL
- Trigger a run
- View the payload on webhook.site