# 网络回调 (WebHooks)

## 什么是 Webhook？

Webhook 是一项功能，可让您在任务完成或 Web 应用程序中发生特定事件时**接收实时通知**。将 Listly 与 Slack 等企业消息应用程序集成后，您可以在数据提取完成时接收实时通知。

***

## 使用方法

### 集成 Slack Webhook

{% hint style="info" %}
**快速入门**

➡️ 将 Incoming Message 应用添加到 Slack ➡️ 将 webhook 添加到 Listly 任务 ➡️ 通过重新提取或调度器在所需的 Slack 频道接收通知
{% endhint %}

{% stepper %}
{% step %}
**登录 Slack，然后点击以下链接。**

Incoming WebHooks: <https://slack.com/marketplace/A0F7XDUAZ-incoming-webhooks>
{% endstep %}

{% step %}
**添加到 Slack。**

<figure><img src="/files/7714f96f2eca42e2f696aa059585adb7d2d283c9" alt=""><figcaption></figcaption></figure>

点击 <mark style="color:red;">**`Add to Slack`**</mark> 后，选择要接收通知的频道。在此步骤中，您还可以添加新频道用于通知，并设置发送提取结果消息的机器人名称。复制 Listly 服务集成所需的 <mark style="color:red;">**`Webhook URL`**</mark>，然后点击保存设置。

<figure><img src="/files/b934f9eda2f5b9d94381d59ce7e3bd846ead7292" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
在 Listly [Databoard](https://help.listly.io/docs/zh-hans/~/revisions/XlbE0aYnL6PhLXBPBU8n/getting-started/databoard-features) 中，找到要接收结果通知的任务，点击右侧的 <mark style="color:red;">**`Data`**</mark> 按钮。然后如下图所示，点击顶部菜单右侧的 <mark style="color:red;">**`Hook`**</mark> 按钮，打开 webhook 设置窗口。

<figure><img src="/files/07c9f24e014adddf5b1f59c3aef8e7f1dbc243ec" alt=""><figcaption></figcaption></figure>

当 webhook 设置窗口出现时，按如下所示输入请求方法和 JSON 值。在 URL 输入字段中，输入您在上一步复制的 <mark style="color:red;">**`Webhook URL`**</mark>。

<figure><img src="/files/be3282f1ecd947de43d97a850c457ce5a407c855" alt=""><figcaption></figcaption></figure>

| Method | POST        |
| ------ | ----------- |
| JSON   | 见下方 payload |

{% code title="payload.json" %}

```json
{
  "text": "#taskkey is #status. <[https://www.listly.io/single?key=#taskkey&tab=4&card=30|See](https://www.listly.io/single?key=#taskkey&tab=4&card=30%7CSee) result>\nFrom Listly.",
  "icon_emoji": ":white_check_mark:"
}
```

{% endcode %}
{% endstep %}

{% step %}
使用重新提取或调度器再次提取该任务的数据，您将在 Slack 中收到如下所示的数据提取通知消息。

<figure><img src="/files/4cf7b78646736c8fc1b1eb5618b50aa6798e66b1" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

### 其他设置

* 如果您熟悉 JSON 格式，可以在上述 JSON 中添加 <mark style="color:red;">**`channel: #channelname`**</mark> 或 <mark style="color:red;">**`user: @username`**</mark> 来更改接收通知的频道/用户。添加 <mark style="color:red;">**`username: botname`**</mark> 可以更改发送通知的机器人名称。
* 要了解更多关于 Slack Incoming Webhooks 的信息，请查看 Slack 文档：<https://api.slack.com/legacy/custom-integrations/messaging/webhooks>


---

# Agent Instructions: 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:

```
GET https://help.listly.io/docs/zh-hans/getting-started/result-page-features/webhooks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
