Send channel message
Updated
Sends a channel Signaling message from the server.
https://api.agora.io/dev/v2/project/{appid}/rtm/users/{user_id}/channel_messagesSends a channel message from the server. You can send a message to a channel without joining it first.
Path Parameters
The App ID of your Agora project.
Signaling user ID to send a channel message. It must not exceed 64 characters in length or be an empty string. Since user_id is a URL parameter, the first and last characters must not be a space.
Note
Since user_id is a URL parameter, the first character and the last characters must not be a space.
Request Body
application/json
Signaling channel name to receive a channel message. It must not exceed 64 characters in length or be an empty string.
Whether to save as a historical message.
true: Save as a historical message.false: Do not save as a historical message.
falseContent of the channel message. It must not be an empty string or exceed 32 KB in length.
Response
-
If the returned status code is
200, the request was successful. The response body contains the result of the request. -
If the returned status code is not
200, the request failed. The response body includes the error code and description. Refer to status codes to understand the possible reasons for failure.
Response Body
application/json
Response schema
200application/jsonThe request was successful. The response body contains the result of the request.
Request result. success if the request succeeds, failed if it fails.
Request result.
- success: The request succeeds.
- failed: The request fails.
Unique ID to identify this request.
Message status: message_sent.
Message status.
- message_sent: The message is sent.
defaultapplication/jsonThe request failed. The response body includes the error code and description.
Request examples
curl -X POST 'https://api.agora.io/dev/v2/project/876922cbca0098dff4323566daa89675/rtm/users/userA/channel_messages' \ -H 'Content-Type: application/json;charset=utf-8' \ -H 'Authorization: Basic <your_base64_encoded_credentials>' \ -d '{ "channel_name": "channelA", "enable_historical_messaging": false, "payload": "Hello" }'Response example
{ "result": "success", "request_id": "123", "code": "message_sent"}