# Slack

## Sending messages using incoming webhooks

Incoming webhooks are a way to post messages from **Widgelix** into **Slack**. Creating an incoming webhook gives you a unique URL to which you send your notifications. You can use all the usual [formatting](https://api.slack.com/reference/surfaces/formatting) to make the messages stand out.

The setup is straightforward - you create a Slack App and then use it to generate a unique webhook URL. Follow the steps in this article to obtain the URL for **Slack** notifications.

### Create a Slack app (if you don't have one already)  <a href="#create-app" id="create-app"></a>

[Create your Slack app](https://api.slack.com/apps/new)

Pick a name, choose a workspace to associate your app with (bear in mind you'll probably be posting lots of test messages, so you may want to create a channel for sandbox use), then click **Create New App** and choose **from scratch**. If you've already created an app, you can use that one.

<figure><img src="https://2494440469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggsr9Xlsze5cwVr4WMof%2Fuploads%2FOs6IwLp9HugnMvAxB2y0%2Fimage.png?alt=media&#x26;token=784e2097-2e0f-4104-b3d5-78f26155e683" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2494440469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggsr9Xlsze5cwVr4WMof%2Fuploads%2FsPxFxlGd9Q8TxJM1njvg%2Fimage.png?alt=media&#x26;token=b9d6bddf-e5cd-41bf-97ec-9f4b42ff551f" alt=""><figcaption></figcaption></figure>

### Enable incoming webhooks  <a href="#enable_webhooks" id="enable_webhooks"></a>

You'll be redirected to the settings page for your new app (if you're using an existing app, you can load its settings via your [app's management dashboard](https://api.slack.com/apps)).

From here, select **Incoming Webhooks**, and toggle **Activate Incoming Webhooks** to on.

### Create an incoming webhook  <a href="#create_a_webhook" id="create_a_webhook"></a>

Now that incoming webhooks are enabled, the settings page should refresh and some additional options will appear. One of those options is a very helpful button called **Add New Webhook to Workspace** — click it!

What this button does is trigger a shortcut version of the installation flow for Slack apps, one that is completely self-contained so that you don't have to actually build any code to generate an incoming webhook URL. You'll see something like the following:

<figure><img src="https://2494440469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggsr9Xlsze5cwVr4WMof%2Fuploads%2FJan34FQ3u8HSIERmUXyT%2Fimage.png?alt=media&#x26;token=bff39dea-a775-446c-ae22-ca6269a977d6" alt=""><figcaption></figcaption></figure>

Go ahead and pick a channel that the app will post to, then select **Authorize**. If you need to add the incoming webhook to a private channel, you must first be in that channel.

You'll be sent back to your app settings, where you should see a new entry under the **Webhook URLs for Your Workspace** section. Your webhook URL will look something like this:

```http
https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
```

That URL is your new incoming webhook, one that's specific to a single user and a single channel.

Let's see how you can actually use that webhook to post a message.

<mark style="color:orange;">**Keep it secret, keep it safe**</mark><mark style="color:orange;">. Your webhook URL contains a secret. Don't share it online, including via public version control repositories.</mark> <mark style="color:orange;"></mark><mark style="color:orange;">**Slack actively searches out and revokes leaked secrets.**</mark>

### Using webhook URL in you Widgelix's Rule

Go to your created rule, and paste your Slack Webhook URL into URL field of Slack notification option:

<figure><img src="https://2494440469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggsr9Xlsze5cwVr4WMof%2Fuploads%2FpFQuYVODZv4y6QznvrWC%2Fimage.png?alt=media&#x26;token=ac074113-5fc0-4937-9b0d-1df580ec6495" alt=""><figcaption></figcaption></figure>


---

# 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://docs.widgelix.com/notifications/types/slack.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.
