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. For phone call summaries, the webhook is configured on the phone channel instead:
  1. Go to Phone > Connections on an AI agent with a phone number assigned.
  2. In the Call summary webhook card, enter the URL that should receive the POST request, then click Create webhook.
The same event can also be subscribed from Settings > Webhooks while the phone channel is active.

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 AI agent.
  • {action name}_collect_data.submit : When a customer submits the fields collected by a Collect Data action, where {action name} is the name of that action.
  • {action name}_custom_form.submit : When a customer submits a custom form, where {action name} is the name of that action.
  • phone_call.summary : When a phone call to your AI agent ends. Sent once per call, shortly after the caller hangs up, with an AI-generated summary of the conversation.

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).
  • {action name}_collect_data.submit :
  • {action name}_custom_form.submit :
  • phone_call.summary :
callSummary can be an empty string if a summary could not be generated for the call. callerNumber may arrive in national format rather than E.164, depending on the carrier. calledNumber is the number on your account that received the call, webhooks are subscribed per AI agent, so use it to tell which line was dialed when one AI agent answers several numbers.

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