Webhooks
Receive server-side notifications for conversation events.
Overview
Webhooks send HTTP POST requests to your server when events occur. Unlike client-side event listeners, webhooks work server-to-server and don't require the chat widget.
Setup
- Navigate to Settings > Webhooks
- Enter your endpoint URL
- Select the events you want to receive
- Save and test the webhook
Events
| Event | Description |
|---|---|
conversation.created | A new conversation started |
conversation.completed | A conversation ended |
message.created | A new message was sent (user or agent) |
feedback.received | User submitted feedback |
Payload Format
{
"event": "message.created",
"timestamp": "2025-01-15T10:30:00Z",
"data": {
"conversation_id": "conv_abc123",
"message_id": "msg_xyz789",
"role": "assistant",
"content": "Here's how to reset your password...",
"sources": ["https://docs.example.com/password-reset"]
}
}Verification
All webhook payloads include a signature header for verification:
X-Webhook-Signature: sha256=abc123...Verify the signature using your webhook secret:
const crypto = require('crypto');
function verifyWebhook(payload, signature, secret) {
const expected = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return `sha256=${expected}` === signature;
}Retry Policy
Failed deliveries are retried with exponential backoff:
- 1st retry: 1 minute
- 2nd retry: 5 minutes
- 3rd retry: 30 minutes
- After 3 failures, the webhook is disabled