Once the Agora Notification Center Service (NCS) is enabled, the Agora NCS server sends notification callbacks as HTTPS POST requests to your server when your subscribed events occur. The data format of the requests is JSON, the character encoding is UTF-8, and the signature algorithm is HMAC/SHA1 or HMAC/SHA256.
The header of notification callbacks contains the following fields:
Field name | Value |
---|---|
Content-Type |
application/json |
Agora-Signature |
The signature generated by Agora using the Secret and the HMAC/SHA1 algorithm. You need to use the Secret and HMAC/SHA1 algorithm to verify the signature value. For more details, see Signature verification. |
Agora-Signature-V2 |
The signature generated by Agora using the Secret and the HMAC/SHA256 algorithm. You need to use the Secret and the HMAC/SHA256 algorithm to verify the signature value. For more details, see Signature verification. |
The request body of the notification callbacks contains the following fields:
Field Name | Type | Description |
---|---|---|
noticeId |
String | The notification ID, identifying the notification callback when the event occurs. |
productId |
Number | The product ID. Value 1 means the Real-time Communication (RTC) service. |
eventType |
Number | The type of events being notified. For details, see [Types of channel events](#Types of channel events). |
notifyMs |
Number | The Unix timestamp (ms) when the Agora NCS server sends a notification callback to your server. This value is updated when the Agora server resends the notification callback. |
payload |
JSON Object | The content of the event being notified. Thepayload varies with eventType . For details, see [Types of channel events](#Types of channel events). |
Example of the request body of notification callbacks:
{ "noticeId": "2000001428:4330:107", "productId": 1, "eventType": 101, "notifyMs": 1611566412672, "payload": {...} }
The Agora NCS server notifies your server of the following types of channel events when you use the RTC service:
eventType | event_name | Description |
---|---|---|
101 | channel create | Initializes the channel. |
102 | channel destroy | Destroys the channel. |
103 | broadcaster join channel | In the live streaming profile, the host joins the channel. |
104 | broadcaster leave channel | In the live streaming profile, the host leaves the channel. |
105 | audience join channel | In the live streaming profile, an audience member joins the channel |
106 | audience leave channel | In the live streaming profile, an audience member leaves the channel. |
107 | user join channel with communication mode | In the communication profile, a user joins the channel. This events applies to the communication mode in RTC v3.x products only. For the communication profile in RTC v4.x (v4.0.0 and higher versions) products, your server receives the 103 event instead. |
108 | user leave channel with communication mode | In the communication profile, a user leaves the channel. This events applies to the communication profile in RTC v3.x products only. For the communication profile in RTC v4.x products, your server receives the 104 event instead. |
111 | client role change to broadcaster. | In the communication profile in RTC v4.x products or in the live streaming profile, an audience member switches their user role to host. |
112 | client role change to audience | In the communication profile in RTC v4.x products or in the live streaming profile, a host switches their user role to audience member. |
eventType
101
indicates that a channel is initialized (when the first user joins the channel). The payload
contains the following fields:
Field Name | Data type | Description |
---|---|---|
channelName |
String | The name of the channel. |
ts |
Number | The Unix timestamp (s) when the event occurs on the Agora RTC server. |
Example of the payload``:
{ "channelName": "test_webhook", "ts": 1560396834 }
eventType
102 indicates that the last user in the channel leaves the channel and the channel is destroyed. The payload
contains the following fields:
Field Name | Data type | Description |
---|---|---|
channelName |
String | The name of the channel. |
ts |
Number | The Unix timestamp (s) when the event occurs on the Agora RTC server. |
Example of the payload
:
{ "channelName": "test_webhook", "ts": 1560399999 }
eventType
103
indicates that a host joins the channel in the live streaming profile. The payload
contains the following fields:
Field Name | Data type | Description |
---|---|---|
channelName |
String | The name of the channel. |
uid |
Number | The user ID of the host in the channel. |
platform |
Number | The platform type of the host's device:1 : Android 2 : iOS 5 : Windows 6 : Linux 7 : Web8 : macOS 0 : Other platform |
clientType |
Number | The type of services used by the host on Linux. Common return values include:3 : On-premise Recording 10 : Cloud RecordingThis field is only returned when platform is 6 . |
clientSeq |
Number | The sequence number, which is used to identify the order in which events occur on the app client. You can use the value of this field to sort the events of a user into chronological order. For details, see Maintain User Online Status. |
ts |
Number | The Unix timestamp (s) when the event occurs on the Agora RTC server. |
Example of the payload
:
{ "channelName": "test_webhook", "uid": 12121212, "platform": 1, "clientSeq": 1625051030746, "ts": 1560396843 }
eventType
104
indicates that a host leaves the channel in the live streaming profile. The payload
contains the following fields:
Field Name | Data type | Description |
---|---|---|
channelName |
String | The name of the channel. |
uid |
Number | The user ID of the host in the channel. |
platform |
Number | Platform type of the host's device:1 : Android2 : iOS5 : Windows6 : Linux7 : Web8 : macOS 0 : Other platform |
clientType |
Number | The type of services used by the host on Linux. Common return values include:3 : On-premise Recording 10 : Cloud RecordingThis field is only returned when platform is 6 . |
clientSeq |
Number | The sequence number, which is used to identify the order in which events occur on the app client. You can use the value of this field to sort the events of a user into chronological order. For details, see Maintain User Online Status. |
reason |
Number | Reasons why the host leaves the channel:1 : The host quits the call.2 : The connection between the app client and the Agora RTC server times out, which occurs when the Agora SD-RTN™ does not receive any data packets from the app client for more than 10 seconds.3 : Permission issues. For example, the host is kicked out of the channel by the administrator through the Banning user privileges RESTful API.4 : Internal issues with the Agora RTC server. For example, the Agora RTC server disconnects from the app client for a short period of time for load balancing. When the load balancing is finished, the Agora RTC server reconnects with the client.5 : The host uses a new device to join the channel, which forces the old device to leave the channel.9 : The app client has multiple IP addresses, therefore the SDK actively disconnects from the Agora RTC server and reconnects. The user is not aware of this process. Check whether the app client has multiple public IP addresses or uses a VPN.10 : Due to network connection issues, for example, the SDK does not receive any data packets from the Agora RTC server for more than 4 seconds or the socket connection error occurs, the SDK actively disconnects from the Agora server and reconnects. The user is not aware of this process. Check the network connection status. 999 : The user has unusual activities, such as frequent login and logout actions. 60 seconds after receiving the 104 or 106 event callback with reason as 999, your app server needs to call the Banning user privileges API to remove the user from the current channel; otherwise, your server could fail to receive any notification callbacks about the user's events if the user rejoins the channel. 0 : Other reasons. |
ts |
Number | The Unix timestamp (s) when the event occurs on the Agora RTC server. |
duration |
Number | The length of time (s) that the host stays in the channel. |
Example of the payload
:
{ "channelName": "test_webhook", "uid": 12121212, "platform": 1, "clientSeq": 1625051030789, "reason": 1, "ts": 1560396943, "duration": 600 }
eventType
105
indicates that an audience member joins the channel in the live streaming profile. The payload
includes the following fields:
Field Name | Data type | Description |
---|---|---|
channelName |
String | The name of the channel. |
uid |
Number | The user ID of the audience member in the channel. |
platform |
Number | The platform type of the audience member's device:1 : Android2 : iOS5 : Windows6 : Linux7 : Web8 : macOS 0 : Other platform |
clientType |
Number | The type of services used by the audience member on Linux. Common return values include:3 : On-premise Recording10 : Cloud RecordingThis field is only returned when platform is 6 . |
clientSeq |
Number | The sequence number, which is used to identify the order in which events occur on the app client. You can use the value of this field to sort the events of a user into chronological order. For details, see Maintain User Online Status. |
ts |
Number | The Unix timestamp (s) when the event occurs on the Agora RTC server. |
Example of the payload
:
{ "channelName": "test_webhook", "uid": 12121212, "platform": 1, "clientSeq": 1625051035346, "ts": 1560396843 }
eventType
106
indicates that an audience member leaves the channel In the live streaming profile. The payload
includes the following fields:
Field Name | Data type | Description |
---|---|---|
channelName |
String | The name of the channel. |
uid |
Number | The user ID of the audience member in the channel. |
platform |
Number | The platform type of an audience member's device:1 : Android2 : iOS5 : Windows6 : Linux7 : Web8 : macOS 0 : Other platform |
clientType |
Number | The type of services used by the audience member on Linux. Common return values include:3 : On-premise recording10 : Cloud recordingThis field is only returned when platform is 6 . |
clientSeq |
Number | The sequence number, which is used to identify the order in which events occur on the app client. You can use the value of this field to sort the events of a user into chronological order. For details, see Maintain User Online Status. |
reason |
Number | The reasons why the audience member leaves the channel.1 : The audience member quits the call.2 : The connection between the app client and the Agora RTC server times out, which occurs when the Agora SD-RTN™ does not receive any data packets from the app client for more than 10 seconds.3 : Permission issues. For example, the audience member is kicked out of the channel by the administrator through the Banning user privileges RESTful API.4 : Internal issues with the Agora RTC server. For example, the Agora RTC server disconnects from the app client for a short period of time for load balancing. When the load balancing is finished, the Agora RTC server reconnects with the client.5 : The audience member uses a new device to join the channel, which forces the old device to leave the channel.9 : The app client has multiple IP addresses, the SDK actively disconnects from the Agora RTC server and reconnects. The user is not aware of this process. Check whether the app client has multiple public IP addresses or uses a VPN.10 : Due to network connection issues, for example, therefore the SDK does not receive any data packets from the Agora RTC server for more than 4 seconds or the socket connection error occurs, the SDK actively disconnects from the Agora server and reconnects. The user is not aware of this process. Check the network connection status. 999 : The user has unusual activities, such as frequent login and logout actions. 60 seconds after receiving the 104 or 106 event callback with reason as 999, your app server needs to call the Banning user privileges API to remove the user from the current channel; otherwise, your server could fail to receive any notification callbacks about the user's events if the user rejoins the channel. 0 : Other reasons. |
ts |
Number | The Unix timestamp (s) when the event occurs on the Agora RTC server. |
duration |
Number | The length of time (s) that the audience member stays in the channel. |
Example of the payload
:
{ "channelName": "test_webhook", "uid": 12121212, "platform": 1, "clientSeq": 1625051035390, "reason": 1, "ts": 1560396943, "duration": 600 }
eventType
107
indicates that a user joins the channel in the communication profile. The payload
includes the following fields:
Field Name | Data type | Description |
---|---|---|
channelName |
String | The name of the channel. |
uid |
Number | The user ID of the user in the channel. |
platform |
Number | The platform type of the user's device:1 : Android2 : iOS5 : Windows6 : Linux7 : Web8 : macOS 0 : Other platform |
clientSeq |
Number | The sequence number, which is used to identify the order in which events occur on the app client. You can use the value of this field to sort the events of a user into chronological order. For details, see Maintain User Online Status. |
ts |
Number | The Unix timestamp (s) when the event occurs on the Agora RTC server. |
Example of the payload
:
{ "channelName": "test_webhook", "uid": 12121212, "platform": 1, "clientSeq": 1625051035369, "ts": 1560396834 }
eventType
108
indicates that a user leaves the channel in the communication profile. The payload
includes the following fields:
Field Name | Data type | Description |
---|---|---|
channelName |
String | The name of the channel. |
uid |
Number | The user ID of the user in the channel. |
platform |
Number | Platform type of the user's device:1 : Android2 : iOS5 : Windows6 : Linux7 : Web8 : macOS 0 : Other platform |
clientSeq |
Number | The sequence number, which is used to identify the order in which events occur on the app client. You can use the value of this field to sort the events of a user into chronological order. For details, see Maintain User Online Status. |
reason |
Number | The reasons why a user leaves the channel:1 : The user quits the call.2 : The connection between the app client and the Agora RTC server times out, which occurs when the Agora SD-RTN™ does not receive any data packets from the app client for more than 10 seconds.3 : Permission issues. For example, the user is kicked out of the channel by the administrator through the Banning user privileges RESTful API.4 : Internal issues with the Agora RTC server. For example, the Agora RTC server disconnects from the app client for a short period of time for load balancing. When the load balancing is finished, the Agora RTC server reconnects with the client.5 : The user uses a new device to join the channel, which forces the old device to leave the channel.9 : The app client has multiple IP addresses, therefore the SDK actively disconnects from the Agora RTC server and reconnects. The user is not aware of this process. Check whether if the app client has multiple public IP addresses or uses a VPN.10 : Due to network connection issues, for example, the SDK does not receive any data packets from the Agora RTC server for more than 4 seconds or the socket connection error occurs, the SDK actively disconnects from the Agora server and reconnects. The user is not aware of this process. Check the network connection status. 999 : The user has unusual activities, such as frequent login and logout actions. 60 seconds after receiving the 104 or 106 event callback with reason as 999, your app server needs to call the Banning user privileges API to remove the user from the current channel; otherwise, your server could fail to receive any notification callbacks about the user's events if the user rejoins the channel. 0 : Other reasons. |
ts |
Number | The Unix timestamp (s) when the event occurs on the Agora RTC server. |
duration |
Number | The length of time (s) that the user stays in the channel. |
Example of the payload
:
{ "channelName": "test_webhook", "uid": 12121212, "platform": 1, "clientSeq": 1625051037369, "reason": 1, "ts": 1560496834, "duration": 600 }
eventType
111
indicates that an audience member calls setClientRole
to switch their user role to host in the live streaming profile. The payload
includes the following fields:
Field Name | Data type | Description |
---|---|---|
channelName |
String | The name of the channel. |
uid |
Number | The user ID of the user in the channel. |
clientSeq |
Number | The sequence number, which is used to identify the order in which events occur on the app client. You can use the value of this field to sort the events of a user into chronological order. For details, see Maintain User Online Status. |
ts |
Number | The Unix timestamp (s) when the event occurs on the Agora RTC server. |
Example of the payload
:
{ "channelName": "test_webhook", "uid": 12121212, "clientSeq": 1625051035469, "ts": 1560396834 }
eventType
112
indicates that a host call setClientRole
to switch their user role to audience member in the live streaming profile. The payload
contains the following fields:
Field Name | Data type | Description |
---|---|---|
channelName |
String | The name of the channel. |
uid |
Number | The user ID of the user in the channel. |
clientSeq |
Number | The sequence number, which is used to identify the order in which events occur on the app client. You can use the value of this field to sort the events of a user into chronological order. For details, see Maintain User Online Status. |
ts |
Number | The Unix timestamp (s) when the event occurs on the Agora RTC server. |
Example of the payload
:
{ "channelName": "test_webhook", "uid": 12121212, "clientSeq": 16250510358369, "ts": 1560496834 }