Sending System Messages in a Group

Last updated: 2020-07-06 16:40:45

    Feature Description

    This API is used by the app admin to send notifications in a group.

    API Calling Description

    Applicable group types

    Group Type ID Is this RESTful API Supported?
    Private Yes. Same as Work (work group for friends) in the new version.
    Public Yes.
    ChatRoom Yes. Same as Meeting (temporary meeting group) in the new version.
    AVChatRoom Yes, but only to all group members.

    These are the 4 built-in group types in IM. For detailed information, see the Group System.

    Non-livestreaming groups support sending system notifications to a specified set of group members, but AVChatRooms (livestreaming groups) only support sending system notifications to all group members.

    Sample request URL

    https://console.tim.qq.com/v4/group_open_http_svc/send_group_system_notification?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json

    Request parameters

    The list below contains only the parameters commonly used when calling this API and their descriptions. For more parameters, see RESTful API Overview.

    Parameter Description
    v4/group_open_http_svc/send_group_system_notification Request API.
    sdkappid SDKAppID assigned by the IM console when the application is created
    identifier The value must be the app admin account. For more information, see App Admins.
    usersig Signature generated by the app admin account. For details, see Generating UserSig.
    random A random 32-bit unsigned integer ranging from 0 to 4294967295

    Maximum calling frequency

    The maximum calling frequency is 200 calls per second.

    Sample request packet

    • Basic form
      Send notifications to all members of a group.

      {
        "GroupId": "@TGS#2C5SZEAEF",
        "Content": "Hello World" // Content of the system notification
      }
    • Specify group members to receive the message
      To specify who can receive the system notification, set the recipients in ToMembers_Account. AVChatRooms (livestreaming groups) do not support specifying group members to receive messages.

      {
        "GroupId": "@TGS#2C5SZEAEF",
        "ToMembers_Account": [ // List of recipients. Leave this field empty to send notifications to all members.
            "peter",
            "leckie"
        ],
        "Content": "Hello World" // Content of the system notification
      }

    Request packet fields

    Field Type Required Description
    GroupId String Required ID of the group to which the notification will be sent
    ToMembers_Account Array Optional A list of recipients. Leave this field empty to send notifications to all members.
    Content String Required Content of the system notification

    Sample response packet body

    {
        "ActionStatus": "OK",
        "ErrorInfo": "",
        "ErrorCode": 0
    }

    Response packet fields

    Field Type Description
    ActionStatus String The processing result of the request. OK: succeeded. FAIL: failed.
    ErrorCode Integer Error code. 0 indicates that the request was successful, and any non-zero value indicates that the request failed.
    ErrorInfo String Detailed error information

    Error Codes

    Unless a network error (such as error 502) occurs, the returned HTTP status code for this API is always 200. The specific error code and details can be found in the response packet fields such as ErrorCode and ErrorInfo.
    For public error codes (60000 to 79999), see Error Codes.
    The list below contains error codes specific to this API:

    Error Code Description
    10002 An internal server error occurred. Please try again.
    10003 The request command word is invalid.
    10004 A parameter is invalid. Check the error description and troubleshoot the issue.
    10007 Insufficient permissions. For example, to remove someone from a public group requires admin permissions.
    10010 The group does not exist, or once existed but has been disbanded.
    10015 The group ID is invalid. Be sure to use the correct group ID.

    API Debugging Tool

    Use the online debugging tool for RESTful APIs to debug this API.

    Reference

    Sending ordinary messages in a group (v4/group_open_http_svc/send_group_msg)

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help