Creates an interactive messaging application.
Operation description
When you call other operations to manage the interactive messaging application, you must specify the same data center in which the application was created.
You can create up to 300 interactive messaging applications in an Alibaba Cloud account.
QPS limits
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 consider this limit when calling this operation.
Try it now
Test
RAM authorization
Action | Access level | Resource type | Condition key | Dependent action |
live:CreateLiveMessageApp | create | *All Resource
| None | None |
Request parameters
Parameter | Type | Required | Description | Example |
AppName | string | No | The application name. It must be 2 to 16 characters in length. | testApp |
AuditType | integer | No | The content moderation method. Valid values:
| 2 |
AuditUrl | string | No | The URL for content moderation. This parameter is required if you set AuditType to 2. The URL must start with http:// or https:// and cannot contain a private IP address or a port number. For the format of custom content moderation, see the "Custom content moderation" section of this topic. | http://demo.aliyundoc.com/exampleaudit |
EventCallbackUrl | string | No | The callback URL for events such as client logon, logoff, joining a group, and leaving a group. If you leave this parameter empty, callbacks are disabled. The callback URL must start with http:// or https:// and cannot contain a private IP address or a port number. For the callback message format and authentication logic, see the "Event callbacks" and "Callback authentication" sections of this topic. | http://demo.aliyundoc.com/examplecallback |
DataCenter | string | No | The data center. Valid values:
Note When you call other operations to manage the interactive messaging application, you must specify the same data center in which the application is created. | cn-shanghai |
MsgLifeCycle | integer | No | The retention period of group messages in the application. Valid values:
| 1 |
Custom content moderation
Request protocol: HTTP
Request method: POST
Sample request:
{
"content": "testaudit"
}
Sample response:
{
"pass": true,
"reason":"****" | If the value of pass is true, the content passes the moderation. Otherwise, the content fails the moderation. The reason field describes the reason for failure.
}
HTTP status code 200 indicates success. If other HTTP status codes are returned, the service is considered unavailable and no content moderation is performed.
Event callbacks
The HTTP or HTTPS request method is POST. The request body is a JSON string encoded in UTF-8. Sample event callback:
{
"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 (reconnection)
"r": 1, | The reason for logoff. This field is returned for only the logoff event. Valid values: 1 (normal call), 3 (timeout), and 4 (logon from another device).
"g": "testgroup", | The group ID. This field is available for joining and leaving a group, but not for logon and logoff events.
"gs":["testgroupid"] | The list of group IDs, which indicates the information about the groups that the client joins upon reconnection. This field is not returned for other events.
}]
}]
}
HTTP status code 200 indicates success. If other HTTP status codes are returned, the system tries to send the callback again.
Callback authentication
When the service initiates a request, it includes the Ali-Live-Timestamp and Ali-Live-Signature fields as HTTP or HTTPS request headers, which are used by the callback receiving server for signature verification. The value of Ali-Live-Signature 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 for which the callback URL is configured, and the authentication key is the AppKey that is generated when you create the application.
Response parameters
Parameter | Type | Description | Example |
object | The returned results. | ||
RequestId | string | The request ID. | 65EEDBEB-43FE-1E15-976F-3DDD753A**** |
AppId | string | The application ID. It can be used in subsequent operations, such as joining a group. | demo |
AppKey | string | The AppKey. It is used to perform authentication for various operations related to the application ID. | ********************************** |
AppSign | string | The application signature. It is required by the interactive messaging SDK. | ************************************************************************** |
DataCenter | string | The data center. | cn-shanghai |
Examples
Success response
JSON format
{
"RequestId": "65EEDBEB-43FE-1E15-976F-3DDD753A****",
"AppId": "demo",
"AppKey": "**********************************",
"AppSign": "**************************************************************************",
"DataCenter": "cn-shanghai"
}Error codes
HTTP status code | Error code | Error message | Description |
400 | InputInvalid | %s. | Illegal input parameters |
400 | ErrorInvalidAppName | %s. | The AppName is invalid, please check and try again. |
400 | ErrorTooManyApps | %s. | Under each account, up to 300 apps are allowed to be created at the same time. |
400 | ErrorInvalidEventCallbackUrl | %s. | The EventCallbackUrl is invalid, please check and try again. |
400 | ErrorInvalidAuditUrl | %s. | The AuditUrl is invalid, please check and try again. |
500 | ServerError | %s. | Unknown error, please try again later or submit a ticket for consultation. |
403 | NoAuth | %s. | No permission |
404 | ResourceNotExist | %s. | The requested resource does not exist, please check and try again |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.