Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Discord Bot

Scalekit connector
Open markdown

The Discord Bot connector lets your AI agent act in each user's Discord Bot account. Each user connects their own Discord Bot API key once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 221 tools.

Tools
221
What they doRead · write · destructive
93 · 82 · 4693 read82 write46 destructive
Users sign in with

What you can do

  • Send and manage messages: send, edit, delete, pin, and react to messages in channels and DMs
  • Search messages: search a server’s messages by query and read channel message history
  • Manage channels and threads: create, modify, and delete channels, and start, join, and list threads
  • Manage members and roles: add, kick, and ban members, create and assign roles, and set auto-moderation rules
  • Build slash commands: register, edit, and delete application commands and respond to user interactions
  • Schedule events: create, update, and delete scheduled events and stage instances in a server

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 Discord Bot connection

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

    Console steps with screenshots

    Register your Discord bot token with Scalekit so it can authenticate and proxy requests on behalf of your users. Discord Bot uses Bearer Token authentication.

    1. Create a Discord application and bot user

      • Go to the Discord Developer Portal and sign in with your Discord account.
      • Click New Application, enter a name (for example, Agent Auth), accept the terms, and click Create.
      • Open your application and go to Bot in the left sidebar.
    2. Get your bot token

      • On the Bot page, under Token, click Reset Token to generate a new bot token and copy it immediately — Discord shows the full token only once.

        Discord application Bot page showing the Username, Token, and Authorization Flow settings

    3. Invite the bot to a server

      • Go to OAuth2 > URL Generator in the left sidebar.

      • Under Scopes, select bot.

      • Under Bot Permissions, select the permissions your agent needs.

        Discord Bot Permissions page showing General, Text, and Voice permission checkboxes

      • Copy the generated URL at the bottom of the page, open it in a browser, and select a server to add the bot to.

    4. Create a connection in Scalekit

      • In the Scalekit dashboard, go to AgentKit → Connections → Create Connection.
      • Search for Discord Bot and click Create.
      • Note the Connection name — use this as connection_name in your code (e.g., discordbot).
    5. Add a connected account

      Connected accounts link a specific user identifier in your system to a Discord bot token. Add one in the dashboard to test. In production, each user adds their own through the authorization link: they enter their credentials on the page it opens.

      In the dashboard, to test

      • Open the connection and click the Connected Accounts tab → Add account.
      • Fill in Your User’s ID and Bot Token, then click Save.

      From your backend, if your app already has the credentials

      For example, when users enter them on a settings page in your app:

      import { ConnectorStatus } from '@scalekit-sdk/node'
      const authorizationDetails = {
      details: {
      case: 'staticAuth',
      value: { details: { api_key: 'your-discord-bot-token' } },
      },
      }
      let { connectedAccount } = await scalekit.actions.upsertConnectedAccount({
      connectionName: 'discordbot',
      identifier: 'user_123',
      authorizationDetails,
      })
      // Make sure the account is ACTIVE before the first tool call.
      if (connectedAccount?.status !== ConnectorStatus.ACTIVE) {
      ;({ connectedAccount } = await scalekit.actions.upsertConnectedAccount({
      connectionName: 'discordbot',
      identifier: 'user_123',
      authorizationDetails,
      }))
      }
  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 = 'discordbot'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Discord Bot:', 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: 'discordbot_get_current_user',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user opens the link once and enters their Discord credentials there. If your app already has a user's credentials, add the account from your backend instead, as the console steps above show. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • discordbot_get_answer_votersRetrieve a list of users who voted for a specific answer in a Discord poll.Read-only

    Get Answer Voters

    Retrieve a list of users who voted for a specific answer in a Discord poll.

    Inputs

    answer_idstringrequired
    The ID of the poll answer to get voters for.
    channel_idstringrequired
    The ID of the channel containing the poll message.
    message_idstringrequired
    The ID of the poll message.
    afterstring
    Get users after this user ID (snowflake) for pagination.
    limitinteger
    Maximum number of voters to return (1-100). Default is 25.
  • discordbot_get_application_activity_instanceRetrieve a serialized activity instance for an application, if it exists.Read-only

    Get Application Activity Instance

    Retrieve a serialized activity instance for an application, if it exists. Useful for preventing unwanted activity sessions.

    Inputs

    application_idstringrequired
    The ID of the application that owns the activity instance.
    instance_idstringrequired
    The ID of the activity instance to retrieve.
  • discordbot_get_application_command_permissionsFetch permissions for a specific application command in a specific guild.Read-only

    Get Application Command Permissions

    Fetch permissions for a specific application command in a specific guild. Returns a guild application command permissions object describing which roles, users, and channels can (or cannot) use the command. This is a read-only lookup — use Get Guild Application Command Permissions instead to fetch permissions for every command in the guild at once. Note: editing permissions (the corresponding PUT endpoint) requires a Bearer token authorized with the applications.commands.permissions.update scope and cannot be done with a bot token, so no write tool is provided here.

    Inputs

    application_idstringrequired
    The ID of the application.
    command_idstringrequired
    The ID of the command to get permissions for.
    guild_idstringrequired
    The ID of the guild.
  • discordbot_get_application_emojiRetrieve a specific emoji owned by a Discord application by its emoji ID.Read-only

    Get Application Emoji

    Retrieve a specific emoji owned by a Discord application by its emoji ID.

    Inputs

    application_idstringrequired
    The ID of the application that owns the emoji.
    emoji_idstringrequired
    The ID of the emoji to retrieve.
  • discordbot_get_application_role_connection_metadataFetch the list of application role connection metadata records configured for an application.Read-only

    Get Application Role Connection Metadata Records

    Fetch the list of application role connection metadata records configured for an application. Returns an array of application role connection metadata objects, each describing a comparison type, dictionary key, name, and description used to verify a user's role connection.

    Inputs

    application_idstringrequired
    The ID of the application.
  • discordbot_get_auto_moderation_ruleGet a single Auto Moderation rule for a guild by its ID.Read-only

    Get Auto Moderation Rule

    Get a single Auto Moderation rule for a guild by its ID. Requires the MANAGE_GUILD permission. Returns an auto moderation rule object.

    Inputs

    guild_idstringrequired
    The ID of the guild the rule belongs to.
    rule_idstringrequired
    The ID of the Auto Moderation rule to retrieve.
  • discordbot_get_bot_gatewayRetrieve a valid WebSocket (wss) URL for connecting to the Discord Gateway as this bot, along with the recommended number of shards to use and the bot's current session-start rate limit (total, remaining, reset_after, max_concurrency).Read-only

    Get Gateway Bot

    Retrieve a valid WebSocket (wss) URL for connecting to the Discord Gateway as this bot, along with the recommended number of shards to use and the bot's current session-start rate limit (total, remaining, reset_after, max_concurrency). Requires a valid bot token. Use this before starting a Gateway connection to avoid exhausting your session start limit.

    Inputs

    This tool takes no inputs.

  • discordbot_get_channelRetrieve a Discord channel by its ID.Read-only

    Get Channel

    Retrieve a Discord channel by its ID. Returns channel information including type, name, topic, permissions, and other metadata.

    Inputs

    channel_idstringrequired
    The ID of the channel to retrieve.