Webhook API Guide
The Webhook API guide allows you to set-up webhooks to receive aPOST request on when an event or more is triggered.
Payload
| Key | Type | Description |
|---|---|---|
| eventType | string | Event type |
| chatbotId | string | Chatbot ID |
| payload | Object | Payload of the event. Learn more |
Event types
These are the list of events supported in webhooks:leads.submit: When a customer submit his info (Name, Email, and Phone) to your chatbot.
Event payload
The payload of each event:leads.submit:
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 headerx-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