View as Markdown
Bot for Slack icon

Bot for Slack ACTION

List Messages

Read the message history of a channel, direct message (DM), or group DM using the bot token, newest first. Returns messages with text, timestamps (ts), user IDs, and reactions, plus has_more to tell whether older messages remain. To read further back, call again with latest set to the ts of the last message returned and inclusive left false, so that message is not returned again. Use List Replies with a message's ts to read its thread. See the documentation
  • Action
  • Read only
  • API key
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's Bot for Slack account once, then configure and run List Messages from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "slack_bot-list-messages",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    slack_bot: { authProvisionId: "apn_xxxxxxx" },
    conversation: "Channel",
    limit: 10,
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

List Messages inputs
Property Type Description
conversation Channel string
The ID of the conversation to read, e.g. C1234567890 for a channel or D1234567890 for a DM. Use List Channels to find a channel ID (the id field). A DM ID is the channel field of a message the bot received or of a Send Message response. In order to list a Slack channel, your bot must be a member of that channel, and in order to list private channels, your bot must have the groups:read scope in the OAuth & Permissions settings in Slack for this bot.
Required Dynamic
limit Limit integer
Maximum number of messages to return, e.g. 50. Default: 15. Slack apps distributed commercially outside the Slack Marketplace are capped at 15 messages and 1 request per minute; keep the default for those. Internal and Marketplace apps can request more, and results are paged automatically.
Optional
oldest Oldest string
Only return messages posted after this Slack timestamp, e.g. 1610000000.000000 (Unix epoch seconds, optionally with fractional microseconds). A message with exactly this timestamp is excluded unless Inclusive is true.
Optional
latest Latest string
Only return messages posted before this Slack timestamp, e.g. 1610000000.000000. Defaults to now. A message with exactly this timestamp is excluded unless Inclusive is true.
Optional
inclusive Inclusive boolean
Set to true to include messages whose timestamp equals Oldest or Latest, e.g. to fetch one known message. Ignored unless one of them is set. Default: false.
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
slack_bot-list-messages
Version
0.0.1
App
Bot for Slack
Authentication
API key
Read-only
Yes
Destructive
No
Open world
Yes