Creating an Interaction Rule Library for Live Rooms
Function
Creates an interaction rule library for live rooms.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions. For details about the required permissions, see Permissions Policies and Supported Actions.
URI
POST /v1/{project_id}/smart-live-interaction-rule-groups
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
No |
String |
User token. This parameter is mandatory when token authentication is used. You can obtain the token by calling the IAM API used to obtain a user token. Value of X-Subject-Token in the response header. |
|
Authorization |
No |
String |
Authentication information. This parameter is mandatory for AK/SK authentication. |
|
X-Sdk-Date |
No |
String |
Time when the request is sent. This parameter is mandatory for AK/SK authentication. The format is YYYYMMDD'T'HHMMSS'Z'. |
|
X-Project-Id |
No |
String |
Project ID. This parameter is mandatory for AK/SK authentication. |
|
X-App-UserId |
No |
String |
Third-party user ID, which does not allow Chinese characters. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
group_name |
Yes |
String |
Interaction rule library name. |
|
interaction_rules |
No |
Array of InteractionRuleInfo objects |
Interaction rules. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
rule_index |
No |
String |
Details: Rule index. It is used to index a specific rule when the rule is triggered. Constraints: You do not need to specify it. Options: 0 to 64 characters Default value: N/A |
|
rule_name |
No |
String |
Details: Rule name. Constraints: N/A Options: 0 to 256 characters Default value: N/A |
|
enabled |
No |
Boolean |
Details: Whether to enable. Constraints: N/A Options:
Default value: true |
|
event_type |
No |
Integer |
Details: Livestreaming event type matched by the rule. The value range is 0 to 100. Options: 1: On-screen comments 2: User joining a room 3: Giving likes 4: Sending gifts 10: Preset script events Use the actual value.
NOTE:
Constraints: N/A Default value: N/A Value range: 0~100 |
|
hit_condition |
No |
HitCondition object |
Rule matching condition |
|
trigger |
No |
TriggerProcess object |
Processing after rule matching |
|
review_config |
No |
ReviewConfig object |
Content review configuration. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
relation |
No |
String |
Details: Condition relationship, specifically, the logical operation relationship between multiple conditions. Constraints: N/A Options:
Default value: N/A |
|
priority |
No |
Integer |
Details: Priority. A smaller value indicates a higher priority. The value ranges from 0 to 999. The default value is 500. This parameter is optional. Constraints: N/A Value range: 0~999 Default value: 500 |
|
tags |
No |
Array of HitConditionTag objects |
Matching relationship configuration |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
tag |
No |
String |
Details: Key fields in the event content.
NOTE:
{ "timestamp": 1694481224245, "type": 1, "content": "{"user":{"userId":"2027271526","name":"","level":17,"badge":"","badgeLevel":0},"content":""}" } To match the on-screen comment content, enter content. To match the user platform level, enter level. Constraints: N/A Options: The value contains 0 to 256 characters. Default value: N/A |
|
operation |
No |
String |
Details: Field value processing Constraints: N/A Options:
Default value: NONE |
|
match |
No |
String |
Details: Match type. You are advised to use REGEX for keyword matching. Constraints: N/A Options:
Default value: N/A |
|
value |
No |
String |
Details: Matched value. Constraints: N/A Options: The value contains 0 to 1,024 characters. Default value: N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
time_window |
No |
Integer |
Details: Processing suppression duration, in second.
Constraints: N/A Default value: N/A Value range: -1~7200 |
|
reply_mode |
No |
String |
Definition: Reply type. Constraints: N/A Value range:
Default value: N/A |
|
layer_config |
No |
SmartLayerConfig object |
Intelligent layer configuration. |
|
extra_layer_config |
No |
SmartLayerConfig object |
Additional layer, which is used together with the second layer when dynamic text needs to be displayed for products. |
|
reply_texts |
No |
Array of strings |
Details: Reply scripts. Constraints: N/A Options: A maximum of five preset scripts are allowed. A single script contains 0 to 1,024 characters. Default value: N/A |
|
reply_audios |
No |
Array of ReplyAudioInfo objects |
Details: Reply audio set. Set audio_url. Constraints: N/A Options: A maximum of five preset audio files are allowed. Default value: N/A |
|
reply_order |
No |
String |
Details: Sequence of reading reply scripts. Constraints: N/A Options:
Default value: N/A |
|
reply_role |
No |
String |
Details: Reply role. Constraints: N/A Options:
Default value: STREAMER |
|
robot_id |
No |
String |
Details: Bot ID. Constraints: ID of the large model robot configured for intelligent interaction. This parameter is mandatory when reply_mode is set to INTELLIGENT_REPLY. For details about how to obtain the ID, see Creating an Application. Options: The value contains 0 to 64 characters. Default value: N/A |
|
play_type |
No |
String |
Reply playback type.
Default value: PLAY_NOW |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
layer_type |
Yes |
String |
Layer type.
|
|
asset_id |
No |
String |
ID of the asset overlaid on a video. You do not need to set this parameter for external assets. |
|
position |
No |
LayerPositionConfig object |
Layer position configuration. |
|
size |
No |
LayerSizeConfig object |
Layer size configuration. |
|
image_config |
No |
SmartImageLayerConfig object |
Image layer configuration. |
|
video_config |
No |
SmartVideoLayerConfig object |
Video layer configuration. |
|
text_config |
No |
SmartTextLayerConfig object |
Video layer configuration. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
dx |
Yes |
Integer |
Definition X axis position of the pixel in the upper left corner of the image. The coordinate of the upper left corner of the image layout is 0x0. The video resolution is 1920 x 1080 in landscape mode (16:9) and 1080 x 1920 in portrait mode (9:16). Constraints The value is the pixel value relative to the image layout. It indicates only the layout position relationship and is irrelevant to the resolution of the output image. Value range: -1920~3840 Default value: 0 |
|
dy |
Yes |
Integer |
Definition Y axis position of the pixel in the upper left corner of the image. The coordinate of the upper left corner of the image layout is 0x0. The video resolution is 1920 x 1080 in landscape mode (16:9) and 1080 x 1920 in portrait mode (9:16). Constraints The value is the pixel value relative to the image layout. It indicates only the layout position relationship and is irrelevant to the resolution of the output image. Value range: -1920~3840 Default value: 0 |
|
layer_index |
Yes |
Integer |
Definition Overlay sequence of an image, video, or person image.
NOTE:
The overlay sequence is an integer starting from 1 and incremented by 1.
Constraints If there are duplicate overlays, the relationship between the duplicate overlays is random. Value range: 1~100 Default value: 100 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
width |
No |
Integer |
Definition Y axis position of the pixel in the upper left corner of the image, that is, width (in pixels) of the image overlay (relative to the preview area size). The video resolution is 1920 x 1080 in landscape mode (16:9) and 1080 x 1920 in portrait mode (9:16). Constraints The value is the pixel value relative to the image layout. It indicates only the layout position relationship and is irrelevant to the resolution of the output image. Value range: 1~7680 |
|
height |
No |
Integer |
Definition Height (in pixels) of the image overlay (relative to the preview area size). The video resolution is 1920 x 1080 in landscape mode (16:9) and 1080 x 1920 in portrait mode (9:16). Constraints The value is the pixel value relative to the image layout. It indicates only the layout position relationship and is irrelevant to the resolution of the output image. | Value range: 1~7680 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
image_url |
Yes |
String |
Image file URL. |
|
display_duration |
No |
Integer |
Details: Image display duration, in second. If reply_texts and reply_audios are carried, the duration is the same as the audio playback duration. If reply_texts and reply_audios are not carried, the duration is the same as the audio playback duration of the matched keyword. Value range: 0~3600 Default value: 0 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
video_url |
Yes |
String |
Video file URL. |
|
video_cover_url |
No |
String |
Video thumbnail file URL. |
|
display_duration |
No |
Integer |
Details: Image display duration, in second. If reply_texts and reply_audios are carried, the duration is the same as the audio playback duration. If reply_texts and reply_audios are not carried, the duration is the same as the audio playback duration of the matched keyword. Value range: 0~3600 Default value: 0 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
text_type |
No |
String |
Details: Text type.
Default value: DYNAMIC |
|
text_context |
No |
String |
Text. |
|
font_name |
No |
String |
Details: Font. The following fonts are supported:
Default value: HarmonyOS_Sans_SC_Black |
|
font_size |
No |
Integer |
Details: Font size (in pixel). Value range: [4, 120]. The value range is subject to the actual service. Value range: 0~120 Default value: 16 |
|
font_color |
No |
String |
Details: Font color. RGB color value. Default value: #FFFFFF |
|
display_duration |
No |
Integer |
Details: Text display duration, in second. If reply_texts and reply_audios are carried, the duration is the same as the audio playback duration. If reply_texts and reply_audios are not carried, the duration is the same as the audio playback duration of the matched keyword. Value range: 0~3600 Default value: 0 |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
X-Request-Id |
String |
Request ID. |
|
Parameter |
Type |
Description |
|---|---|---|
|
group_id |
String |
Interaction rule library ID. |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error description. |
Status code: 401
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error description. |
Status code: 500
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error description. |
Example Requests
POST https://{endpoint}/v1/70b76xxxxxx34253880af501cdxxxxxx/smart-live-interaction-rule-groups
{
"group_name" : "Welcome Message"
}
Example Responses
Status code: 200
Succeeded.
{
"group_id" : "26f06524-4f75-4b3a-a853-b649a21aaf66"
}
Status code: 400
Parameters error, including the error code and its description.
{
"error_code" : "MSS.00000003",
"error_msg" : "Invalid parameter"
}
Status code: 401
Authentication is not performed or fails.
{
"error_code" : "MSS.00000001",
"error_msg" : "Unauthorized"
}
Status code: 500
Internal service error.
{
"error_code" : "MSS.00000004",
"error_msg" : "Internal Error"
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Succeeded. |
|
400 |
Parameters error, including the error code and its description. |
|
401 |
Authentication is not performed or fails. |
|
500 |
Internal service error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot