Skip to main content

Slack Connection Patterns

Slack nodes allow you to interact with Slack workspaces through OAuth-connected apps. These nodes require a Slack connection configured in the Connections panel.

Setting Up Slack Connections

To use Slack nodes, you need to create a custom Slack app and configure it with the appropriate OAuth scopes and credentials.

  • Creating a new app at api.slack.com/apps
  • Configuring OAuth & Permissions with refresh tokens
  • Adding redirect URLs for Intellectible
  • Setting up the required Bot Token Scopes (e.g., chat:write, channels:read, users:read)
  • Getting your Client ID and Client Secret
  • Adding the connection in Intellectible

For complete step-by-step instructions on creating and configuring your Slack app, see the Creating a Slack App section in the Connections Guide.

Using the Connection in Workflows

Once you've set up your Slack connection:

  1. Navigate to the Connections section in your Intellectible dashboard
  2. Verify your Slack connection is active
  3. Add the connection to the projects that need it via Manage Projects
  4. In your workflow, select the connection in each Slack node's Connections panel

Common Patterns

Sending Notifications

Connect the Done output of your workflow nodes to a Slack: Send Message node to send notifications when tasks complete.

Processing Channel Messages

Use Slack: Get Conversation History to retrieve messages, then pipe them through AI nodes for analysis, summarization, or classification.

Bot Interactions

Combine Slack: Open Conversation and Slack: Send Message to create interactive bot workflows that respond to user actions.


Cursor Pagination for More Than 1000 Results

When you need to retrieve more than 1000 messages or conversations from Slack, you can use cursor-based pagination with the While node. This pattern allows you to continuously fetch data until all results have been retrieved.

Overview

The Slack: Get Conversation History and Slack: List Conversations nodes support cursor-based pagination. By default, they retrieve up to 1000 results (5 pages × 200 per page). To fetch more, you'll need to:

  1. Initialize a cursor variable
  2. Use a While node to loop while the cursor is not null
  3. Pass the cursor to subsequent API calls
  4. Update the cursor with each response
  5. The loop automatically breaks when the cursor becomes null

Step-by-Step Implementation

Slack cursor pagination workflow example

1. Find Your Channel ID

First, use Slack: List Conversations to find the conversation ID of the channel you want to retrieve history from:

  • Connect the List Conversations node to your workflow start
  • The output will contain a list of conversations with their IDs
  • Note the id field of the conversation you want to retrieve

2. Initialize the Cursor Variable

At the start of your workflow, create a Variable node to store the cursor:

  • Add a Variable node
  • Set the variable name to cursor
  • Set the initial value to empty (leave blank or use empty string "")

This empty cursor tells the Slack API to start from the beginning.

3. Set Up the While Node

Add a While node configured to run while the cursor is valid:

  • Add a While node after your start
  • Set Variable Name to cursor
  • In the node's properties panel:
    • Set Operation to !=
    • Set Break Value to null
  • This will continue looping as long as cursor != null
While Condition

The loop will automatically break when the cursor becomes null, indicating no more results are available.

4. Pass the Cursor to Get Conversation History

Inside the loop, connect a Slack: Get Conversation History node:

  • Set Channel ID to the channel you want to retrieve
  • Set Limit to 200 (maximum per page)
  • Set Max Pages to 1 (we'll handle pagination manually with the loop)
  • Connect the Cursor input to your cursor variable using {{cursor}}

5. Store Messages with Index Key

After each API call, store the messages using a Set Variable node:

  • Add a Set Variable node after the Get Conversation History node
  • Set the variable name to messageHistory/{{index}}
    • The {{index}} comes from the While node's current iteration index
    • This creates a unique key for each batch of messages (e.g., messageHistory/0, messageHistory/1, etc.)
  • Set the value to the messages output from the Get Conversation History node

6. Update the Cursor

Add another Set Variable node to update the cursor for the next iteration:

  • Add a Set Variable node
  • Set the variable name to cursor
  • Set the value to {{messages.nextCursor}}
    • This extracts the nextCursor field from the response
    • When there are no more results, this will be null, breaking the loop

7. Flatten the Results

After the loop completes, use a Flatten List node to combine all message batches:

  • Connect a Flatten List node to the While node's Finished output
  • Pass the messageHistory variable (which now contains all batches)
  • The output will be a single flat array containing all messages from all iterations

Complete Workflow Structure

[Start]

[Set Variable: cursor = ""]

[While: cursor != null]

[Get Conversation History]
- channelId: "C1234567890"
- cursor: {{cursor}}
- limit: 200
- maxPages: 1

[Set Variable: messageHistory/{{index}} = messages]

[Set Variable: cursor = messages.nextCursor]
↓ (loop continues while cursor != null)
[While Finished]

[Flatten List: messageHistory]

[All messages retrieved!]

Key Points

  • Cursor starts empty: An empty cursor tells the API to start from the beginning
  • While loop breaks automatically: When nextCursor is null, the While node's condition (cursor != null) becomes false and iteration stops
  • Unique keys: Using {{index}} from the While node ensures each batch is stored separately
  • Flatten at the end: The Flatten List node combines all batches into a single array for easy processing

This pattern works for both Get Conversation History and List Conversations nodes when you need to retrieve more than 1000 results.