Webhooks
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.
Configuration
You can configure a webhook endpoint URL and other settings on the Settings > Calls > Webhooks in your dashboard.
Webhook endpoint requirements
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.
Headers
HTTP POST
requests from Sendbird server will include the following headers.
Webhook events
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. |
Group call
Event | Triggered when |
---|---|
A room is created. | |
A room is deleted. | |
A participant entered a room. | |
A participant exited a room. | |
A participant is disconnected from a room. | |
An invitation is sent to a participant to join a room. | |
An invitation to join a room has been canceled. | |
A participant has accepted an invitation to join a room. | |
A participant has declined an invitation to join a room. | |
A participant has neither accepted nor declined an invitation to join a room. |
Retrieve a list of subscribed events
Retrieves a list of events for your webhook server to receive payloads for.
HTTP request
Parameters
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) |
Response
If successful, this action returns the information about the webhook configuration in the response body.
Choose which events to subscribe to
Choose 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.
HTTP request
Request body
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). |
Response
If successful, this action returns the information about the webhook configuration in the response body.
Direct call
There are three webhook events for direct call as shown below. To ensure your code remains error-free, note that new keys may be added to the webhook payload in the future.
direct_call:dial
The following shows a webhook payload of a direct_call:dial
event.
direct_call:accept
The following shows a webhook payload of a direct_call:accept
event.
direct_call:end
The following shows a webhook payload of a direct_call:end
event.
Note: The
result
property in the webhook payload is to be deprecated.
Group call
There are ten webhook events for group call as shown below. To ensure your code remains error-free, note that new keys may be added to the webhook payload in the future.
room:create
The following shows a webhook payload of a room:create
event.
room:delete
The following shows a webhook payload of a room:delete
event.
room:participant_enter
The following shows a webhook payload of a room:participant_enter
event.
room:participant_exit
The following shows a webhook payload of a room:participant_exit
event.
room:participant_disconnect
The following shows a webhook payload of a room:participant_disconnect
event.
room:invitation_send
The following shows a webhook payload of a room:invitation_send
event.
room:invitation_cancel
The following shows a webhook payload of a room:invitation_cancel
event.
room:invitation_accept
The following shows a webhook payload of a room:invitation_accept
event.
room:invitation_decline
The following shows a webhook payload of a room:invitation_decline
event.
room:invitation_no_answer
The following shows a webhook payload of a room:invitation_no_answer
event.