Read Slack Message
The Read Slack Message activity retrieves messages from a Slack channel that were posted after a specific timestamp.
Purpose
Use the Read Slack Message activity to:
- Read replies to messages sent by workflows
- Implement interactive workflow patterns
- Wait for user responses in Slack
- Process feedback or approvals via Slack
Prerequisites
Slack Connection Required
- Must have a configured Slack connection (see Settings → Connections)
- OAuth token must have
channels:readandchannels:historypermissions
Message Timestamp Required
- Typically used after a Send Slack Message activity
- Requires the timestamp of a previously sent message
- Use context variables to pass timestamps between activities
Configuration
Connection Settings
- Slack Connection: Select a pre-configured Slack connection
Channel Settings
- Channel Name: The Slack channel to read from (e.g., "products")
- Channel ID: Alternative to channel name
Timestamp Settings
- Timestamp: Reference to a timestamp variable (e.g.,
{MySlackMessageTimestamp}) - Only messages after this timestamp will be retrieved
Output Context Variables
The activity returns three values that should be stored in workflow variables:
- Read Timestamp: Timestamp of the message that was read
- Username: The Slack username of the person who sent the message
- Message: The content of the message
Context Variables Configuration
Read Timestamp Context Key: SlackReadTimestamp
Username Context Key: SlackUsername
Message Context Key: SlackMessage
These variables can then be used in subsequent workflow activities.
How It Works
Reading Process
- Activity connects to Slack channel
- Retrieves messages posted after the provided timestamp
- Returns the first message found
- Stores message details in workflow variables
Sequential Reading
To read multiple messages:
- First read stores its timestamp in a variable
- Second read uses that timestamp to get the next message
- Continue in a loop to process all messages
Usage Patterns
Send and Wait for Reply
1. Send Slack Message
└─ Store timestamp in: InitialMessageTimestamp
2. Delay (e.g., 5 minutes to allow response time)
3. Read Slack Message
└─ Timestamp: {InitialMessageTimestamp}
└─ Store: ReadTimestamp, Username, Message
4. Process response (If activity, Script, etc.)
Loop Through Multiple Messages
1. Send Slack Message → Store: CurrentTimestamp
2. Delay (wait for responses)
3. Read Slack Message
└─ Timestamp: {CurrentTimestamp}
└─ Store response in: CurrentTimestamp (overwrites), Username, Message
4. If (message found)
└─ Process message
└─ Loop back to step 3 (reads next message)
5. If (no more messages)
└─ Continue workflow
Interactive Approval
1. Send Slack Message: "Approve? (yes/no)"
└─ Store: ApprovalTimestamp
2. Delay (wait for response)
3. Read Slack Message
└─ Timestamp: {ApprovalTimestamp}
└─ Store: ResponseTimestamp, ApproverUsername, ResponseMessage
4. If ({ResponseMessage} contains "yes")
└─ Approved branch
5. Else
└─ Rejected branch
Example Configuration
Basic Message Reading
Slack Connection: Company Slack
Channel: products
Timestamp: {InitialMessageTimestamp}
Read Timestamp Context Key: NextTimestamp
Username Context Key: ResponderName
Message Context Key: ResponseText
After Sending
1. Send Slack Message Activity:
Message: "Please confirm: Proceed with data load? (yes/no)"
Store Timestamp: QuestionTimestamp
2. Read Slack Message Activity:
Timestamp: {QuestionTimestamp}
Store: ReplyTimestamp, ResponderUsername, ReplyMessage
3. Log Message:
Message: "Received response from @ResponderUsername: @ReplyMessage"
Returned Data
Read Timestamp
- Timestamp of the message that was read
- Use this to read subsequent messages
- Can replace the original timestamp variable to iterate
Username
- Slack username of the message sender
- Format: Usually the Slack display name or username
- Use for logging, routing, or verification
Message
- The actual text content of the message
- Can be processed with If activity for conditional logic
- Supports parameter substitution in subsequent activities
Loop Pattern for Multiple Messages
┌─> Read Slack Message
│ ├─ Timestamp: {CurrentTimestamp}
│ └─ Store: CurrentTimestamp, Username, Message
│
├─> If (Message is not empty)
│ ├─ [Yes] Process Message
│ │ └─> Loop back to Read
│ └─ [No] Exit loop
│
└─> Continue workflow
This pattern reads all messages posted after the initial timestamp.
Best Practices
- Add Delays: Allow time for users to respond before reading
- Handle Empty Results: Check if a message was found before processing
- Store Timestamps: Always store read timestamp for iteration
- Message Validation: Verify message content format before acting on it
- User Verification: Consider validating the responding user
- Timeout Pattern: Combine with Delay and Stop for timeout scenarios
- Clear Instructions: Send clear, structured questions when expecting replies
Common Issues
No Messages Found
- Timestamp is too recent (no messages posted yet)
- Wrong channel specified
- Bot not added to the channel
- OAuth token lacks
channels:historypermission
Reading Same Message Repeatedly
- Not updating the timestamp variable
- Using the original timestamp instead of the read timestamp
- Check that context variables are properly configured
Unexpected Message Format
- Users didn't respond in expected format
- Multiple users responded (first message returned)
- Message contains formatting or emojis
Limitations
- Reads one message at a time (first message after timestamp)
- Requires explicit timestamp reference
- Cannot filter by user or content in the activity itself (use If activity)
- No built-in timeout (combine with Delay and conditional logic)
Security Notes
- Messages may contain sensitive data
- Validate message content before acting on it
- Log who responded for audit purposes
- Consider channel access controls in Slack
- Be aware of Slack message retention policies
OAuth Permissions Required
For IT team/Slack admin, the Slack App needs:
channels:read- List and read channel informationchannels:history- Read channel message historychat:write- Send messages (if using with Send Slack Message)
Troubleshooting
Messages Not Being Read
- Verify bot has
channels:historypermission - Check bot is member of the channel
- Confirm timestamp variable has valid value
- Review workflow execution log for errors
- Test in Slack to verify messages exist
Wrong Message Retrieved
- Verify timestamp is from the correct message
- Check if multiple users responded (first one is returned)
- Ensure timestamp format is correct
- Consider adding delay for message propagation