logo
In-app Chat
On this page

Register Bots


Description

Call this interface to register multiple bots.

Request method and endpoint

  • Request method:POST
  • Request endpointhttps://zim-api.zego.im/?Action=RobotRegister
  • Transfer protocol:HTTPS
  • QPS limit:20 times/second

Request parameters

The following table describes only the method-specific request parameters and some common request parameters. For the complete list of common request parameters, see Accessing Server APIs - Common request parameters.

ParameterTypeRequiredDescription
UserInfoArray Of ObjectYesList of bot user information. A maximum of 20 bots can be registered at once.
└UserIdStringYesBot user ID. Length cannot exceed 32 bytes and must start with @RBT#.
└UserNameStringNoBot name. Length cannot exceed 256 bytes.
└UserAvatarStringNoBot avatar URL. Length cannot exceed 500 bytes.

Request example

  • Request URL:

    Untitled
    https://zim-api.zego.im/?Action=RobotRegister
    &<Common request parameters>
    
    1
    Copied!
  • Request body:

    Untitled
    {
        "UserInfo":[
        {
            "UserId": "@RBT#R1",
            "UserName": "userNameA",
            "UserAvatar": "https"
        },
        {
            "UserId": "@RBT#R2",
            "UserName": "userNameB",
            "UserAvatar": "https"
        }
        ]
    }
    
    1
    Copied!

Response parameters

ParameterTypeDescription
CodeNumberReturn code.
Note
When you register multiple bots at once:
  • If one or more bot user IDs are successfully registered, Code will return 0. In this case, please refer to the specific information in ErrorList to confirm the operation result.
  • If all bot user IDs fail to register, Code will return the relevant return code. For details, see Return codes.
MessageStringDescription of the operation result.
RequestIdStringRequest ID.
ErrorListObjectList of failure information.
  • When Code is 0:
    • If ErrorList is empty, all bot user IDs are successfully registered.
    • If ErrorList is not empty, it indicates that some bot user IDs failed to register. Please refer to SubCode and SubMessage for handling.
  • When Code is not 0:
    • If ErrorList is empty, it indicates parameter error, API rate limit, or system error.
    • If ErrorList is not empty, it indicates that all bot user IDs failed to register, and all are existing bot user IDs.
└UserIdStringThe bot user ID that failed to register.
└SubCodeNumberThe specific return code for bot registration failure.
└SubMessageStringThe reason for bot registration failure.

## Response example

Untitled
{
    "Code": 0,
    "Message": "success",
    "RequestId": "343649807833778782"
}
1
Copied!

Return Codes

Return CodeDescriptionPossible ReasonSolution
660000001A common service error occurred.A server error occurred.Try again, or contact ZEGOCLOUD technical support.
660000002Invalid parameter.The input parameter is invalid or not specified.Check the input parameter.
660300005The frequency of calling the API exceeds the AppID-level limit.Please try again later, or refer to the relevant documentation for the call frequency.
660000012The length of the UserID parameter exceeds the limit.The UserID parameter cannot exceed 32 bytes in length.Make sure that the UserID parameter does not exceed 32 bytes.
660700001Too many requests are sent.More than 20 requests are sent per second.Try again later.
660700002The bot already exists.The userID specified in the request has already been registered.Make sure that the userID has not been registered before.
660700006The length of the UserName parameter exceeds the limit.The UserName parameter cannot exceed 256 bytes in length.Make sure that the UserName parameter does not exceed 256 bytes.
660700007The length of the UserAvatar parameter exceeds the limit.The UserAvatar parameter cannot exceed 500 bytes in length.Make sure that the UserAvatar parameter does not exceed 500 bytes.

Previous

Delete a conversation

Next

Obtain a license