Send Normal Message
Feature Description
The App admin can use this API to send regular messages via this interface.
API Call Description
Sample Request URL
https://xxxxxx/v4/live_engine_http_srv/send_text_msg?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json
Request Parameters
The following table lists only the parameters involved in modification when calling this API and their descriptions. For more details about the parameters, please refer to REST API introduction.
Parameter | Description |
xxxxxx | SDKAppID's dedicated domain name where it is located: China: console.tim.qq.comSingapore: adminapisgp.im.qcloud.comUnited States: adminapiusa.im.qcloud.com |
v4/live_engine_http_srv/send_text_msg | Request API |
sdkappid | The SDKAppID assigned by the Chat console when creating an application can be obtained from the application card in the Console of Chat. |
identifier | Must be an application admin account. For more details, see the documentation Application Administrator. |
usersig | The signature generated by the application admin account. For specific operations, see Generate UserSig. |
random | Enter a random 32-bit unsigned integer, value ranges from 0 to 4294967295. |
contenttype | Request format, the value is fixed as json. |
Maximum Calling Frequency
200times/second。
Sample Request Packet
Basic form
{"RoomId":"room1","Sender_Account":"user1","TextContent":"msg", // message context"ExtensionInfo" :"{\"data\":1,\"value\":2}" // Optional field; it must be in JSON format}
Request Packet Fields
Field | Type | Attribute | Description |
RoomId | String | Required | Room ID. |
Sender_Account | String | Required | Message sender. |
TextContent | String | Required | Message text content. |
ExtensionInfo | String | Optional | Custom message data. It is saved in the cloud and will be sent to the receiver. Such data can be pulled after the app is uninstalled and reinstalled. |
Webhook of Message Format Instruction
The message format of this message corresponds to the text message format, and it also contains custom message data CloudCustomizaData. Before Group Message Is Sent and After a Group Message Is Sent have the following fields, as follows:
{"CloudCustomData" : "{\"data\":1,\"value\":2}","MsgBody" : [{"MsgContent" : {"Text" : "msg"},"MsgType" : "TIMTextElem"}],}
CloudCustoms Data corresponds to the ExtendeInfo field in the request, while the Text field corresponds to the content of the message being sent.
Response Package Example
{"ErrorCode": 0,"ErrorInfo": "","ActionStatus": "OK","RequestId": "Id-ec3xxxxxxxxxxxxxxxxxxxxxxxxed-O-Seq-2433650","Response": {"MsgTime": 1750074420,"MsgSeq": 25,"MsgDropReason" : "MsgFreqCtrl"}}
Response Packet Fields
Field | Type | Description |
ActionStatus | String | Request processing result. OK: processing successful. FAIL: processing failed. |
ErrorCode | Integer | Error Code. 0: success. Non-zero: Indicates Failure. |
ErrorInfo | String | Error message. |
RequestId | String | Unique request ID, returned for each request. To locate a problem, the RequestId of the request should be provided. |
MsgTime | Integer | Message sending timestamp, corresponding to the backend server time. |
MsgSeq | Integer | Message sequence number, the unique identifier of a message. |
MsgDropReason | String | Reason for discarding the message. It is empty by default. Currently, only messages that exceed the frequency limit are discarded. |
Error Code Description
Unless a network error (such as 502) occurs, the HTTP return code of this API is 200. The actual error code and error information are indicated by ErrorCode and ErrorInfo in the response payload.
Private error codes of this API are as follows:
Error Code | Description |
100001 | Server internal error, please try again. |
100002 | Invalid parameter. Check whether the request is correct according to the error description. |
100004 | The room does not exist, possibly because it was never created or has already been dissolved |
100006 | Indicates that this room is not a live room and does not have permission to use live query interfaces |
100601 | The message cannot be sent due to muting. Check whether the sender is muted. |
100602 | The frequency limit for message sending is reached. Try again later. |
100603 | The message content is too long. Currently, the maximum message length supported is 12 KB. Please adjust the message length. |