Webhooks
Webhooks allow your system to receive real-time updates from the E-commerce Chatbot API when key events occur โ such as new messages, analytics thresholds, or user interactions.
๐ How It Works
- You register a publicly accessible HTTPS endpoint.
- Our system sends a POST request to that URL when events occur.
- You validate the signature and process the payload.
๐ฌ Example Payload
{
"event": "chat.message.sent",
"timestamp": "2025-06-10T14:23:00Z",
"data": {
"message_id": "msg_789",
"user_id": "user_123",
"text": "I need help with my order",
"intent": "return_order"
}
}
๐งพ Supported Events
Event Name | Description |
---|---|
chat.message.sent |
A user message has been processed by the AI |
chat.feedback.received |
A user gave feedback on the chatbot's response |
chat.alert.triggered |
Anomaly detected (e.g. inappropriate request) |
๐ Signature Validation
Each webhook request includes an -Signature
header :
X-Signature: sha256=ab12c3d4ef567...
To verify :
- Compute an HMAC-SHA256 hash of the raw request body using your webhook secret.
- Compare it to the value in the X-Signature header.
- If they match, the payload is authentic.
โ ๏ธ Error Handling & Retries
- We retry failed webhooks up to 3 times, with exponential backoff.
- A
2xx
HTTP response acknowledges successful delivery. - A
4xx
or5xx
response triggers a retry.
๐ Tips
- Always respond quickly (under 3 seconds).
- Use a queue or background worker to process data.
- Keep webhook secrets safe and rotate periodically.
๐ ๏ธ Registering Your Webhook
To register a webhook endpoint, go to the developer dashboard and provide :
- Public HTTPS URL
- Events to subscribe to
- Secret for signing requests