> 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. 在顶部导航栏中，选择 ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2F210dEQa93qyQgoJDkieL%2FUser%20profile.svg?alt=media\&token=f84c5b17-fae4-4a30-990a-9de5e57a150b) **\[用户资料] → 设置**.
2. 在下面左侧栏中 *Advocate 设置*，选择 **Webhook**.
3. 在 *Webhook 订阅* 页面，选择 **创建订阅**.
4. 在下方 *发送到 URL*，输入应用程序用于发送特定事件实时更新的唯一地址。
5. 可选地，在下面 *Webhook 名称*，输入新的 webhook 订阅名称。
6. 选择 **保存**.

#### 排查 webhook 日志问题

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

**访问你的 webhook 日志**

1. 在顶部导航栏中，选择 ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2F210dEQa93qyQgoJDkieL%2FUser%20profile.svg?alt=media\&token=f84c5b17-fae4-4a30-990a-9de5e57a150b) **\[用户资料] → 设置**.
2. 在下面左侧栏中 *Advocate 设置*，选择 **Webhook**.
3. 在 *Webhook 订阅* 页面，选择 **查看日志**.
4. 使用下面的筛选器 *Webhook 事件日志* 来筛选 webhooks。
   * 请参阅 *筛选参考* 以了解更多信息。

<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.
