Home/Tools/@tpmjs/tools-slack

listMessages

@tpmjs/tools-slack

Retrieve recent messages from a Slack channel.

Official
ops
v0.1.0
MIT

Interactive Playground

Test @tpmjs/tools-slack (listMessages) with AI-powered execution

0/2000 characters

Installation & Usage

Install this tool and use it with the AI SDK

1. Install the package

npm install @tpmjs/tools-slack
pnpm add @tpmjs/tools-slack
yarn add @tpmjs/tools-slack
bun add @tpmjs/tools-slack
deno add npm:@tpmjs/tools-slack

2. Import the tool

import { listMessages } from '@tpmjs/tools-slack';

3. Use with AI SDK

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { listMessages } from '@tpmjs/tools-slack';

const result = await generateText({
  model: openai('gpt-4o'),
  tools: { listMessages },
  prompt: 'Your prompt here...',
});

console.log(result.text);

Signature

(channel: string, limit?: number, cursor?: string, latest?: string, oldest?: string) => Promise<unknown>

Tags

agent
channel
list
messages
messaging
ops
recent
retrieve
slack
tpmjs

Parameters

Available configuration options

Auto-extracted
channel
Required
Type: string

Channel ID.

limit
Optional
Type: number

Number of messages to return (1-1000, default: 100).

cursor
Optional
Type: string

Pagination cursor from previous response.

oldest
Optional
Type: string

Only messages after this Unix timestamp (e.g., "1234567890.123456").

latest
Optional
Type: string

Only messages before this Unix timestamp (e.g., "1234567890.123456").

Schema extracted: 2/21/2026, 4:12:31 AM

README

@tpmjs/tools-slack

Slack API tools for AI agents. Send messages, manage channels, list users, search messages, upload files, and more.

Installation

npm install @tpmjs/tools-slack

Setup

Set the SLACK_BOT_TOKEN environment variable. Get your token from Slack API Apps.

Required bot scopes: chat:write, channels:read, channels:history, users:read, reactions:write, files:write, search:read.

Usage

import { sendMessage, listChannels } from '@tpmjs/tools-slack';

const result = await sendMessage.execute({ channel: '#general', text: 'Hello from AI!' });
const channels = await listChannels.execute({});

Tools

ToolDescription
sendMessageSend a message to a channel or thread
listChannelsList workspace channels by type
getChannelGet channel details
listUsersList workspace users
getUserGet user profile details
addReactionAdd emoji reaction to a message
uploadFileUpload a text file or snippet
setChannelTopicSet a channel's topic
listMessagesGet recent messages from a channel
searchMessagesSearch messages across the workspace

License

MIT

Statistics

Downloads/month

45

GitHub Stars

14

Quality Score

85%

Bundle Size

NPM Keywords

tpmjs
slack
messaging
ops
agent

Maintainers

thomasdavis(thomasalwyndavis@gmail.com)

Frameworks

vercel-ai