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

  1. Navigate to Settings > Webhooks
  2. Enter your endpoint URL
  3. Select the events you want to receive
  4. Save and test the webhook

Events

EventDescription
conversation.createdA new conversation started
conversation.completedA conversation ended
message.createdA new message was sent (user or agent)
feedback.receivedUser 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

On this page