Webhook Management

更新时间:
复制 MD 格式

Configure webhooks to integrate Quick Audience with first-party systems (such as CRM) or third-party systems for sending marketing messages like coupons. Supported in both Reach Marketing and Automated Marketing.

Follow these steps:

  1. Develop a webhook integration for your first-party or third-party system. Webhook integration guide

  2. If a webhook parameter uses a string value passed as a constant or through an interface, configure it before creating the webhook. Manage parameters

  3. Create a webhook to connect to a first-party or third-party system. Create a webhook

  4. Test the webhook to verify message delivery. Test sending

  5. Grant non-administrator members permission to use the webhook. Grant permissions

  6. Create a webhook task in Reach Marketing or configure a webhook component in Automated Marketing to send messages via the integrated system. Create a webhook task and Data configuration - Webhook component.

Create a webhook

Follow these steps:

  1. In the left-side navigation pane, choose Workspace > Configuration Management > Marketing Configuration > Webhook Management.image

  2. In the upper-right corner, click Create Webhook.

  3. In the dialog box, configure the following parameters:

    imageimage

    Parameter

    Description

    Webhook Name

    Enter a name for the webhook.

    Authentication Method

    Select an authentication method:

    • None: No authentication.

    • Key: Authenticates using a key. Enter the key below.

    Request URL

    Enter the endpoint URL (HTTP or HTTPS) that receives messages.

    HTTPS recommended.

    Send ID Type

    Select the allowed ID types. You can select multiple types, but each task uses only one.

    Select from enabled types in ID Type Management.

    Webhook Parameter

    Define parameters whose values are set per task. For example, in "A discount event is happening at {address}", {address} is specified when creating the task.

    • Parameter Name

    • Display Name: The name of the parameter that appears on the marketing task creation page.

    • Parameter Type: The data type of the parameter. Supported types are String, Numeric, Text, Date, and String (parameter call).

      • For String (parameter call), select the constant or interface the parameter uses. Configure it in advance under Manage parameters.

    • Required: Whether the parameter is required.

    Click Add Template Parameter to add a parameter.

    Enable Environment Parameter Passing

    Passes environment parameters in the request header.

    Enable receipt settings

    Enables the integrated system to report delivery receipts. Results appear on the task details page and can drive the multi-branch component in Automated Marketing.

    Configure the following settings:

    • Data retention period: Quick Audience stops accepting results after this period.

    • Status code and Status value: The status code (such as 200) and its corresponding result (such as Success) in the receipt.

      Click Add Status to add more pairs.

  4. Click Preview Message Format to view the HTTP POST request body format. Format details are in the Webhook integration guide.

  5. Click OK to complete the configuration.

Test sending

Test a webhook before using it in a marketing campaign.

Note

You can also test send when creating a marketing task. Create a webhook task and Data configuration - Webhook component.

Follow these steps:

  1. Click the 33 icon.

  2. Select the ID type, enter a test ID, and provide test values for the webhook parameters.

    Note

    Only one ID type can be tested at a time. Test the ID type required by the marketing task.

    image

  3. Click OK. The system sends a test message to the specified ID through the webhook.

    The dialog box indicates whether the test was successful.

    • Test successful: Verify that the integrated system received the request and the test ID received the message. If not, click Download Logs to troubleshoot.

    image

    • Test failed: Click Download Logs to troubleshoot.

    The latest test results also appear in the webhook list.

    image

Grant permissions

Non-administrators cannot use webhooks by default. Assign a role with the "User Marketing-Reach Marketing-Webhook" permission, then grant access to specific webhooks.

To grant permissions:

  1. Click 43 > Grant.

    image

  2. Select a Grant Method. You can grant permissions By Member or By Member Group.

    Note

    To add a member group, click the image icon in the upper-right corner and choose Workspace Management > Workspace Member Groups. These two grant methods are mutually exclusive. If you grant permissions using one method and then switch to the other, the original permissions are revoked and only the new permissions take effect.

    Authorized members or groups and their validity periods appear below.

  3. Revoke permissions: Click Remove next to a member or group. The change takes effect immediately.

  4. Grant permissions: Select one or more members or groups, set a validity period, and click OK.

