Inbound Message Webhook
The Inbound Message Webhook allows your application to receive and process messages sent by users through various communication channels like SMS, WhatsApp, Slack, etc. When a user sends a message to a number or channel that is configured with Siren, the message is forwarded to your configured webhook URL.Webhook Configuration
To set up the inbound message webhook, configure theinboundWebhookConfig.url
using the Update Webhook Configuration API.
Webhook Payload
When an inbound message is received, Siren will send a POST request to your configured webhook URL with the following payload structure:Payload Fields
Event Information
The type of event. For inbound messages, this will be
message.received
.The timestamp when the event occurred.
The channel through which the message was received (e.g.,
whatsapp
, sms
, slack
).Message Object
Contains the details of the received message.
ECHO is off.ECHO is off.ECHO is off.ECHO is off.ECHO is off.ECHO is off.
A unique identifier for the message.
The sender’s identifier (phone number, user ID, etc.).
The recipient’s identifier (phone number, channel ID, etc.).
The message text content, if any.
The timestamp when the message was sent by the user.
Metadata
Webhook Headers
Each webhook request will include the following headers:The type of event (e.g.,
message.received
).A unique ID for this webhook delivery. Use this for idempotency.
A signature you can use to verify the webhook’s authenticity.
Will always be
application/json
.Webhook Response
Your webhook endpoint should return a200 OK
status code within 3 seconds to acknowledge receipt of the webhook. If Siren does not receive a successful response, it will retry the webhook delivery according to the retry policy.
Success Response
Error Response (Optional)
If you want to return an error message to the sender, you can include it in the response:Webhook Retry Policy
If your webhook endpoint returns an error (non-2xx status code) or times out, Siren will retry delivery with exponential backoff according to the following schedule:- First retry: 1 minute after first failure
- Second retry: 3 minutes after first retry
- Third retry: 10 minutes after second retry
- Fourth retry: 30 minutes after third retry
- Final retry: 1 hour after fourth retry If all retry attempts fail, the message will be discarded.
Security
Verifying Webhook Signatures
To verify that incoming webhooks are from Siren, verify theX-Siren-Signature
header. The signature is generated using HMAC-SHA256 with your webhook signing secret.
Best Practices
- Verify Signatures: Always verify the
X-Siren-Signature
header to ensure the webhook is from Siren. - Idempotency: Use the
X-Siren-Delivery
header to prevent processing duplicate events. - Timeouts: Process webhooks quickly and respond within 3 seconds to avoid timeouts.
- HTTPS: Always use HTTPS for your webhook endpoints to ensure data security.
- Rate Limiting: Implement rate limiting to protect your webhook endpoint from abuse.
- Logging: Log all incoming webhook requests for debugging and auditing purposes.