Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Slack

Scalekit connector
Open markdown

The Slack connector lets your AI agent act in each user's Slack account. Each user signs in to Slack once, and Scalekit stores and refreshes their tokens, so your agent never handles credentials. It comes with 96 tools.

Tools
96
What they doRead · write · destructive
33 · 49 · 1433 read49 write14 destructive
Users sign in with
OAuth app
Scalekit's or your own

What you can do

  • Send messages: post to channels, DMs, and threads on behalf of your users
  • Read conversations: retrieve channel history, thread replies, and direct messages
  • Manage channels: create channels, invite members, and update channel settings
  • Look up users: search for team members by name, email, or username
  • Upload files: share files and attachments into any conversation

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the Slack connection

    In AgentKit > Connections, create a Slack connection. The name you give it is the connection_name your code passes. See Configure connections.

    Scalekit credentials are available for Slack, so you don't need to register an OAuth app. To show your own app on the consent screen, use your own credentials instead.

    Use your own OAuth app

    Register your Scalekit environment with the Slack connector so Scalekit handles the authentication flow and token lifecycle for you. The connection name you create will be used to identify and invoke the connection programmatically. Then complete the configuration in your application as follows:

    1. Set up auth redirects

      • In Scalekit dashboard, go to AgentKit > Connections > Create Connection. Find Slack and click Create. Copy the redirect URI. It looks like https://<SCALEKIT_ENVIRONMENT_URL>/sso/v1/oauth/<CONNECTION_ID>/callback.

        Copy redirect URI from Scalekit dashboard

      • Log in to api.slack.com/apps and click Create New App.

      • Select From scratch, enter an app name, and select your workspace.

      • Go to OAuth & Permissions and scroll to Redirect URLs.

      • Click Add New Redirect URL and paste the redirect URI from Scalekit. Click Add.

        Add redirect URL in Slack

    2. Enable distribution

      • In your Slack app settings, go to Manage Distribution.

      • Under Share Your App with Other Workspaces, complete the checklist Slack shows for your app. This can include accepting Slack’s distribution agreement, adding support and privacy URLs, and confirming that the redirect URL you added above is valid.

      • Click Activate Public Distribution.

        Slack app distribution must be active before users can authorize the app from external workspaces. If distribution is not active, OAuth can succeed in your development workspace but fail when a user tries to connect a second workspace.

        Enable Slack app distribution

      • From Basic Information, copy the Client ID and Client Secret.

    3. Add credentials in Scalekit

      • In Scalekit dashboard, go to AgentKit > Connections and open the connection you created.

      Choose Bot scope for most agents, including agents that read channel history or send messages as your Slack app. Bot scope makes the agent act as the Slack app or bot; use User scope only when the agent must act as the authorizing Slack user.

  4. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'slack'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Slack:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'slack_auth_test',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user signs in once. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • slack_auth_testVerify the current Slack connection's authentication and identity.Read-only

    Test Authentication

    Verify the current Slack connection's authentication and identity. Returns the connected team, user, and bot identity for the active token.

    Inputs

    This tool takes no inputs.

  • slack_fetch_conversation_historyPage messages in one Slack channel or DM in time order.Read-only

    Fetch Slack Conversation History

    Page messages in one Slack channel or DM in time order. Returns messages and a next_cursor. Use fetch_conversation_history to read a channel. Use search_messages to find text across the workspace. Use get_conversation_replies for one thread.

    Inputs

    channelstringrequired
    Channel ID, channel name (#general), or user ID for DM
    cursorstring
    Paginate through collections by cursor for pagination
    lateststring
    End of time range of messages to include in results
    limitinteger
    Number of messages to return (1-1000, default 100)
    oldeststring
    Start of time range of messages to include in results
  • slack_get_bot_infoRetrieve information about a bot user in Slack, such as its name and icons.Read-only

    Get Bot Info

    Retrieve information about a bot user in Slack, such as its name and icons. Requires a valid Slack OAuth2 connection with the users:read scope.

    Inputs

    botstring
    Bot user to get info on. Defaults to the calling bot's own identity if omitted.
  • slack_get_conversation_infoGet metadata for one Slack channel, including settings and optional member count.Read-only

    Get Slack Conversation Info

    Get metadata for one Slack channel, including settings and optional member count. Returns the channel object. Use get_conversation_info for one known channel. Use list_channels when you do not have the id.

    Inputs

    channelstringrequired
    Channel ID, channel name (#general), or user ID for DM
    include_localeboolean
    Set to true to include the locale for this conversation
    include_num_membersboolean
    Set to true to include the member count for the conversation
  • slack_get_conversation_repliesPage replies in one Slack thread by parent timestamp.Read-only

    Get Slack Conversation Replies

    Page replies in one Slack thread by parent timestamp. Returns messages and a next_cursor. Use get_conversation_replies for a thread. Use fetch_conversation_history for the channel's main timeline.

    Inputs

    channelstringrequired
    Channel ID, channel name (#general), or user ID for DM
    tsstringrequired
    Timestamp of the parent message to get replies for
    cursorstring
    Pagination cursor for retrieving next page of results
    inclusiveboolean
    Include messages with latest or oldest timestamp in results
    lateststring
    End of time range of messages to include in results
    limitinteger
    Number of messages to return (default 100, max 1000)
    oldeststring
    Start of time range of messages to include in results
  • slack_get_dnd_infoRetrieve a Slack user's current Do Not Disturb status, including whether it is active and when it ends.Read-only

    Get Do Not Disturb Info

    Retrieve a Slack user's current Do Not Disturb status, including whether it is active and when it ends. Requires a valid Slack OAuth2 connection with the dnd:read scope.

    Inputs

    userstring
    User to fetch Do Not Disturb status for. Defaults to the authenticated user.
  • slack_get_file_infoGet metadata and comments for one Slack file by id.Read-only

    Get File Info

    Get metadata and comments for one Slack file by id. Returns the file object. Use get_file_info for a known file id. Use list_files or search_files when you do not have the id.

    Inputs

    filestringrequired
    Specify a file by providing its ID.
    cursorstring
    Pagination cursor from a previous call's response_metadata.next_cursor.
    limitinteger
    The maximum number of items to return.

Triggers send your server an event when something happens in a connected Slack workspace. Subscribe the connection once; events from every workspace connected through it reach your endpoint.

  • slack_app_mentionFires when someone mentions your Slack app in a channel it is in.Webhook

    App mentioned

    Fires when someone mentions your Slack app in a channel it is in.

    • Per connection
    • Needs your own app

    Needs

    Events to subscribe to
    app_mention
    Scopes
    app_mentions:read

    Filters

    Channel IDoptional
    Receive events from this channel only. Leave empty for every channel the app is in.
  • slack_message_postedFires when someone posts a message in a channel your Slack app is in. Bot messages and edits are not sent.Webhook

    Message posted

    Fires when someone posts a message in a channel your Slack app is in. Bot messages and edits are not sent.

    • Per connection
    • Needs your own app

    Needs

    Events to subscribe to
    message.channels (public channels)message.groups (private channels)
    Scopes
    channels:historygroups:history

    Filters

    Channel IDoptional
    Receive events from this channel only. Leave empty for every channel the app is in.

Set up in Slack

Follow Set up a webhook trigger. The connection must use your own Slack app (Bring your own credentials). At api.slack.com/apps, open your app:

StepWhere in your Slack app
Signing secretBasic Information > App Credentials > Signing Secret
Webhook URLEvent Subscriptions > turn on Enable Events > Request URL. Save the signing secret in Scalekit first: Slack checks the URL right away
EventsEvent Subscriptions > Subscribe to bot events: add each trigger’s events, then Save Changes

Subscribe only to the events your triggers use. Events that match no trigger subscription aren’t delivered.

The Channel ID is at the bottom of a channel’s details in Slack. In each event, resource_id is the channel ID and payload is the body Slack sent, with the message under payload.event. See Event fields.

Workflows

Proxy API call
const result = await actions.request({
connectionName: 'slack',
identifier: 'user_123',
path: '/api/auth.test',
method: 'POST',
});
console.log(result);
// If you use slack_fetch_conversation_history, message text can contain
// Slack mention tokens like <@U09NZ1V7KPF>. Resolve the user ID with
// slack_get_user_info before showing messages to end users.
Execute a tool
const result = await actions.executeTool({
connector: 'slack',
identifier: 'user_123',
toolName: 'slack_add_reaction',
toolInput: {},
});
console.log(result);