Enable or disable

Webhooks are enabled by default. Disable a webhook before editing or deleting it.

Use the switch on the right to disable off or enable on the webhook.

Edit

After you disable a webhook, you can edit it.

Click the Edit button and follow the creation procedure.

Note
  • Disable the webhook before editing.

  • If receipt settings were enabled, you cannot modify or delete the configured status codes and values.

image

Copy

Click 43 > Copy. A configuration page opens with the original settings. Modify as needed and click OK.

The copy is disabled by default. Enable it before use.

Delete

Delete a disabled webhook that is not used in any marketing tasks.

Click 43 > Delete and confirm in the dialog box.

Manage parameters

Configure string-type parameters (constant or interface-based) before creating the webhook.

  • Interface-based: The value is retrieved from an interface. When creating a task, Quick Audience fetches all values from the interface for selection.

    Develop interfaces per the Webhook Interface Parameter Integration Guide.

  • Constant-based: A fixed value. Define multiple constants and select one when creating a task.

Create a parameter

  1. In the left-side navigation pane, choose Workspace > Configuration Management > Marketing Configuration > Webhook Management > Webhook Parameter Management.

    image

  2. In the upper-right corner, click Create Webhook Parameter.

  3. In the dialog box, configure the parameters. The methods differ for constant-based and interface-based parameters:

    • Interface-based:

      image

      Parameter

      Description

      Parameter Name

      Enter a name for the interface.

      Parameter Type

      Select Interface-based.

      Interface URL

      Enter the URL of the interface that passes the parameters.

      Parameter Description

      Describe the input parameters for this interface.

      Authentication Method

      Select an authentication method:

      • None: No authentication.

      • Key: Authenticates using a key. Enter the key below.

      Associate with system parameters

      Select an associated parameter:

      • No: Do not associate.

      • Yes:

        • Parameter value settings (add up to 20):

        • Parameter name: Must be in English and can contain English letters, digits, and underscores. It cannot be empty and must be no more than 32 characters long.

        • Display name: No more than 32 characters.

      • Parameter value:

        • Drop-down list options: Current logon user information, Current user's row-level permissions.

      • Associated parameter selection:

        • The drop-down list displays available system parameters.

      Associate with other parameters

      Select an associated parameter:

      • No: Do not associate.

      • Yes:

        • Parameter value settings (add up to 20):

        • Parameter name: Must be in English and can contain English letters, digits, and underscores. It cannot be empty and must be no more than 32 characters long.

        • Display name: No more than 32 characters.

      • Parameter value:

        • Drop-down list options: Associated parameter selection, Manual input.

      • Associated parameter selection

        • The drop-down list displays all parameters under Parameter Management.

        • If an interface-based parameter requires a cascading relationship, the interface must contain the relationship between the parameters.

      • Manual input: If you select this, you can manually enter multiple parameter values.

        • To pass multiple values for one parameter, enter them in a single parameter value field. Use the separator agreed upon with the third party. The receiving end will need to split the values.

    • Constant-based:

      image

      image

      Parameter

      Description

      Parameter Name

      Enter a name for the interface.

      Parameter Type

      Select Constant-based.

      Parameter Description

      Enter a description for the parameter.

      Associate with other parameters

      Select an associated parameter:

      • No: Parameter value settings (add up to 20).

        • Parameter value: Configure at least one template parameter. The parameter name must be in English, cannot be empty, and must be no more than 32 characters long.

        • Display name: No more than 32 characters.

      • Yes: Parameter value and associated parameter settings (add up to 20).

  4. Click OK to complete the configuration.

Manage parameters

