logo
On this page

Send comments


Description

Calling this interface triggers the comment event within the live comment-based game, resulting in corresponding effects in the live comment-based game client.

Since specific comments need to be sent to trigger the effects, for example: sending "5" or "6" to join the blue team or red team, please contact the ZEGOCLOUD technical support team to obtain the default comment rules for the game, or to establish the corresponding relationship between specified game comments and operations. If the comment sent by the user does not belong to the agreed content, it will be considered invalid and filtered.

Note
  • The game platform will try its best to ensure the validity of comments.
  • Please merge users' bullet comments at the room level before sending requests to this interface. It is recommended to integrate users' bullet comments every 50-200ms.

Request method and endpoint

  • Request method: POST
  • Request URL: https://mini-game-api.zego.im/?Action=SendDanmakuComments
  • Transmission protocol: HTTPS
  • Call frequency limit: 50 times/second (at the room level)

Request parameters

The following request parameter list only lists interface request parameters. For the public parameter list, please refer to Make API requests.

ParametersTypeIs it requiredDescription
RoomIdStringYesRoom ID, defined by you, can be up to 64 characters long.
MiniGameIdStringYesTo obtain your Game ID, please contact the ZEGOCLOUD technical support team.
CommentListArray of ObjectYesIntegrated comment list.
UserInfoObjectYesUser information object.
UserIdStringYesUser ID to join the game, defined by you. The maximum length is 48 characters, only numbers and English are allowed.
NicknameStringYesThe user nickname is defined by you. It can be up to 32 characters long.
AvatarStringYesThe address of the user's avatar must be a valid HTTP/HTTPS address and the length must be within 1024 bytes.
SexStringNoUser gender.
  • 1:Male.
  • 2:Female
ContentStringYesContent of user comments.

Request example

  • Request URL

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

    Untitled
    {
      "RoomId": "room123",
      "MiniGameId": "TinyLoveWar",
      "CommentList": [
        {
          "UserInfo": {
            "UserId": "user1",
            "Nickname": "test1",
            "Avatar": "http://",
            "Sex": 1
          },
          "Content": "666"
        },
        {
          "UserInfo": {
            "UserId": "user2",
            "Nickname": "test2",
            "Avatar": "http://",
            "Sex": 1
          },
          "Content": "888"
        }
      ]
    }
    
    1
    Copied!

Response parameters

ParameterTypeDescription
CodeNumberError Code.
MessageStringDescription of the request result.
RequestIdStringRequest ID.

Response example

Untitled
{
    "Code": 0,
    "Message": "succeed",
    "RequestId": "abcd123",
}
1
Copied!

Return code

The following only lists the return codes related to the interface business logic. For complete return codes, please refer to Global return codes.

Return codeDescriptionHandling suggestions
 7202001 The game was not found. Possible reasons include:
  • MiniGameId input error.
  • Permissions for this game have not been activated.
  • Please check whether the MiniGameId is correct.
  • Please contact ZEGOCLOUD business personnel to activate the permission for this game.
 7202002 MiniGameId format error.Please confirm whether the format is String.

Previous

Send likes

Next

Send gifts