tencent cloud

Feedback

Before a Official Account Is Created

Last updated: 2024-06-18 16:08:19

    Feature Overview

    The app backend can use this webhook to view requests for creating official accounts in real time, including the ability to reject these requests.

    Notes

    To enable the webhook, you must configure the webhook URL and enable corresponding switch for this webhook protocol. more information on the configuration method, see Webhook Configuration.
    During this webhook, the Chat backend initiates an HTTP POST request to the app backend.
    After receiving the webhook request, the app backend must check whether the SDKAppID contained in the request URL is the SDKAppID of the app.
    For additional safety-related concerns, please refer to the Webhook Overview: Security Considerations document.

    Webhook Triggering Scenarios

    The app administrator creates a Official Account via the REST API.

    Webhook Triggering Timing

    Chat backend is preparing to create a Official Account.

    API Calling Description

    Sample request URL

    In the subsequent example, the webhook URL configured within the app is https://www.example.com. Example:
    https://www.example.com?SdkAppid=$SDKAppID&CallbackCommand=$CallbackCommand&contenttype=json&ClientIP=$ClientIP&OptPlatform=$OptPlatform

    Request parameters

    Parameter
    Description
    https
    The request protocol is HTTPS, and the request method is POST.
    www.example.com
    Callback URL.
    SdkAppid
    SDKAppID assigned by the Chat console when an app is created.
    CallbackCommand
    Fixed to: OfficialAccount.CallbackBeforeCreateOfficialAccount.
    contenttype
    Fixed value: JSON.
    ClientIP
    Client IP, such as: 127.0.0.1.
    OptPlatform
    Client Platform, for values please refer to Webhook Overview: Callback Protocol for the meaning of the OptPlatform parameter.

    Sample request

    {
    "CallbackCommand": "OfficialAccount.CallbackBeforeCreateOfficialAccount", // Callback command
    "Operator_Account": "107867", // Operator
    "Owner_Account": "107867", // Creator
    "Name": "TestOfficialAccount", // Name of the official account
    "EventTime": 1670574414123// Event trigger timestamp in milliseconds
    }

    Request fields

    Object
    Features
    Feature
    CallbackCommand
    String
    Webhook command.
    Operator_Account
    String
    UserID of the operator who initiates the create request.
    Owner_Account
    String
    The creator of the official account, who is also the owner of the official account.
    Name
    String
    Name of the official account to be created.
    EventTime
    Integer
    Event trigger timestamp in milliseconds.

    Sample response

    Allows creation

    Allows users to create official accounts.
    {
    "ActionStatus": "OK",
    "ErrorInfo": "",
    "ErrorCode": 0 // Allows creation
    }

    Prohibit Creation

    Users are not allowed to create official accounts. The official account will not be created, and the error code 20006 will be returned to the caller.
    {
    "ActionStatus": "OK",
    "ErrorInfo": "",
    "ErrorCode": 1 // Denied Creation
    }

    Response fields

    Field
    Type
    Attribute
    Description
    ActionStatus
    String
    Mandatory
    Processed Request Result:
    OK: Indicates successful processing
    FAIL: Indicates failure
    ErrorCode
    Integer
    Mandatory
    Error Code, 0 allows creation; 1 denies creation. If the service wishes to use its own error code to deny user group creation, pass the error code ErrorCode and ErrorInfo to the client. Please set the ErrorCode within the range [120001, 130000].
    ErrorInfo
    String
    Mandatory
    Error message.

    References

    
    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