You can GET all the messages in a Slack channel with Tray's HTTP-client connector. The Slack documentation for retrieving messages is here: https://api.slack.com/messaging/retrieving. The two parts to look at specifically are "Retrieving Conversation History" and "Retrieving Individual Messages".
- Drag an HTTP-client connector onto your canvas and authenticate it with your Slack authentication. This will load the Slack logo into the HTTP-client connector (for improved visibility) and make it easy to access the required authentication token without compromising security. Note** Verify that you have your Slack authentication set up with the proper scopes; you'll need channels:read and channels:history for this implementation.
- Set up the connector's 'Input data' by inserting the URL to get a channel's message history and an Authorization header set to Bearer and the JSON-path to your authentication token:
- To get all of the previous messages in a channel, add a query parameter for the channel Id:
- To restrict the number of messages returned, Slack offers additional query parameters:
- latest - the ts value of the latest message you want returned. The ts stands for 'timestamp' and represents the time of the message in Unix time (for more on Unix time, see here). Slack also uses the ts value to serve as a unique id for each message.
- oldest - the ts value of the oldest message you want returned.
- limit - the number of messages you want returned.
- Here's an example of a query parameter specifying the oldest message in Unix time:
- Here's an overview of how you could set up a workflow to GET all the messages in a channel from the last 12 hours: