Use the For each message in a conversation iterator
- Dernière mise à jour2026/04/21
Use the For each message in a conversation iterator to automatically iterate through every message within a specific Slack conversation or channel. It enables you to automate actions such as analyzing, archiving, or processing messages in bulk within a conversation.
Procedure
- Double-click or drag the Loop action from the Loop package in the Actions palette.
- From the iterator list, search for theSlack package and select the For each message in a conversation option.
- Use the Session name field to select one of the following
options:
- Session name: Enter the name of the session you used in the
Connect
action.
(Optional) Click the Insert a value icon to select an existing variable that you have used to store the Slack session name.
- Variable: Enter the name of the variable that you have used to store the session name.
- Session name: Enter the name of the session you used in the
Connect
action.
- Username: Specify the usernames for the group conversations separated by comma.
- Channel ID: Specify the channel ID of the group conversations.Note: To retrieve the channel ID of a private Slack channel, ensure that the app you created in the Slack API portal is added to that channel. To do this, navigate to the , and click Add apps.
- Use the Start date and End date options to filter messages within a specified date range.
- In the Assign message details to a variable field, choose
either Multiple variables or Dictionary
variable to save the message details in the output variable:
- Multiple variables: Assigns each retrieved value of a specific key
(for example, (ID, message, sentByUserID, sentByUsername,
createdDateTime, modifiedDateTime) to a separate variable enabling you
to map each team detail to a specific variable. Do following steps for
each variable:
- Click Add variable mapping.
- Enter the Key of the variable.
- In the Map to variable field, choose a variable where the data will be saved.
- Click Add for this data to be saved to the configured variable.
Table 1. Keys with variable mapping Key Description Variable type ID Unique identifier assigned to the Slack message String message Content of the message in the conversation String sentByUserID Unique identifier of the user who sent the message. String sentByUsername Display name of the user who sent the message String createdDateTime Date and time when the message was created Datetime modifiedDateTime Date and time when the message was last modified. Datetime - Dictionary: stores all values in a dictionary object with key-value pairs.
- Multiple variables: Assigns each retrieved value of a specific key
(for example, (ID, message, sentByUserID, sentByUsername,
createdDateTime, modifiedDateTime) to a separate variable enabling you
to map each team detail to a specific variable. Do following steps for
each variable: