Creates an interactive messaging application.
Usage notes
- When you call other operations to manage an interactive messaging application, you must specify the same data center in which the application is created.
- An Alibaba Cloud account can create up to 300 interactive messaging applications.
QPS limit
You can call this operation up to 50 times per second per account. Requests that exceed this limit are dropped and you may experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see QPS limits.
Debugging
Request parameters
Custom content moderation
- Request protocol: HTTP
- Request method: POST
- Sample request:
{ "content": "testaudit" }
- Sample response:
{ "pass": true,"reason":"****" | If the value of the pass field is true, the content passed the review. If the value of the pass field is false, the content failed the review. The reason field provides the reason for the failure. }
Event callbacks
The HTTP or HTTPS request method is POST. The request body is a JSON string encoded in UTF-8. Sample event callback:
{
"transactionid":"A8C7B033-B339-1A58-B0E0-7B9197BA****",
"appid":"demo",
"eves":[{
"uid":"uid1",
"sid":"sessionid",
"events":[{
"e": 3, | The event. Valid values: 1 (logon), 2 (logoff), 3 (joining a group), 4 (leaving a group), and 5 (network reconnection).
"r": 1, | The reason for logoff. This field is required only for the logoff event. Valid values: 1 (normal call), 3 (timeout), and 4 (logon on another device).
"g": "testgroup", | The group ID. This field is required only for the event of joining or leaving a group.
"gs":["testgroupid"] | The IDs of the groups that the client joins. This field is required only for the event of network reconnection.
}]
}]
}
Callback authentication
The HTTP or HTTPS request header contains the Ali-Live-Timestamp and Ali-Live-Signature fields for signature verification on the receiving server. The value of the Ali-Live-Signature field is calculated based on the following formula: Ali-Live-Signature = sha256(CONTENT), in which CONTENT = Callback domain name|Ali-Live-Timestamp value|Authentication key. The callback domain name is the domain name of the callback URL. The authentication key is the AppKey generated when you create the application.
Response parameters
Parameter |
Type |
Example |
Description |
RequestId | String | 65EEDBEB-43FE-1E15-976F-3DDD753A**** | The request ID. |
AppId | String | demo | The application ID. The ID is used in subsequent operations, such as joining a group. |
AppKey | String | ********************************** | The AppKey for authentication of this application. |
AppSign | String | ************************************************************************** | The application signature. The signature is required when you use the interactive messaging SDK. |
DataCenter | String | cn-shanghai | The data center in which the interactive messaging application was created. |
Example
Sample request
http(s)://live.aliyuncs.com?Action=CreateLiveMessageApp
&AppName=testApp
&AuditType=2
&AuditUrl=http://demo.aliyundoc.com/exampleaudit
&EventCallbackUrl=http://demo.aliyundoc.com/examplecallback
&DataCenter=cn-shanghai
&MsgLifeCycle=1
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateLiveMessageAppResponse>
<RequestId>65EEDBEB-43FE-1E15-976F-3DDD753A****</RequestId>
<AppId>demo</AppId>
<AppKey>**********************************</AppKey>
<AppSign>**************************************************************************</AppSign>
</CreateLiveMessageAppResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "65EEDBEB-43FE-1E15-976F-3DDD753A****",
"AppId" : "demo",
"AppKey" : "**********************************",
"AppSign" : "**************************************************************************"
}
Error codes
HTTP status code |
Error code |
Error message |
Description |
400 | InputInvalid | %s. | The specified parameters are invalid. |
400 | ErrorInvalidAppName | %s. | The AppName parameter is invalid. |
400 | ErrorTooManyApps | %s. | The number of interactive messaging applications exceeds the limit. An Alibaba Cloud account can create up to 300 interactive messaging applications. |
400 | ErrorInvalidEventCallbackUrl | %s. | The EventCallbackUrl parameter is invalid. |
400 | ErrorInvalidAuditUrl | %s. | The AuditUrl parameter is invalid. |
403 | NoAuth | %s. | You do not have the required permissions. |
404 | ResourceNotExist | %s. | The requested resource does not exist. |
500 | ServerError | %s. | An unknown error occurred. Try again later or submit a ticket. |
For a list of error codes, see Service error codes.