> 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/impact-brand/docs/api-webhooks) 或在 Advocate 平台中完成。本文将说明如何通过 Advocate 平台管理 webhook。

#### 创建 webhook 订阅

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

#### 排查 webhook 日志问题

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

**访问你的 webhook 日志**

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

<details>

<summary>Filter reference</summary>

| 筛选  | 说明                                                                                                                            |
| --- | ----------------------------------------------------------------------------------------------------------------------------- |
| 类型  | 按 webhook 进行筛选 [事件类型](https://integrations.impact.com/impact-brand/docs/api-webhooks#section-webhook-events)。此筛选器默认值为 *全部类型*. |
| 时间段 | 按 webhook 最后更新的时间段进行筛选。此筛选器默认值为 *所有时间*.                                                                                       |

</details>

**查看 webhook 详情**

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

<details>

<summary>事件引用</summary>

| 筛选         | 说明                                                                                                       |
| ---------- | -------------------------------------------------------------------------------------------------------- |
| 类型         | 该 webhook [事件类型](https://integrations.impact.com/impact-brand/docs/api-webhooks#section-webhook-events). |
| Webhook ID | 该 webhook 的唯一标识符。                                                                                        |
| 创建日期       | 创建该 webhook 的日期。                                                                                         |
| 事件数据       | 该 webhook [负载](https://integrations.impact.com/impact-brand/docs/api-webhooks#section-payloads).         |
| 订阅         | 该 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.
