Home/Tools/@tpmjs/tools-slack

searchMessages

@tpmjs/tools-slack

Search for messages across a Slack workspace.

Official
ops
v0.1.0
MIT

Interactive Playground

Test @tpmjs/tools-slack (searchMessages) 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 { searchMessages } from '@tpmjs/tools-slack';

3. Use with AI SDK

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

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

console.log(result.text);

Signature

(query: string, sort?: string, count?: number) => Promise<unknown>

Tags

across
agent
messages
messaging
ops
search
slack
tpmjs
workspace

Parameters

Available configuration options

Auto-extracted
query
Required
Type: string

Search query (supports operators like from:, in:, has:).

sort
Optional
Type: string

Sort by: score (relevance) or timestamp (default: score).

count
Optional
Type: number

Number of results to return (1-100, default: 20).

Schema extracted: 2/26/2026, 4:21:07 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
searchMessages | TPMJS | TPMJS