Overview
Real-time Notifications
Get instant updates when events occur in your system
Secure Delivery
Webhooks are signed with cryptographic signatures for verification
Reliable Delivery
Automatic retries ensure your webhooks are delivered
Easy Integration
Simple HTTP POST requests to your specified endpoints
Configuration
Setting Up Your Webhook
Assuming you already have an endpoint URL, you can add a webhook integration in the platform.1
Create Webhook Integration in Platform
In the platform, go to Integrations → Add Integration → select Webhook, then supply the webhook details:
- URL: The endpoint that will receive events
- Headers: Any custom headers required by your endpoint (e.g., authentication)
- Body: The JSON payload template your endpoint expects
2
Attach Webhook to Agents
After creating the integration, attach the webhook to individual agents. When those agents run and emit events, your webhook will be invoked with the configured details.
3
Verify Webhook Signature
All webhooks include a cryptographic signature for security verification.
Webhook Payload
Every webhook request contains a standardized payload structure:Payload Parameters
The type of event that triggered the webhook. Examples:
user.created
, payment.completed
, order.updated
ISO 8601 timestamp when the event occurredExample:
2024-01-15T10:30:00Z
The actual event data. Structure varies depending on the event type.
Security & Signature Verification
All webhooks are signed using SHA256 hashing with RSA-PKCS1v15 signing and Base64 encoding for maximum security.Signature Header
The webhook signature is included in theX-Asteroid-Signature
header:
Always verify the webhook signature to ensure the request is authentic and hasn’t been tampered with.
Public Key for Verification
Use this Base64-encoded public key to verify webhook signatures:JavaScript Implementation
Here’s a complete example of verifying webhook signatures in JavaScript:Best Practices
Implement Proper Error Handling
Implement Proper Error Handling
Always return appropriate HTTP status codes:
200
- Successfully processed400
- Bad request/invalid payload401
- Unauthorized/invalid signature500
- Server error
Handle Duplicate Events
Handle Duplicate Events
Use the
timestamp
and event data to detect and handle duplicate webhook deliveries.Implement Timeout Protection
Implement Timeout Protection
Respond to webhooks within 30 seconds to avoid timeouts and retries.
Testing Your Webhooks
Use webhook.site to test your webhook integration during development. It provides a temporary URL that captures and displays all incoming webhook requests.
Test Payload Example
Troubleshooting
Webhook Not Receiving Events
Webhook Not Receiving Events
- Verify your endpoint URL is accessible from the internet
- Check that your server is running and responding to POST requests
- Ensure your firewall allows incoming connections
Signature Verification Failing
Signature Verification Failing
- Confirm you’re using the correct public key
- Verify you’re hashing the raw request body (not parsed JSON)
- Check that you’re using Base64 decoding for both the key and signature
Receiving Duplicate Events
Receiving Duplicate Events
- Implement idempotency using event timestamps and IDs
- Return 200 status code for successfully processed events
- Avoid returning error codes for already-processed events