Slack: Get Conversation History
Controlled node
Overview
Retrieves the message history from a Slack channel or conversation. This node fetches messages in batches (pages) and supports pagination to retrieve up to 1000 messages per execution.
The node requires a Slack connection to be configured in the project settings. It will fetch up to 200 messages per page and can retrieve a maximum of 5 pages (1000 messages total) in a single run. For larger histories, use the cursor output to paginate through results.
Inputs
| Input | Type | Description | Default |
|---|---|---|---|
| Run | Event | Triggers the node to fetch conversation history | - |
| Channel ID | Text | The Slack channel ID or conversation ID to fetch history from | - |
| Limit | Number | Maximum number of messages to fetch per page (max 200) | 200 |
| Max Pages | Number | Maximum number of pages to fetch (max 5, totaling 1000 messages) | 1 |
| Cursor | Text | Pagination cursor for fetching subsequent pages of history | - |
| Connections | Connection | Slack connection to use for the API call | - |
Outputs
| Output | Type | Description |
|---|---|---|
| Done | Event | Fires when the node has finished fetching messages |
| Messages | Data | Array of message objects from the conversation history, or an error object if the request failed |
Runtime Behavior and Defaults
- Controlled Node: This node requires a
Runevent to execute. It will not run automatically when data changes. - Pagination: The node supports Slack's cursor-based pagination. Pass the cursor from a previous run into the
Cursorinput to fetch the next page of results. - Rate Limiting: The node respects Slack's rate limits by fetching pages sequentially with a small delay between requests.
- Error Handling: If the Slack API returns an error (e.g., invalid channel ID, missing permissions), the
Messagesoutput will contain an error object with details rather than the message array. - Maximum Results: While the
Limitinput accepts values up to 200, andMax Pagesaccepts values up to 5, exceeding these limits will result in an error output.
Example Usage
Basic Channel History Retrieval:
- Connect a
Startnode or event trigger to theRuninput - Provide a Slack channel ID (e.g.,
C1234567890) to theChannel IDinput - Set
Limitto100to fetch 100 messages per page - Set
Max Pagesto2to fetch up to 200 messages total - Connect the
Doneevent to trigger downstream processing - Access the message history from the
Messagesoutput, which will contain an array of Slack message objects
Paginated History Retrieval:
- First run: Leave
Cursorempty to fetch the first page - Store the returned messages and check if more pages exist (the Slack API returns a
response_metadata.next_cursorin the result) - Subsequent runs: Pass the
next_cursorvalue into theCursorinput to fetch the next page - Repeat until no more cursor is returned or you've reached your desired message count