The parameter list provides the following actions:

  • Details: Click to view parameter details.

  • Edit: Click to edit the parameter. The procedure is the same as creation.

  • Delete: Click and then confirm in the dialog box to delete the parameter. You can only delete parameters that are not currently in use.

Webhook integration guide

Develop your integration using the message formats and samples below.

web

HTTP endpoint server

Develop an HTTP server to receive POST requests from Quick Audience (10-second timeout). Both POST and receipt requests must include these URL parameters.

URL parameter

Meaning

Example

timestamp

UNIX timestamp in seconds

1631865523

nonce

32-character random string

2e6eceb5737b473284c930c8ef79090e

Sample request URL:

{webhook_configured_url}?timestamp=1631865523&nonce=2e6eceb5737b473284c930c8ef79090e

Header

Meaning

Description

X-QA-Hmac-Signature

Authentication signature

Used when authentication is enabled. See the authentication method below.

If authentication is not enabled, set this header to an empty string ("").

Authentication method

When authentication is enabled, enter a key during webhook configuration.

Quick Audience signs each request by applying HmacSHA256Hex to the key, `timestamp`, and `nonce` parameters, then passes the signature in the `X-QA-Hmac-Signature` header. Your service verifies requests by computing the same signature and comparing values. The same logic applies to receipt reports.

Parameter

Meaning

Example

key

The key configured for the webhook

123456789

Sample signature algorithm:

import org.apache.commons.codec.digest.HmacUtils;

public String makeSignature(String key, String timestamp, String nonce) {
    String str = generateStr(key, timestamp, nonce);
    return HmacUtils.hmacSha256Hex(key, str.replaceAll("\\s+", ""));
}

/**
 * Concatenate the strings to be signed.
 */
public static String generateStr(String key, String timestamp, String nonce) {
    String[] array = new String[]{key, timestamp, nonce};
    StringBuilder sb = new StringBuilder();
    Arrays.sort(array);/* Sort the strings */
    for (int i = 0; i < 3; i++) {
        sb.append(array[i]);
    }
    return sb.toString();
}

Webhook request

Quick Audience sends an HTTP POST with trigger information for a single user. All field values are converted to strings.

Field name

Field type

Description

user_profile

Map<String,String>

A key-value pair. The value of `target_type` indicates the ID type, which is in uppercase. For supported ID types, see the table below. The value of `target_id` indicates the specific target ID.

params

Map<String,Object>

A key-value pair. The specific key-value pairs are specified during webhook configuration. When a text type contains variables, the variable values are directly inserted into the params parameter. See the example below. You can configure this on the interface.

callback_params

Map<String,String>

These are Quick Audience request parameters. They must be returned as-is in the receipt report.

process_info

Map<String,String>

Instance information from the process flow that is unique to each user.

Sample POST body structure (for a single user; each batch typically contains 1 to 100 users):

[
    {
        "user_profile": {
            "target_type": "OPEN_ID",
            "target_id": "1917810",
            "customer_id": "The unique ID of the customer. Use this ID to report events."
        },
        "params": {
            "define_item1": "Coupon ID",
            "define_item2": "Sample coupon content. The user's address is Beijing."
        },
        "callback_params": {
            "webhook_id": "13312313",
            "send_time": "1625037472000",
            "nodeId": "Node ID",
            "instanceId": "Instance ID",
            "batchId": "The ID of the action execution batch. Can be used as an idempotency ID for the batch.",
            "actionId": "The ID of the action execution instance. Can be used as an idempotency ID for a single item.",
            "customerId": "User ID, customerId"
        },
        "process_info": {
            "processInstanceId": "New version: The journey instance ID for each user in the journey epoch.",
            "processInstanceStartTime": "New version: The start time of the journey instance for each user in the journey epoch, in UNIX timestamp format.",
            "processNodeInstanceId": "New version: The journey node instance ID (different each time).",
            "processNodeInstanceStartTime": "New version: The start time of the journey node instance for each user in the journey epoch, in UNIX timestamp format.",
            "groupName":"nodeId:nodeName:groupResult(node.result),groupName(node.resultExt);nodeId:nodeName:groupResult(node.result),groupName(node.resultExt)",
            "@comment":{
              "groupName" : "Node ID:Node name (configured on the interface):Group result (percentage of the random group, two decimal places):Group name (configured on the interface); separate multiple entries with semicolons."
            }
        }
    }
]

