All Products
Search
Document Center

ApsaraVideo Live:CreateLiveMessageApp

Last Updated:Nov 14, 2024

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 is created.
  • You can create up to 300 interactive messaging applications in an Alibaba Cloud account.

QPS limit

You can call this operation up to 50 times per second per account. Requests that exceed this limit are dropped and you will experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see QPS limits.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
live:CreateLiveMessageAppcreate
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
AppNamestringNo

The name of the application. The name must be 2 to 16 characters in length.

testApp
AuditTypeintegerNo

The content moderation method. Valid values:

  • 0 (default): disables content moderation.
  • 1: uses built-in content moderation.
  • 2: uses custom content moderation.
2
AuditUrlstringNo

The URL for content moderation. If you set AuditType to 2, you must specify this parameter. The URL must start with http:// or https:// and cannot contain a private IP address or a port number. For more information about custom content moderation, see the "Custom content moderation" section of this topic.

http://demo.aliyundoc.com/exampleaudit
EventCallbackUrlstringNo

The callback URL for events, such as logon, logoff, and joining and leaving a group. If you leave this parameter empty, event callbacks are disabled. The callback URL must start with http:// or https:// and cannot contain a private IP address or a port number. For information about the callback message format and authentication logic, see the "Event callbacks" and "Callback authentication" sections of this topic.

http://demo.aliyundoc.com/examplecallback
DataCenterstringNo

The data center. Valid values:

  • cn-shanghai (default)
  • ap-southeast-1: Singapore
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
MsgLifeCycleintegerNo

The retention period of group messages in the application. Valid values:

  • 0 (default): 30 days.
  • 1: 90 days.
  • 2: 180 days.
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.
    

}```

Note 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:

 "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 (reconnection)
     "r": 1, | The reason for logoff. This field is returned for only the logoff event. Valid values: 1 (normal call), 2 (timeout), and 3 (logon from another device)
     "g": "testgroup", | The group ID. This field is returned for the event of joining a group or leaving a group, but not returned for the logon or logoff event.
     "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 received 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

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

65EEDBEB-43FE-1E15-976F-3DDD753A****
AppIdstring

The application ID. The ID is used in subsequent operations, such as joining a group.

demo
AppKeystring

The AppKey for authentication of this application.

**********************************
AppSignstring

The application signature. The signature is required when you use the interactive messaging SDK.

**************************************************************************
DataCenterstring

The data center in which the interactive messaging application was created.

cn-shanghai

Examples

Sample success responses

JSONformat

{
  "RequestId": "65EEDBEB-43FE-1E15-976F-3DDD753A****",
  "AppId": "demo",
  "AppKey": "**********************************",
  "AppSign": "**************************************************************************",
  "DataCenter": "cn-shanghai"
}

Error codes

HTTP status codeError codeError messageDescription
400InputInvalid%s.Illegal input parameters
400ErrorInvalidAppName%s.The AppName is invalid, please check and try again.
400ErrorTooManyApps%s.Under each account, up to 300 apps are allowed to be created at the same time.
400ErrorInvalidEventCallbackUrl%s.The EventCallbackUrl is invalid, please check and try again.
400ErrorInvalidAuditUrl%s.The AuditUrl is invalid, please check and try again.
403NoAuth%s.No permission
404ResourceNotExist%s.The requested resource does not exist, please check and try again
500ServerError%s.Unknown error, please try again later or submit a ticket for consultation.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-03-13The Error code has changed. The request parameters of the API has changedView Change Details
2024-01-31The Error code has changed. The response structure of the API has changedView Change Details