The message notification service can inform your server of Agora product events through HTTP/HTTPS protocol requests. This service integrates some events of the Cloud Recording, Media Push and Media Pull products. You can use this service by providing configuration information to Agora.
Contact email@example.com enable the message notification service with the following information:
- HTTP/HTTPS server address (URL) to receive notification callbacks.
- The product that you want to use the notification service.
- Events that you want to be notified, see Cloud Recording Event Type.
- Set whether or not to enable the notification Retry option. If you enable this option, the notification server resends the notification callback up to three times after it fails to send the first notification callback in the following situations:
- Your server does not respond in 10 seconds.
- The HTTP status code received from your server is not 200.
After the configuration is completed, the message notification service will take effect after 5 minutes. Therefore, your server needs to respond to the notification server immediately. The response
bodymust be in JSON format.
After configuring the message notification service, we will automatically generate the
secret is a string type
key that can be used to generate a signature. You need to save this
key for signature verification. See Signature verification for details.
The notification callback is sent to your server as an HTTP/HTTPS POST request with the
body in JSON format. The character encoding is UTF-8.
header of the notification callback contains the following fields:
|The signature generated by Agora using the secrect key and the HMAC/SHA1 algorithm. You need to use the secret key and HMAC/SHA1 algorithm to verify the signature value. See Signature verification for details.|
|The signature generated by Agora using the secrect key and the HMAC/SHA256 algorithm. You need to use the secret key and HMAC/SHA256 algorithm to verify the signature value. See Signature verification for details.|
body of the notification callback contains the following fields:
|String||Notification ID, identifying the notification callback when the event occurs.|
|Number||Product ID: |
|Number||The Unix time (ms) when the notification server requests to your server, which is updated each time it resends the notification callback.|
|JSON Object||The content of the events, see Cloud Recording |
We generate the
key directly. After using the HMAC/SHA1 and HMAC/SHA256 algorithms, we generate the
Agora-Signature-V2. You can use the saved
key to verify
Agora-Signature with the HMAC/SHA1 algorithm or verify
Agora-Signature-V2 with the HMAC/SHA256 algorithm.
The signature verification sample code is as follows:
- Your server does not receive messages in the same order as events occur.
- For the reliability of the notification callbacks, the notification server may send at least two notification callbacks when the event occurs. Hence, your server should be able to handle duplicate messages.