tencent cloud

Feedback

All Users / Tags / UserID Push Callback

Last updated: 2024-12-30 17:11:32

    Feature Description

    After enabling the push plugin, the push results can be forwarded to the app backend by configuring the basic callback.

    Notes

    To enable this callback, you must configure the callback URL and enable the corresponding switch for this callback. For more information on the configuration method, see the Webhooks documentation.
    During this callback, 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 additional safety-related concerns, please refer to the Third-Party Callback Overview: Security Considerations document.

    API Description

    Request URL sample:

    In the following example, the callback URL configured in the App configuration is https://www.example.com
    Example:
    https://www.example.com?SdkAppid=$SDKAppID&CallbackCommand=$CallbackCommand&contenttype=json

    Request parameters

    Field
    Description
    https
    Request protocol is HTTPS
    Request method is POST
    www.example.com
    Callback URL
    SdkAppid
    SDKAppID allocated by the Instant Messaging console at the time of Application creation
    CallbackCommand
    Fixed as: Push.AllMemberPush
    contenttype
    The request payload is fixed as JSON

    Sample request packets

    {
    "Events": [ // The length of the events array ranges from 1 to 100
    {
    "CallbackCommand":"Push.AllMemberPush",
    "EventType": 1, // Event type, EventType=1 indicates offline push
    "TaskId": "657bf434_537529d8_2000005e80aa873_2780d131_bc614e", // TaskId for all-member/Tag/single push
    "TaskTime": 1557481127, // Timestamp when the all-member push task was initiated, in seconds
    "EventTime": 1557481128, // Timestamp when the event occurred, in seconds
    "To_Account": "user2", // Recipient
    "PushPlatform": 1, // Vendor
    "PushStage": 1, // Push stage
    "ErrCode": 0, // Push event result
    "ErrInfo": "OK" // Push event result description, may be empty
    },
    {
    "CallbackCommand":"Push.AllMemberPush",
    "EventType": 2, // Event type, EventType=2 indicates online push
    "TaskId": "657bf434_537529d8_2000005e80aa873_2780d131_9", // TaskId for all-member/Tag/single push
    "TaskTime": 1557481127, // Timestamp when the all-member push task was initiated, in seconds
    "EventTime": 1557481129, // Timestamp when the event occurred, in seconds
    "To_Account": "user3", // Recipient
    "PushPlatform": 0, // Vendor
    "PushStage": 1, // Push stage
    "ErrCode": 0, // Push event result
    "ErrInfo": "OK" // Push event result description, may be empty
    },
    ....
    ]
    }

    Request packet fields

    Field
    Type
    Description
    Events
    Array [ Event Object ]
    Batch callback content, containing data for up to 100 callback events (Event Object)
    Event Object Structure
    Field
    Type
    Description
    CallbackCommand
    String
    Callback command
    EventType
    Integer
    Event Type:
    EventType = 1 indicates offline push
    EventType = 2 indicates online push
    TaskId
    String
    Task ID returned when the all-member push is sent
    TaskTime
    Integer
    Timestamp when the all-member push task was initiated, in seconds
    EventTime
    Integer
    Timestamp when the event occurred, in seconds
    To_Account
    String
    Recipient's UserID
    PushPlatform
    Integer
    Push vendor (for online push EventType = 2, vendor is not distinguished, default is 0):
    PushPlatform = 0 indicates unknown vendor
    PushPlatform = 1 indicates Apple APNS push
    PushPlatform = 2 indicates Xiaomi push
    PushPlatform = 3 indicates Huawei push
    PushPlatform = 4 indicates Google FCM push
    PushPlatform = 5 indicates Meizu push
    PushPlatform = 6 indicates OPPO push
    PushPlatform = 7 indicates vivo push
    PushPlatform = 8 indicates Honor push
    PushStage
    Integer
    Push stage:
    PushStage = 1 indicates push sent
    PushStage = 2 indicates push reached
    PushStage = 3 indicates push clicked
    ErrCode
    Integer
    Push event result:
    ErrCode = 0 indicates success
    ErrCode non-zero indicates failure
    ErrInfo
    String
    Push event result description, may be empty

    Response packet example

    {
    "ActionStatus": "OK",
    "ErrorInfo": "",
    "ErrorCode": 0 // 0 means callback success, 1 means callback error
    }

    Response packet field description

    Field
    Type
    Description
    ActionStatus
    String
    Processed Request Result:
    OK Signifies Successful Handling
    FAILURE signifies unsuccessful execution
    ErrorCode
    Integer
    Error Code
    ErrorInfo
    String
    Error Description
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support