npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

intentkit-slack

v1.0.1

Published

Slack messaging adapter for IntentKit via @slack/web-api

Downloads

199

Readme

intentkit-slack

Slack messaging adapter for IntentKit — channel messaging, reactions, and user lookup via the provider system.

Lets AI agents (like Claude via Dispatch) send messages, read channel history, add reactions, and look up users through MCP.

Install

npm install intentkit-slack

Slack App Setup

Before using this adapter, you need a Slack app with a bot token:

  1. Create a Slack App at api.slack.com/apps > "Create New App" > "From scratch"
  2. Add Bot Token Scopes under "OAuth & Permissions" > "Scopes" > "Bot Token Scopes":
    • chat:write — send messages
    • channels:read — list public channels
    • groups:read — list private channels the bot is in
    • channels:history — read public channel messages
    • groups:history — read private channel messages
    • reactions:write — add emoji reactions
    • users:read — look up user info
    • users:read.email — (optional) access user email addresses
  3. Install to Workspace — click "Install to Workspace" and authorize
  4. Copy the Bot Token — starts with xoxb-. This goes in your config
  5. Invite the bot to channels it needs to access: /invite @YourBotName

Quick Start

import { defineFunction, IntentRegistry, createContext, serve, z } from 'intentkit';
import { createSlackProvider, type SlackClient } from 'intentkit-slack';

// Register your functions
const registry = new IntentRegistry().register(sendSlackMessage, listChannels, getMessages, addReaction);

// Create context (no database needed for Slack-only projects)
const context = await createContext({ events: true });

// Boot MCP server with Slack provider
await serve({
  name: 'my-slack-agent',
  registry,
  context,
  providers: [
    createSlackProvider({
      token: process.env.SLACK_BOT_TOKEN!,
      defaultChannel: '#general',
    }),
  ],
});

Configuration

| Option | Default | Description | |--------|---------|-------------| | token | -- | Slack Bot Token (xoxb-...) | | defaultChannel | -- | Default channel ID or name for posting | | name | 'slack' | Provider name in ctx.providers |

Using in Functions

Access the Slack client via ctx.providers.slack:

import { defineFunction, z } from 'intentkit';
import type { SlackClient } from 'intentkit-slack';

export const notifyChannel = defineFunction({
  name: 'notify_channel',
  intent: 'Send a notification to a Slack channel',
  permissions: ['slack:write'],
  requires: ['slack'],  // Validates provider exists at startup

  input: z.object({
    message: z.string(),
    channel: z.string().optional(),
  }),
  output: z.object({
    ts: z.string(),
    channel: z.string(),
  }),

  execute: async (input, ctx) => {
    const slack = ctx.providers.slack as SlackClient;
    const result = await slack.sendMessage({
      text: input.message,
      channel: input.channel,
    });

    return { ts: result.ts, channel: result.channel };
  },
});

Example Functions

The package includes 4 ready-to-use functions in functions/slack.ts:

| Function | Intent | Permission | |----------|--------|------------| | send_slack_message | Send a message to a channel or thread | slack:write | | list_channels | List available channels the bot can access | slack:read | | get_messages | Get recent messages from a channel or thread | slack:read | | add_reaction | Add an emoji reaction to a message | slack:write |

Import and register them:

import { sendSlackMessage, listChannels, getMessages, addReaction } from 'intentkit-slack/functions';

const registry = new IntentRegistry()
  .register(sendSlackMessage, listChannels, getMessages, addReaction);

SlackClient API

The full client interface for custom function implementations:

interface SlackClient {
  // Connection
  ping(): Promise<boolean>;

  // Messaging
  sendMessage(options: SendMessageOptions): Promise<SlackMessage>;
  getMessages(options: GetMessagesOptions): Promise<SlackMessage[]>;

  // Channels
  listChannels(limit?: number): Promise<SlackChannel[]>;

  // Reactions
  addReaction(channel: string, timestamp: string, emoji: string): Promise<void>;

  // Users
  getUser(userId: string): Promise<SlackUser>;
}

Claude Desktop Config

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "slack": {
      "command": "node",
      "args": ["path/to/your/serve.js"],
      "env": {
        "SLACK_BOT_TOKEN": "xoxb-your-bot-token"
      }
    }
  }
}

Architecture

Claude (Dispatch / Desktop)
    |  MCP tool call
IntentKit (serve + permissions + hooks)
    |  ctx.providers.slack
intentkit-slack (SlackClientImpl)
    |
@slack/web-api (WebClient)
    |  HTTPS
Slack API

The WebClient is HTTP-based and stateless -- no persistent connection is maintained. healthCheck() calls auth.test to verify the token. No cleanup is needed on shutdown since there is no connection to close.

License

MIT