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

# Slack as a data source

> Bring data from Slack to Nekt.

Slack is a team collaboration and communication platform that enables real-time messaging, file sharing, and team coordination. It organizes conversations into channels and provides tools for workplace communication, project management, and team collaboration.

<img width="200" src="https://mintcdn.com/nekt/3MFKt2g7jzqFpztO/assets/logo/logo-slack.png?fit=max&auto=format&n=3MFKt2g7jzqFpztO&q=85&s=0261f2aae72764bfbb7298397884c0c0" data-path="assets/logo/logo-slack.png" />

## Configuring Slack as a Source

In the [Sources](https://app.nekt.ai/sources) tab, click on the "Add source" button located at the top right of your screen. Then, select the Slack option from the list of connectors.

Click **Next** and you'll be prompted to add the connector configuration.

### 1. Add account access

* **Authorization**: First of all, authorize Nekt through the **Slack Authorization** button. You must be an App Manager to authorize the installation of our app into your workspace.

  <Note>
    {" "}

    You'll see the following warning when installing the app:

    `This app is not approved by Slack. Apps are reviewed to ensure a quality experience.`

    This occurs because our app is private and not yet available in the Slack marketplace.

    {" "}
  </Note>

* **Channel types**: The types of conversations the tap will attempt to extract data from. Options are `public_channel` or `private_channel`. Currently, fetching messages from DMs with a bot user is not allowed.

* **Auto join public channels**: Whether the bot user should attempt to join public channels that it has not yet joined. The bot user must be a member of the channel to be able to retrieve messages. For private channels, you have to manually add the bot to the channel. Here's the step by step:

  1. Type the command `/add` in the message input box of the channel you want to add the bot.
  2. Choose `Add apps to your channel`.
  3. Select the `Nekt Source` app.
  4. Done, you'll be able to extract messages from this channel.

  {" "}

  <Note>
    {" "}

    Repeat this process for all channels you want to get data from.{" "}
  </Note>

* **List IDs**: An array of list IDs you want to extract. If not provided, then no lists will be synced. Unfortunately, Slack doesn't provide a public API to get all lists, so you have to manually add the list IDs.
  <Note>
    To find a Slack list ID, look at the URL of the list's page in your browser. A list item's ID is generated when you right-click on the item and select "copy link" from the menu. For example, in the URL `https://your-workspace.slack.com/lists/T01G4A1C55X/F08LW24UL3C` the ID corresponds to the last part of the URL, which is `F08LW24UL3C`.
  </Note>

* **Start date**: Defines from which date we should start syncing messages.

**Advanced configs**

* **Thread lookback (days)**: The number of days to look in the past for new thread replies to existing messages.
* **Selected channels**: An array of channel IDs you want to select for extraction. This helps reduce the extraction time by only selecting channels of interest.
  <Warning>
    For private channels, the Nekt Source bot must be manually invited to each channel (see step-by-step above). If you add private channel IDs to this list but the bot is not a member, those channels will be silently skipped during extraction.
  </Warning>
* **Excluded channels**: An array of channel IDs you want to exclude from extraction. This helps reduce the extraction time by excluding channels that contain bots or flooding messages.

  {" "}

  <Note>
    {" "}

    The channel ID can be found by clicking with the right button on the channel
    name and 'View details'. The channel ID will be available at the bottom of
    the modal.{" "}
  </Note>

  <img width="500" src="https://mintcdn.com/nekt/8JThMAKlZWpJ2cLM/assets/slack-1.png?fit=max&auto=format&n=8JThMAKlZWpJ2cLM&q=85&s=2812ea7f91df5ba9ea774542019638f0" data-path="assets/slack-1.png" />

Click **Next**.

### 2. Select streams

1. The next step is letting us know which streams you want to bring. You can select entire groups of streams or only a subset of them.

2. Click **Next**.

### 3. Configure data streams

Customize how you want your data to appear in your catalog. Select a name for each table (which will contain the fetched data) and the type of sync.

* **Table name**: we suggest a name, but feel free to customize it. You have the option to add a **prefix** and make this process faster!

* **Sync Type**: you can choose between INCREMENTAL and FULL\_TABLE.
  * Incremental: every time the extraction happens, we'll get only the new data - which is good if, for example, you want to keep every record ever fetched.
  * Full table: every time the extraction happens, we'll get the current state of the data - which is good if, for example, you don't want to have deleted data in your catalog.

Once you are done configuring, click **Next**.

2. Click **Next**.

### 4. Configure data source

Describe your data source for easy identification within your organization, not exceeding 140 characters.

To define your [Trigger](https://docs.nekt.com/runs/scheduling-and-triggers), consider how often you want data to be extracted from this source. This decision usually depends on how frequently you need the new table data updated (every day, once a week, or only at specific times).

Optionally, you can determine when to execute a [full sync](https://docs.nekt.com/get-started/core-concepts/types-of-sync#additional-full-sync). This will complement the incremental data extractions, ensuring that your data is completely synchronized with your source every once in a while.

Once you are ready, click **Next** to finalize the setup.

### 5. Check your new source

You can view your new source on the [Sources](https://app.nekt.ai/sources) page. If needed, manually trigger the source extraction by clicking on the arrow button. Once executed, your data will appear in your Catalog.

<Warning>For you to be able to see it on your [Catalog](https://app.nekt.ai/catalog), you need at least one successful source run.</Warning>

# Streams and Fields

Below you'll find all available data streams from Slack and their corresponding fields:

<AccordionGroup>
  <Accordion title="Users">
    This stream contains information about the users in your Slack workspace.

    **Key Fields:**

    | Field       | Type      | Description                                                      |
    | :---------- | :-------- | :--------------------------------------------------------------- |
    | `id`        | String    | The unique identifier for the user.                              |
    | `name`      | String    | The user's display name.                                         |
    | `real_name` | String    | The user's full name.                                            |
    | `is_bot`    | Boolean   | A boolean indicating whether the user is a bot.                  |
    | `is_admin`  | Boolean   | A boolean indicating whether the user is an admin.               |
    | `updated`   | Timestamp | A timestamp indicating when the user's profile was last updated. |
  </Accordion>

  <Accordion title="Channels">
    This stream provides a list of all public and private channels in your Slack workspace.

    **Key Fields:**

    | Field        | Type      | Description                                          |
    | :----------- | :-------- | :--------------------------------------------------- |
    | `id`         | String    | The unique identifier for the channel.               |
    | `name`       | String    | The name of the channel.                             |
    | `is_private` | Boolean   | A boolean indicating whether the channel is private. |
    | `created`    | Timestamp | A timestamp indicating when the channel was created. |
    | `topic`      | Object    | An object containing the channel's topic.            |
    | `purpose`    | Object    | An object containing the channel's purpose.          |
  </Accordion>

  <Accordion title="Channel Members">
    This stream lists all members of each channel.

    **Key Fields:**

    | Field        | Type   | Description            |
    | :----------- | :----- | :--------------------- |
    | `channel_id` | String | The ID of the channel. |
    | `member_id`  | String | The ID of the member.  |
  </Accordion>

  <Accordion title="Messages">
    This stream contains all messages from the selected channels.

    **Key Fields:**

    | Field        | Type   | Description                                                               |
    | :----------- | :----- | :------------------------------------------------------------------------ |
    | `ts`         | String | The timestamp of the message, which also serves as its unique identifier. |
    | `thread_ts`  | String | The timestamp of the parent message if the message is part of a thread.   |
    | `user`       | String | The ID of the user who sent the message.                                  |
    | `text`       | String | The text of the message.                                                  |
    | `channel_id` | String | The ID of the channel where the message was posted.                       |
  </Accordion>

  <Accordion title="Threads">
    This stream contains the replies to messages, also known as threads.

    **Key Fields:**

    | Field        | Type   | Description                                         |
    | :----------- | :----- | :-------------------------------------------------- |
    | `ts`         | String | The timestamp of the reply.                         |
    | `thread_ts`  | String | The timestamp of the parent message.                |
    | `user`       | String | The ID of the user who sent the reply.              |
    | `text`       | String | The text of the reply.                              |
    | `channel_id` | String | The ID of the channel where the message was posted. |
  </Accordion>

  <Accordion title="Lists">
    This stream contains Slack list metadata. Lists are only synced when you provide `List IDs` in the connector configuration.

    **Key Fields:**

    * `id`: The unique identifier of the list.
    * `created`: Timestamp when the list was created.
    * `name`: The list name.
    * `user`: Identifier of the user who created the list.
    * `updated`: Timestamp when the list was last updated.
  </Accordion>

  <Accordion title="List Items">
    This stream contains the items (field values) inside each Slack list.

    **Key Fields:**

    * `id`: The unique identifier of the list item.
    * `list_id`: Identifier of the associated Slack list.
    * `date_created`: Timestamp when the item was created.
    * `fields`: Array with the list field keys and values.
    * `updated_timestamp`: Timestamp when the item was last updated.
  </Accordion>
</AccordionGroup>

## Data Model

The diagram below shows how the different Slack streams are related to each other.

```mermaid theme={null}
graph TD;
    subgraph "Slack Workspace"
        Users("Users");
        Channels("Channels");
        ChannelMembers("Channel Members");
        Messages("Messages");
        Threads("Threads");
        Lists("Lists");
        ListItems("List Items");
    end

    Users -- "member_id" --> ChannelMembers;
    Channels -- "channel_id" --> ChannelMembers;
    Users -- "user" --> Messages;
    Channels -- "channel_id" --> Messages;
    Messages -- "ts" --> Threads;
    Users -- "user" --> Threads;
    Channels -- "channel_id" --> Threads;
    Lists -- "id" --> ListItems;
```

> If you encounter any issues, reach out to us via Slack, and we'll gladly assist you!

## Skills for agents

<Snippet file="agent-skills-intro.mdx" />

<Card title="Download Slack skills file" icon="wand-magic-sparkles" href="/sources/slack.md">
  Slack connector documentation as plain markdown, for use in AI agent contexts.
</Card>
