Callback After Sending a Group Message

Last updated: 2021-01-05 10:46:42

    Feature Description

    The app backend can use this callback to monitor users’ group messages in real time. Through this callback, the app backend can be notified of the successfully sent group messages so that it can perform required data synchronization.


    • To enable this callback, you must configure the callback URL and toggle on the corresponding protocol. For details on the configuration method, see Third-Party Callback Configuration.
    • Callback direction: the IM backend initiates an HTTP POST request to the app backend.
    • After receiving the callback request, the app backend must check whether the SDKAppID contained in the request URL is consistent with its own SDKAppID.
    • For other security-related issues, see Third-Party Callback Overview: Security Considerations.

    Callback Triggering Scenarios

    • An app user sends a group message through the client.
    • The app admin sends a group message through a RESTful API.

    Callback Triggering Time

    The callback is triggered after a group message is successfully sent.

    API Description

    Request URL example

    In the following example, the callback URL configured in the app is

    Request parameters

    Parameter Description
    https The request protocol is HTTPS, and the request method is POST. The callback URL.
    SdkAppid The SDKAppID assigned by the IM console when an app is created.
    CallbackCommand The value is fixed to Group.CallbackAfterSendMsg.
    contenttype The value is fixed to JSON.
    ClientIP The client IP address, whose format is similar to
    OptPlatform The client platform. For details on the possible values, see the OptPlatform parameter in Third-Party Callback Overview: Callback Protocols.

    Request packet example

        "CallbackCommand": "Group.CallbackAfterSendMsg", // Callback command
        "GroupId": "@TGS#2J4SZEAEL", // Group ID
        "Type": "Public", // Group type
        "From_Account": "jared", // Sender
        "Operator_Account":"admin", // Request initiator
        "Random": 123456, // Random number
        "MsgSeq": 123, // Message sequence number
        "MsgTime": 1490686222, // Message sending time
        "MsgBody": [ // Message body. For more information, see the TIMMessage message object.
                "MsgType": "TIMTextElem", // Text
                "MsgContent": {
                    "Text": "red packet"

    Request packet fields

    Field Type Description
    CallbackCommand String The callback command.
    GroupId String The ID of the group that generates group messages.
    Type String The type of the group that generates group messages, such as Public. For details, see Group Types.
    From_Account String The UserID of the message sender.
    Operator_Account String The UserID of the message initiator, based on which the system can identify whether the request is initiated by the admin.
    Random Integer A 32-bit random number in the message sending request.
    MsgSeq Integer The message sequence number, which is the unique UserID of a message.
    MsgTime Integer The message sending timestamp corresponding to the backend server time.
    MsgBody Array The message body. For details, see Message Format Description.

    Response packet example

    After data synchronization, the app backend sends a callback response packet.

        "ActionStatus": "OK",
        "ErrorInfo": "",
        "ErrorCode": 0 // The result in the response is ignored.

    Response packet fields

    Field Type Attribute Description
    ActionStatus String Required The request processing result. OK: succeeded. FAIL: failed.
    ErrorCode Integer Required The error code. 0: ignore the result in the response.
    ErrorInfo String Required Error information.