Supported ID types:

ID Type

Meaning

ONEID

OneID

EMAIL

Email address

MOBILE

Mobile number

TAOBAO_ID

Taobao ID

TAOBAO_NICK

Taobao nickname

IMEI

Mobile phone IMEI

IMSI

Mobile phone IMSI

IDFA

Mobile phone IDFA

MAC_ORG

MAC address

WEIBO_ID_ORG

Weibo ID

ALIPAY_ID

Alipay ID

UNION_ID

WeChat UnionID

OAID

OAID

OPEN_ID

WeChat OpenID

Your service must return a response to Quick Audience.

Response body format:

{
 "code":"OK",      //Request status code. OK indicates that the request was successful. The value must be in uppercase. Other values are custom error codes defined by the integrated party.
  "message":"",    //Description of the status code. This is not required.
}

Report receipts

After executing the task, your service reports a receipt with the delivery status.

API description

API Description

Report receipt

URL

/restapi/marketing2/webhook/receiveWebHookCallBack

Request Method

POST

Parameter Name

Data Type

Parameter Type

Required

Description

timestamp

long

Query Params

Yes

UNIX timestamp in seconds: 1631865523

nonce

String

Query Params

Yes

32-character random string: 2e6eceb5737b473284c930c8ef79090e

X-QA-Hmac-Signature

String

Headers

Yes

Required when authentication is enabled. Generate this value using the Authentication method algorithm.

If authentication is not enabled, set this header to an empty string ("").

callBackMessageList

List<WebHookCallBackMessage>

Request Body

Yes

A list that contains merged receipt information for multiple users. The format of WebHookCallBackMessage is described below.

The `WebHookCallBackMessage` structure is as follows:

Field

Type

Description

msg_id

String

A 32-character unique message ID generated by the integrated party.

status

String

The result status. This is the status code defined in the webhook configuration, such as 200.

cst_id

String

The ID of the reached user. This is user_profile.customer_id.

send_time

String

UNIX timestamp in milliseconds.

callback_params

Map<String,String>

The callback_params from the webhook request. Return them as-is.

Sample receipt report message:

[
 {
 "msg_id": "Unique ID provided by the business side",
 "status": "Receipt status",
 "cst_id": "Customer ID, customerId",
 "send_time": "Receipt sending time, in UNIX timestamp format",
 "callback_params": {
 "return_parameters_as_is": "Return the parameters from the call as-is"
   }
 }
]

API response

Field

Type

Description

code

int

Return code. 200 indicates the API request was successful.

Miscellaneous: Failed

message

String

Error message

If the return code is 200, the message is "Success".

Any other return code corresponds to an error message.

Sample request:

curl --location 'https://quicka.aliyun.com/restapi/marketing2/webhook/receiveWebHookCallBack?timestamp=1755848301481&nonce=abc' \
--header 'X-QA-Hmac-Signature: 5d41402abc4b2a76b9719d911017c592' \
--header 'Content-Type: application/json' \
--data '[]'

Sample response:

{
 "code": 200,
 "message": "Success"
}

FAQ

What is the difference between webhook parameters, variables, constants, and interfaces?

A: Webhook parameters have multiple types. The following figure shows their differences and how to use them.13546

Specifically:

  • Constants and interfaces are two methods for assigning values to string-type parameters.

  • Variables are inserted into text-type parameters, and their content is dynamic, changing for each user.