# WebHooks

## What is a Webhook?

A feature that lets you **receive real-time notifications** when tasks are completed or specific events occur in web apps. When you integrate Listly with enterprise messaging apps like Slack, you can receive real-time notifications when data extraction completes.

***

## How to use it

### Integrating Slack Webhook

{% hint style="info" %}
**Quick start**

➡️ Add Incoming Message app to Slack ➡️ Add webhook to Listly task ➡️ Receive notifications in desired Slack channel via data re-extraction or scheduler
{% endhint %}

{% stepper %}
{% step %}
**Log in to Slack, then click on the following link.**

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

{% step %}
**Add it to Slack.**

<figure><img src="https://3090065457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgoHfMCeMlqJPW61OR5d1%2Fuploads%2Fai6mrDrpiHZZDktzz8UD%2Fwebhook.png?alt=media&#x26;token=10b19123-580b-4a51-a7da-91741d8d3688" alt=""><figcaption></figcaption></figure>

After clicking <mark style="color:red;">**`Add to Slack`**</mark> , select which channel to receive notifications in. At this step you can also add a new channel for notifications and set the name of the bot that sends extraction result messages. Copy the <mark style="color:red;">**`Webhook URL`**</mark> needed for Listly service integration, then click save settings.

<figure><img src="https://content.gitbook.com/content/goHfMCeMlqJPW61OR5d1/blobs/KRBErwTAUcIqcqYYLbJI/Untitled%202.png" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
In Listly [Databoard](https://www.listly.io/databoard), find the task you want to receive result notifications for and click the <mark style="color:red;">**`Data`**</mark> button on the right. Then click the <mark style="color:red;">**`Hook`**</mark> button on the right side of the top menu as shown below to open the webhook settings window.

<figure><img src="https://content.gitbook.com/content/goHfMCeMlqJPW61OR5d1/blobs/hZaHRkU64CCQq99EpVHd/Untitled%203.png" alt=""><figcaption></figcaption></figure>

When the webhook settings window appears, enter the Request Method and JSON values as shown below. In the URL input field, enter the <mark style="color:red;">**`Webhook URL`**</mark> you copied in the previous step.

<figure><img src="https://content.gitbook.com/content/goHfMCeMlqJPW61OR5d1/blobs/78KFQJdXOf6ii1KV0QAf/Untitled%204.png" alt=""><figcaption></figcaption></figure>

| Method | POST              |
| ------ | ----------------- |
| JSON   | See payload below |

{% 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 %}
Re-extract or use the scheduler to extract data for that task again, and you'll receive data extraction notification messages in Slack as shown below.

<figure><img src="https://content.gitbook.com/content/goHfMCeMlqJPW61OR5d1/blobs/Nu4UxJp6at6LdqwxeMVH/Untitled%205.png" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

### Other Settings

* If you're familiar with JSON format, you can add <mark style="color:red;">**`channel: #channelname`**</mark> or <mark style="color:red;">**`user: @username`**</mark> to the JSON above to change which channel/user receives notifications. Adding <mark style="color:red;">**`username: botname`**</mark> lets you change the name of the bot sending notifications.
* To learn more about Slack Incoming Webhooks, check out Slack's documentation: <https://api.slack.com/legacy/custom-integrations/messaging/webhooks>
