> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hightouch.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Slack

> Sync your warehouse with Slack and push business metrics and user activity data to Slack in real-time

## Overview

With the Slack destination, Hightouch can serve as a notifier for various data-related events or changes.
This is a very flexible integration that you can use for many different use cases, such as:

* notifying your Customer Success teams when product usage for a key account suddenly drops
* notifying an Account Executive when product usage surpasses a certain threshold
* sending a daily summary of the number of sign-ups compared to the same day in the previous month
* sending a daily summary on the adoption of a core feature

## Supported syncing

| Sync type | Description |
| :- | :- |
| **Message** | Sends individual messages for each row that was added, changed, or removed since the last sync. There will be no messages for the initial run. |
| **Batch Message** | Sends a formatted message (or multiple messages) of all the rows in the query results. |
| **Table** | Sends a formatted table of all rows in the query results as a single message. |
| **CSV** | Sends a CSV file of all rows in the query results attached to a single message. |

> [!NOTE]
>
> The order of rows and columns in messages may differ from how they appear in your model. This is expected behavior and applies to all sync modes. [Learn more about row and column ordering](https://docs.hightouch.com/models/creating-models.md#row-and-column-ordering).

### Slack error alerting

To learn more about setting up Slack as your error alerting tool, see the [Alerting](https://docs.hightouch.com/syncs/alerting.md) page.

## Connect to Slack

### Authenticating with OAuth

Use OAuth to connect Slack by navigating to **Destinations** > **Create New** > **Slack**.
Click **Connect** and log in with your desired Slack account.
Once you have selected your desired workspace, click **Allow** and you will see an **Authorization successful** screen in Hightouch.
Finish your setup by clicking the continue button and naming your destination.

### Adding the Hightouch bot to a channel

In order for Hightouch to message your channel, you need to ensure the Hightouch bot is added as an integration.
Follow the steps below to add the bot to your channel.

> [!TIP]
>
> You can add the Hightouch bot both to public and private Slack channels.

Adding the Hightouch bot can be done by typing `/invite @hightouch` in the Slack composer. If that doesn't work you can also add the Hightouch bot by following these steps:

1. Go to your channel and click the dropdown button (**∨**) next to the channel name.

   ![Adding Hightouch bot to channel - step 1](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-slack-channel.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=ea568b38cbf2451f4e49549486730cfa)

2. Click **Integrations** > **Add an App**.

   ![Adding Hightouch bot to channel - step 2](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-slack-channel-integrations.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=692743b386e81ebd8bb23ba8281e77b5)

3. Search for **Hightouch** and click **Add** next to the Hightouch app name.

   ![Adding Hightouch bot to channel - step 3](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-slack-channel-add-hightouch.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=2574eeb0c83a4e42d729d38a42fd29d2)

4. The Hightouch bot should now appear in the channel settings.

   ![Adding Hightouch bot to channel - step 4](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-slack-channel-bot-added.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=bd6faea0318a98836dff5dd88e7a3b16)

## Sync configuration

Once you've set up your Slack destination and have a [model](https://docs.hightouch.com/getting-started/concepts.md#models) to pull data from, you can set up your sync configuration to begin syncing data.
Go to the [**Syncs** overview page](https://app.hightouch.com/syncs?from=docs) and click the **Add sync** button to begin.
Then, select the relevant model and the Slack destination you want to sync to.

### Syncing messages

Hightouch supports sending messages based on rows that have been [added, changed, or removed](https://docs.hightouch.com/getting-started/concepts.md#change-data-capture-cdc) since the last sync run.

&#x20;

\[!TIP] This is only applicable when using the **Message** sync type
Each row is sent as an individual message and can be [templated with Liquid](#templating-messages).
You can also send messages to [different Slack channels](#channel-selection).

> [!TIP]
>
> Hightouch doesn't send any messages on the initial sync run to prevent a flood of messages to your channel. Messages start appearing **after** the initial sync run. The same behavior applies to [full resyncs](https://docs.hightouch.com/syncs/overview.md#resync-full-query) as well.
>
> If you want avoid this behavior, modify your model query to return only one "test" row. Hightouch processes this row during the first sync run and doesn't send it as a message to Slack. Afterward, update your model query to include all rows from your source. Hightouch syncs all subsequent rows to Slack during the second sync run.

#### Channel selection

After adding the Hightouch bot to a Slack channel, you can select it from this dropdown menu or enter a channel ID manually.
You can also enable the **Use column** toggle to select a model column instead of a Slack channel name.
The model column selected in the dropdown menu must contain the correct Slack channel ID for every row in your model.
This also allows you to dynamically set the target channel, by inserting different Slack channel IDs for different rows in your model.

![Slack channel selection](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-slack-channel-selection.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=d1ab4b420b487cbc0b56f81269ce74c1)

#### Private channels

Private channels are hidden from the dropdown. To send to a private channel you can manually enter the channel ID.

> [!NOTE]
>
> Check out the [Common
> errors](#slack-channel-not-appearing-in-sync-configuration) section if you
> don't see your Slack channel in this menu.

#### Added, changed, and removed messages

Hightouch allows you to send different messages based on the row type:

* when a row is **added** to your query results, Hightouch will send the *row added* content.
* when a row is **changed** in your query results, Hightouch will send the *row changed* content.
* when a row is **deleted** from your query results, Hightouch will send the *row deleted* content.

This content can be [templated](#liquid-templating) and also supports the [Slack Block Kit](#slack-block-kit).

![Message sync mode](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-slack-message-content.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=5eb3f405d0108f18f92e8e6a91d1676a)

> [!NOTE]
>
> Check out the [Common errors](#parseerror-unexpected-token) section if your
> column name contains spaces.

### Syncing batch messages

The batch message sync mode is similar to the normal [message](#syncing-messages) mode, except it sends all rows in the query result rather than only [added, changed, or removed rows](https://docs.hightouch.com/getting-started/concepts.md#change-data-capture-cdc).
This sync mode is ideal if you want to write a template and have Hightouch push a message containing **all** rows to Slack, formatted as a single message.

This mode also allows you to specify how many rows are sent per message, which can range from 1 to 50.
With 1 row per message, it behaves similar to the [message](#syncing-messages) sync mode since it creates multiple messages in Slack.
Whereas 50 rows per message is similar to the [table](#syncing-tables) sync mode.

#### Channel selection

The batch message sync mode only supports sending your messages to a single channel, unlike the [message](#channel-selection) mode.

![Slack channel selection](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-slack-channel-selection-1.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=3d1466d61253900967dadea1b2230875)

#### Private channels

Private channels are hidden from the dropdown. To send to a private channel you can manually enter the channel ID.

#### Header, body, and footer content

For each message, Hightouch allows setting the header, body, and footer content.
The header and footer are optional, whereas the message body is required.
The body is repeated for every row in your model.

This content can be [templated](#liquid-templating) and also supports the [Slack Block Kit](#slack-block-kit).

![Batch message sync mode](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-slack-batch-message-content.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=9ed0be7756f12aa375da49299cc2921b)

> [!NOTE]
>
> Check out the [Common errors](#parseerror-unexpected-token) section if your
> column name contains spaces.

### Syncing tables

The table sync mode is similar to the [batch message](#syncing-batch-messages) mode.
It sends all of your query results as a table-formatted message to Slack.
This mode is only recommended for small datasets.

### Syncing CSV files

The CSV sync mode is similar to the [batch message](#syncing-batch-messages) and [table](#syncing-tables) modes.
It sends all of your query results as a CSV file attached to a Slack message.

### Templating messages

[Liquid templating](https://docs.hightouch.com/syncs/mapping-data.md#liquid-reference) is supported for the [message](#syncing-messages) and [batch message](#syncing-batch-messages) sync modes.
This allows you to include model columns as part of the message body to insert dynamic values in your Slack messages.
Here is an example message making use of Liquid to include model columns in a message:

```text theme={null}
User with name {{ row['first name'] }} and email {{ email }} has signed up
```

Check out our [Extended Liquid use cases](https://docs.hightouch.com/syncs/mapping-data.md#extended-liquid-use-cases) section to learn how to format [dates](https://docs.hightouch.com/syncs/mapping-data.md#date-function), [strings](https://docs.hightouch.com/syncs/mapping-data.md#string-functions) or [currency amounts](https://docs.hightouch.com/syncs/mapping-data.md#currency-amounts).

#### Tagging Slack users (@...)

Hightouch supports tagging users by either their **Slack User ID** or by email:

* **Tagging by User ID:** tag by user ID by writing `<@{{ userId }}>` where `userId` is the column that contains the user's Slack ID. If the `userId` is a static value, you can write something like `<@UL53466SY>`.
* **Tagging by Email:** tag by email by writing `<@{{ email | slack_user_lookup }}>` where email is the column that contains the user's email used in Slack. If the email is a static value, you can write something like `<@{{ "example@gmail.com" | slack_user_lookup }}>`.

#### Inserting URLs

You can insert URLs by highlighting a section of your template and pasting the URL.

Otherwise, you can build URLs directly by following this format: `<URL link|URL text>`.
For example, a URL that points to a Salesforce organization's page could look like this: `<https://www.salesforce.com/organization/{{ org_id }}/view|Salesforce Organization>`

We recommend using the second method when building dynamic URLs with [liquid templating](#templating-messages).

#### Unfurling links and blocking unfurl

By default, Slack automatically unfurls (displays a preview of) URL links in your messages.
To prevent automatic unfurling, surround the URL with backticks (`` ` ``), for example:

`` `https://www.hightouch.com/` ``

> [!NOTE]
>
> The [backtick](https://en.wikipedia.org/wiki/Backtick) is usually located
> above the tab key on the left-hand side of the keyboard.

> [!WARNING]
>
> Blocking URL unfurling isn't possible when using the [Slack Block
> Kit](#slack-block-kit). Please&#x20;
>
> [reach out](#pylon-chat)
>
> &#x20;
>
> if you would like to request this feature.

#### Formatting text for app for Slack surfaces

Slack provides an [extensive guide](https://api.slack.com/reference/surfaces/formatting) to formatting surfaces in the app for Slack with instructions on how to:

* format text
* insert emojis
* mention users and channels
* format dates, quotes, and lists

### Slack Block Kit

To enable the Slack Block Kit, select **Slack Block Kit** for the content type.
Make sure to use [Slack's Block Kit Builder](https://app.slack.com/block-kit-builder) to draft your message content.

![Slack Block Kit selection](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-slack-block-kit-1.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=d3ac20f8d95dd8dd84650bacfcb67850)

Each message content must be an array of Slack blocks, here is an example of a valid configuration.

![Slack Block Kit template](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-slack-block-kit-2.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=d5608d34bfd349770c8c1edcbac2379a)

The **Test Block Kit** button under the message content allows you to view your templates as a Slack message ([view an example](https://app.slack.com/block-kit-builder/T0215BZEKB2#%7B%22blocks%22:%5B%7B%22type%22:%22section%22,%22text%22:%7B%22type%22:%22mrkdwn%22,%22text%22:%22hello!%22%7D%7D,%7B%22type%22:%22section%22,%22text%22:%7B%22type%22:%22mrkdwn%22,%22text%22:%22email:%20%7B%7B%20email%20%7D%7D%22%7D%7D,%7B%22type%22:%22section%22,%22text%22:%7B%22type%22:%22mrkdwn%22,%22text%22:%22goodbye!%22%7D%7D%5D%7D)).

### Customizing bot appearance

Hightouch also allows you to customize how the Hightouch bot is displayed when sending messages to your Slack channel.
You can find these fields in your sync configuration:

| Name | Description |
| :- | :- |
| Display name | Display name of the Hightouch bot |
| Icon URL | URL of a 48x48 image that you wish to use as the bot icon |
| Emoji | Slack emoji to use instead of an icon image (for example, `:sweat_smile:`) |

Keep in mind that users in the channel will be able to see the real bot name and image by clicking on it.

![Hightouch Slack bot logo](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-slack-bot-logo.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=b2cebac52fef9b28a62378baf4a6fcb1)

## Tips and troubleshooting

To see the exact API requests and responses from each sync run, use the [live debugger](https://docs.hightouch.com/syncs/debugger.md). To get notified by Slack, PagerDuty, SMS, or email when a sync fails, set up [sync alerts](https://docs.hightouch.com/syncs/alerting.md). If you run into an issue this page doesn't cover, [contact support](#pylon-chat).

> [!NOTE]
>
> For Hightouch platform error codes related to Slack, see [Error codes: Slack](https://docs.hightouch.com/developer-tools/error-codes.md#slack).

&#x20;

## Common errors

### Slack channel not appearing in sync configuration

If your Slack channel isn't appearing in the [channel selection menu](#channel-selection), make sure that you [added the Hightouch bot](#adding-the-hightouch-bot-to-a-channel) to the channel.
If this still doesn't work, try [reauthorizing your Slack destination](#authenticating-with-oauth) in Hightouch.
As a next troubleshooting step, remove the Hightouch app for Slack from your Slack workspace by visiting the [Hightouch app page](https://hightouchexternal.slack.com/apps/A010ZEEB44R-hightouch?tab=settings\&next_id=0), opening the **Configuration** tab, and clicking **Remove App**.

![Remove Slack bot](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-slack-remove-bot.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=f900dc413c425cf61d238ee9d97a528c)

Then [set up a new Slack destination](#authenticating-with-oauth) and [add the Hightouch bot](#adding-the-hightouch-bot-to-a-channel) to your Slack channel once more.

### Invalid\_blocks

Using `"plain_text"` instead of `"mrkdwn"` in your Slack Block Kit syntax is the most common cause of this error.
You can find examples of the correct syntax to use in the [Slack Block Kit section](#slack-block-kit) of this page.

### Cannot read properties of undefined (reading 'length')

You may receive the `Cannot read properties of undefined (reading 'length')` error when syncing [batch messages](#syncing-batch-messages).
If you're using the [Slack Block Kit](#slack-block-kit) as the content type, your sync might return this error instead:
`Parsing failed with error SyntaxError: Unexpected end of JSON input`.

In either case, make sure to insert **body** content in the sync configuration.
Header and footer content is optional.

![Slack Sync configuration in Hightouch](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-slack-body-content.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=df85f933a1fcf8aad38c3e0c8589b11c)

### ParseError: unexpected token

The full error message may look like, `unexpected token at "name", line:1, col:13`. You may receive this error because a column header that is being referenced in your message contains a space. For example:

```text theme={null}
First Name: {{ first name }}
```

To resolve this error you can try the following options:

* Rename your column so that the name does not contain spaces, for example, `firstName` or `first_name`.
  An example will look like:

```text theme={null}
First Name: {{ first_name }}
```

* If you cannot change the column's name then you can use this language of [liquid templating](https://docs.hightouch.com/syncs/mapping-data.md#liquid-reference). An example will look like:

```text theme={null}
First Name: {{ row['first name'] }}
```
