> For the complete documentation index, see [llms.txt](https://help.impact.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/advocate-program/advocate-program-settings/create-and-manage-advocate-webhook-subscriptions.md).

# 创建并管理 Advocate Webhook 订阅

Webhook 是在事件发生时执行的代码。Advocate 允许您使用 webhook 注册一个 URL；当您的程序中发生任何事件时，我们都会向该 URL 发送 POST 请求，例如当为新参与者创建专属优惠码时，会创建一个事件对象。创建和管理 webhook 有两种方法： [通过 Advocate API](https://integrations.impact.com/integration-guides/for-brands/advocate/advocate-api/api-webhooks-for-advocate-programs) 或在 Advocate 平台中。本帮助文章将说明如何通过 Advocate 平台管理 webhook。

#### 创建 webhook 订阅

1. 在顶部导航栏中，选择 ![](/files/34cff7cafbbfcd416778a35b63cb058c27bcda8b) **\[用户资料] → 设置**.
2. 在下方左侧栏中 *Advocate 设置*，选择 **Webhook**.
3. 在 *Webhook 订阅* 页面，选择 **创建订阅**.
4. 在下方 *发送到 URL*，输入应用程序用于发送有关特定事件的实时更新的唯一地址。
5. 可选地，在下方 *Webhook 名称*，输入新的 webhook 订阅名称。
6. 选择 **保存**.

#### 排查 webhook 日志问题

当您注册了一个 URL 后，Advocate 会在您的程序中发生事件时向该 URL 发送请求，您可以查看日志并排查任何失败的 webhook 事件。

**访问您的 webhook 日志**

1. 在顶部导航栏中，选择 ![](/files/34cff7cafbbfcd416778a35b63cb058c27bcda8b) **\[用户资料] → 设置**.
2. 在下方左侧栏中 *Advocate 设置*，选择 **Webhook**.
3. 在 *Webhook 订阅* 页面，选择 **查看日志**.
4. 使用下方筛选器 *Webhook 事件日志* 来筛选 webhook。
   * 请参阅 *筛选条件参考* 了解更多信息。

<details>

<summary>筛选条件参考</summary>

| 筛选器 | 说明                                                                                                                                                           |
| --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 类型  | 按 webhook 筛选 [事件类型](https://integrations.impact.com/integration-guides/for-brands/advocate/advocate-api/api-webhooks-for-advocate-programs)。此筛选器默认值为 *所有类型*. |
| 时间段 | 按 webhook 最后更新时间段筛选。此筛选器默认值为 *所有时间*.                                                                                                                         |

</details>

**查看 webhook 详情**

1. 选择一个特定的 webhook 以打开 *Webhook 详情* 视图。
2. 此视图提供可用于排查 webhook 订阅问题的信息。
   * 请参阅 *事件引用* 了解更多信息。

<details>

<summary>事件引用</summary>

| 筛选器        | 说明                                                                                                                                        |
| ---------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| 类型         | 该 webhook [事件类型](https://integrations.impact.com/integration-guides/for-brands/advocate/advocate-api/api-webhooks-for-advocate-programs). |
| Webhook ID | 该 webhook 的唯一标识符。                                                                                                                         |
| 创建日期       | 创建 webhook 的日期。                                                                                                                           |
| 事件数据       | 该 webhook [负载](https://integrations.impact.com/integration-guides/for-brands/advocate/advocate-api/api-webhooks-for-advocate-programs).   |
| 订阅         | 该 webhook 发送到的 webhook 订阅及其状态。                                                                                                            |
| 订阅详情       | 有关从 webhook 订阅端点收到的响应的详细信息。详细信息可能包括 webhook 的投递尝试情况，显示尝试的时间戳、从目标接收到的 HTTP 状态代码，以及当请求花费过长时间才从目标服务器收到响应时，该尝试是否超时。                           |

</details>

**用于失败事件投递的 webhook 重试系统**

* 在事件触发后，rest hook 会立即投递。如果端点未能成功响应一次投递尝试（即返回的状态码不是 200），则该次投递将被视为失败。
* 失败的投递会在上一次失败尝试后一小时重试一次，直到成功投递为止，或直到已进行 72 次尝试为止（按每小时重试 1 次的频率计算，大约为 3 天）。
* 持续返回错误的 webhook 端点将在达到以下错误次数后自动禁用：

  | 状态码    | 收到的错误 |
  | ------ | ----- |
  | 4xx 错误 | 1000  |
  | 5xx 错误 | 2000  |
  | 3xx 错误 | 2000  |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/advocate-program/advocate-program-settings/create-and-manage-advocate-webhook-subscriptions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
