> For the complete documentation index, see [llms.txt](https://docs.nexthink.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nexthink.com/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/outbound-connectors/webhooks/webhook-use-cases-setup/sending-data-to-a-slack-channel.md).

# Sending data to a Slack channel

{% hint style="warning" %}
This documentation references external sources.

Nexthink does not control the accuracy of third-party documentation or external updates that can result in inconsistencies.

Report any errors or inconsistencies to [Nexthink Support](https://support.nexthink.com/).
{% endhint %}

This document demonstrates how to send data to a Slack channel, using Nexthink webhook capability, to stand out from other messages in the channel.

## In Slack <a href="#sendingdatatoaslackchannel-inslack" id="sendingdatatoaslackchannel-inslack"></a>

1. [Create a new Slack app](https://api.slack.com/apps?new_app=1) in the workspace where you want to post messages.
2. From the **Features** page, toggle **Activate Incoming Webhooks** on.

<figure><img src="https://268444917-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJSUDk9NTtCHYPG5EWs3%2Fuploads%2Fgit-blob-b2d3f4b6166dac900e27630cb006451a027bb2f7%2Fnxwh-1642167674.png?alt=media" alt="Activating incoming webhooks in Slack"><figcaption></figcaption></figure>

3. Click **Add New Webhook to Workspace**.

<figure><img src="https://268444917-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJSUDk9NTtCHYPG5EWs3%2Fuploads%2Fgit-blob-113f1bcf5098c695190d5f78df0082aed71fa949%2Fnxwh-1642167810.png?alt=media" alt="Adding new webhook to workspace" width="544"><figcaption></figcaption></figure>

4. Pick a channel that the app will post to, then click **Authorize**.

<figure><img src="https://268444917-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJSUDk9NTtCHYPG5EWs3%2Fuploads%2Fgit-blob-9758753a88d0c6e7fbfee9f6ecf3292418a5b093%2Fnxwh-1642168136.png?alt=media" alt="Authorization" width="442"><figcaption></figcaption></figure>

5. Copy the generated [Incoming Webhook URL](https://api.slack.com/messaging/webhooks#posting_with_webhooks) for future reference. That is, for the [connector credential](#configuring-a-connector-credential-for-the-servicenow-incident-creation) and [webhook configuration](#configuring-a-webhook-for-servicenow-incident-creation) in the Nexthink web interface.\
   **Webhook URL** example: `https://hooks.slack.com/services/T00000000/BXXXXXXXXXX/PLVXXXXXXXXXXXXXXXXXXXXX`

<figure><img src="https://268444917-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJSUDk9NTtCHYPG5EWs3%2Fuploads%2Fgit-blob-e54e53d424b3f0e0843ba2dfd9c3bad18b59817a%2Fnxwh-1642168271.png?alt=media" alt="Webhook URL" width="544"><figcaption></figcaption></figure>

## In Nexthink <a href="#sendingdatatoaslackchannel-innexthink" id="sendingdatatoaslackchannel-innexthink"></a>

From the Nexthink web interface:

* [Configure a connector credential for the webhook](#postingamessageinzoom-configuringaconnectorcredentialforzoomcredentialzoomtrue)
* [Configure and test the webhook to post messages in Slack](#postingamessagetoanmsteamschannel-configuringawebhookformschannel)

### Configuring a connector credential for Slack <a href="#postingamessageinzoom-configuringaconnectorcredentialforzoomcredentialzoomtrue" id="postingamessageinzoom-configuringaconnectorcredentialforzoomcredentialzoomtrue"></a>

From the [connector credential](/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/outbound-connectors/connector-credentials.md) configuration page, fill out the fields using the information from the connection you created in Slack.

1. Choose the **HTTPS** option from the **Protocol** drop-down.
2. Paste the root `https://hooks.slack.com/` into the **URL address** field from [Webhook URL](#sendingdatatoaslackchannel-inslack) from Slack configuration.
3. Choose **Basic** option from the **Authorization** drop-down.
4. Type in `Test` in the fields **Username** and **Password**, as these fields are not required when configuring Incoming Webhooks for Slack.
5. **Save** the credential.

### Configuring a webhook for Slack channel <a href="#postingamessagetoanmsteamschannel-configuringawebhookformschannel" id="postingamessagetoanmsteamschannel-configuringawebhookformschannel"></a>

From the [webhook configuration page](/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/outbound-connectors/webhooks/managing-webhooks.md), fill out the fields using the information from the connection you created in Slack and the connector credential defined in Nexthink:

1. Fill in the **NQL Condition** following the [Configuring webhook NQL conditions](/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/outbound-connectors/webhooks/managing-webhooks/configuring-webhook-nql-conditions.md) documentation.

   * After filling in the NQL Condition, the system lists the [allowed placeholders](/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/outbound-connectors/webhooks/managing-webhooks/configuring-webhook-fields_-method-resource-and-payload.md#configuringwebhookfields-method-resource-andpayload-usingdatamodelvariablesasplaceholdersinthepayloa) for the **Payload**.

   ```
   alert.alerts
   | where monitor.tags contains "web-applications"
   | where alert.context contains "*Salesforce*" or alert.context contains "*Microsoft*"
   | list alert.monitor.name, alert.status, monitor.tags, alert.context, trigger_time, recovery_time, alert.monitor.thresholds, monitor.priority, alert.trigger_values, alert.trigger_reference_value, alert.recovery_values, alert.context, device_view_link, issue_view_link, device.name
   ```
2. Choose the configured [connector credential](#postingamessageinzoom-configuringaconnectorcredentialforzoomcredentialzoomtrue) for Slack from the **Credentials** drop-down.
3. Select the **POST** from the **Method** drop-down.
4. Paste into the **Resources** field, the URL endpoint from the [Slack configuration](#sendingdatatoaslackchannel-inslack) without the root URL address. For example:\
   `services/T00000000/BXXXXXXXXXX/PLVXXXXXXXXXXXXXXXXXXXXX`
5. Add the message you want to send in **Payload**. See the example below.\
   alert.alerts

   ```
   {
     "text": "There is an alert {{alert.monitor.name}} that is affecting the digital experience"
   }
   ```
6. **Send Test** to make sure the message is pushed into Slack.

{% hint style="info" %}
Refer to the [Slack API ](https://api.slack.com/reference/surfaces/formatting#rich-layouts)documentation for more information about supported payloads.
{% endhint %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.nexthink.com/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/outbound-connectors/webhooks/webhook-use-cases-setup/sending-data-to-a-slack-channel.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
