Skip to main content

Webhook API Guide

The Webhook API guide allows you to set-up webhooks to receive a POST request on when an event or more is triggered.

Create a webhook

Webhooks are configured on the action that produces the event. For lead submissions, use the Collect Leads action:
  1. Go to Build > Actions and open your Collect Leads action.
  2. Click the Webhooks tab in the action settings.
  3. Enter the URL that should receive the POST request, then click Create Webhook.
Other actions that emit events, such as custom forms, have the same Webhooks tab.

Payload

Event types

These are the list of events supported in webhooks:
  • leads.submit : When a customer submits their info (Name, Email, Phone, and any custom fields configured on the Collect Leads action) to your agent.

Event payload

The payload of each event:
  • leads.submit :
customFields is keyed by the field names configured on the Collect Leads action, e.g. { "Company name": "Acme", "Team size": 12 }. It is only sent when the action collects custom fields (conversational mode).

Receiving the request

You can receive the payload by accessing the body same as any request. But it is recommended to to check the request header x-chatbase-signature for securing your endpoint from spam from anyone knows your endpoint. You can achieve this by using SHA-1 (Secure Hash Algorithm 1) function to generate a signature for the request and compare it with x-chatbase-signature found in the request headers. If the are identical then the request is from Chatbase.
Next.js
Node.js