With webhooks turned on in your Sendbird application, your server will receive HTTP POST
requests from Sendbird server in the form of the response containing information on all events that occur within the application.
The webhooks can be useful when you build your own custom notification service, such as notifying call statuses for your offline users.
You can configure a webhook endpoint URL and other settings on the Settings > Calls > Webhooks in your dashboard
HTTP POST
requests with JSON
payloads are sent to your webhook endpoint upon specific events in your Sendbird application.
- The endpoint must support
HTTP/1.1
andkeep-alive
. - The endpoint needs to respond to
POST
requests. - The endpoint needs to parse
JSON
payloads.
By default, Sendbird server sends an HTTP POST
request and waits for a response from your webhook endpoint for 1 second. The server sends the same POST
request up to three times until it receives a response. To avoid too many requests, you should implement the endpoint to respond immediately to the server with a 200 OK
response.
Note: When you need a process or function which handles webhook payloads, it should be implemented to be executed asynchronously from that of which responds to the server. If they are executed synchronously, it can cause the endpoint to stop working properly when many events happen on your application.
HTTP POST
requests from Sendbird server will include the following headers.
Direct call
Event | Triggered when |
---|---|
A direct call's signal is forwarded to callee. | |
A direct call is accepted by the callee. | |
A direct call is ended by either the caller or callee. |
Retrieves a list of events for your webhook server to receive payloads for.
The following table lists the parameters that this action supports.
Parameters
Required | Type | Description |
---|---|---|
application_id | string | Specifies the unique ID of the application. |
Optional | Type | Description |
---|---|---|
display_all_webhook_categories | boolean | Determines whether to include a list of all supported webhook events as the all_webhook_categories property in the response. (Default: false) |
If successful, this action returns the information about the webhook configuration in the response body.
hooses which events for your webhook server to receive payloads for. By subscribing to specific events based on your own needs, you can control the number of HTTP requests to your webhook server.
The following table lists the properties of an HTTP request that this action supports.
Properties
Required | Type | Description |
---|---|---|
application_id | string | Specifies the unique ID of the application. |
Optional | Type | Description |
---|---|---|
enabled | boolean | Determines whether webhooks are turned on in your Sendbird application or not. (Default: false) |
url | string | Specifies the URL of your webhook server to receive payloads for events. |
include_members | boolean | Determines whether to include the information on the members of group channels in payloads. (Default: false) |
enabled_events[] | array | Specifies an array of one or more events for your webhook server to subscribe to. If set to an asterisk (*) only, the server will subscribe to all supported events. If set to an empty array, the server will unsubscribe from all (which indicates turning off webhooks). |
If successful, this action returns the information about the webhook configuration in the response body.
The following shows a webhook payload of a direct_call:dial
event.
The following shows a webhook payload of a direct_call:accept
event.
The following shows a webhook payload of a direct_call:end
event.