Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Discord

Scalekit connector
Open markdown

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

Tools
34
What they doRead · write · destructive
24 · 6 · 424 read6 write4 destructive
Users sign in with
OAuth app
Scalekit's or your own

What you can do

  • Read user profiles: fetch the signed-in user’s profile, linked accounts, and details of other users
  • List servers and channels: see which servers the user belongs to and list a server’s channels
  • Chat in lobbies: create or join lobbies, send and read lobby messages, and link a channel
  • Check entitlements and subscriptions: look up a user’s premium entitlements and SKU subscriptions
  • Resolve invites: look up invite codes, server widgets, and server templates
  • Manage command permissions: read and edit who can use an app’s slash commands 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 connection

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

    Scalekit credentials are available for Discord, 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 Discord connector so Scalekit handles the OAuth 2.0 (PKCE) flow and token lifecycle for you. The connection name you create will be used to identify and invoke the connection programmatically.

    1. Create a Discord application

      • Go to the Discord Developer Portal and sign in with your Discord account.

      • Click New Application, enter a name for your app (e.g., My Agent), accept the terms, and click Create.

    2. Set up the OAuth2 redirect URI

      • In Scalekit dashboard, go to AgentKit > Connections > Create Connection. Find Discord and click Create. Copy the redirect URI shown — it looks like:

        https://<SCALEKIT_ENVIRONMENT_URL>/sso/v1/oauth/<CONNECTION_ID>/callback

      • Back in the Discord Developer Portal, open your application and go to OAuth2 in the left sidebar.

      • Under Redirects, click Add Redirect, paste the URI from Scalekit, and click Save Changes.

    3. Copy your credentials

      • On the OAuth2 page, copy the Client ID.

      • Click Reset Secret to generate a Client Secret and copy it immediately. It will not be shown again.

    4. Add credentials in Scalekit

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

      • Enter the credentials you copied:

        • Client ID

        • Client Secret

        • Scopes — select the scopes your agent needs. Common scopes:

          ScopeWhat it grants
          identifyRead basic user profile (username, avatar, discriminator)
          emailRead the user’s email address
          guildsList the guilds the user belongs to
          guilds.members.readRead the user’s member data within a guild
          connectionsRead third-party accounts linked to the user’s Discord profile
          openidUse Discord as an OpenID Connect provider
          applications.entitlementsRead premium entitlements for your application

      • Click Save.

    5. Configure the bot scope (optional)

      If your agent needs to act as a bot in a server — sending messages, managing channels, or reacting to events — include the bot scope when you request authorization. Discord then asks the installing user to also grant a set of bot permissions.

      • In the Scalekit connection settings, set:

        • Bot Permissions — a bitfield describing what your bot can do in the server. Use the permissions calculator on your application’s Bot page to generate this value, or use the recommended default 2260657982483703 for common read/write access.
        • Pre-selected Guild ID — optional. Pre-fills Discord’s server picker with a specific server ID during authorization.
        • Disable Guild Select — optional. When enabled with a Pre-selected Guild ID, the user cannot pick a different server.
        • Installation Context — optional. Controls whether applications.commands installs to a server or to the authorizing user’s account.

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

  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 = 'discord'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Discord:', 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: 'discord_get_openid_connect_userinfo',
    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
  • discord_get_application_command_permissionsFetch permissions for a specific application command in a guild.Read-only

    Get Application Command Permissions

    Fetch permissions for a specific application command in a guild. Returns a guild application command permissions object.

    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.
  • discord_get_current_user_application_entitlementsRetrieves entitlements for the current user for a given application.Read-only

    Get Current User Application Entitlements

    Retrieves entitlements for the current user for a given application. Use when you need to check what premium offerings or subscriptions the authenticated user has access to. Requires the applications.entitlements OAuth2 scope.

    Inputs

    application_idstringrequired
    The ID of the application to retrieve entitlements for.
    afterstring
    Retrieve entitlements after this entitlement ID (for pagination).
    beforestring
    Retrieve entitlements before this entitlement ID (for pagination).
    exclude_deletedboolean
    Whether to exclude deleted entitlements.
    exclude_endedboolean
    Whether to exclude ended entitlements.
    guild_idstring
    The ID of the guild to look up entitlements for.
    limitinteger
    Maximum number of entitlements to return (1–100).
    sku_idsstring
    Comma-delimited list of SKU IDs to check entitlements for.
    user_idstring
    The ID of the user to look up entitlements for.
  • discord_get_current_user_application_role_connectionReturns the application role connection for the current user and the given application.Read-only

    Get Current User Application Role Connection

    Returns the application role connection for the current user and the given application. Requires an OAuth2 access token with the role_connections.write scope for the application specified in the path.

    Inputs

    application_idstringrequired
    The ID of the application to get the role connection for.
  • discord_get_entitlementRetrieve a single entitlement for an application by ID.Read-only

    Get Entitlement

    Retrieve a single entitlement for an application by ID. Use to check whether a specific entitlement is active, its type, and its expiration window. Per Discord's official OpenAPI spec, this endpoint also accepts an OAuth2 Bearer token with the `applications.entitlements` scope (in addition to Bot Token) — use this tool for user-authorized OAuth connections, or the equivalent discordbot_* tool for bot-token connections.

    Inputs

    application_idstringrequired
    The ID of the application that owns the entitlement.
    entitlement_idstringrequired
    The ID of the entitlement to retrieve.
  • discord_get_gatewayRetrieves a valid WebSocket (wss) URL for establishing a Gateway connection to Discord.Read-only

    Get Gateway

    Retrieves a valid WebSocket (wss) URL for establishing a Gateway connection to Discord. Use when you need to connect to the Discord Gateway for real-time events. No authentication required.

    Inputs

    This tool takes no inputs.

  • discord_get_guild_application_command_permissionsFetch permissions for all commands in a guild.Read-only

    Get Guild Application Command Permissions

    Fetch permissions for all commands in a guild. Returns an array of guild application command permissions objects. Per Discord's official OpenAPI spec, this endpoint also accepts an OAuth2 Bearer token with the `applications.commands.permissions.update` scope (in addition to Bot Token) — use this tool for user-authorized OAuth connections, or the equivalent discordbot_* tool for bot-token connections.

    Inputs

    application_idstringrequired
    The ID of the application.
    guild_idstringrequired
    The ID of the guild.
  • discord_get_guild_templateRetrieves information about a Discord guild template using its unique template code.Read-only

    Get Guild Template

    Retrieves information about a Discord guild template using its unique template code. Use when you need to get details about a guild template for creating new servers.

    Inputs

    template_codestringrequired
    The unique code of the guild template.
  • discord_get_guild_widgetRetrieves the guild widget in JSON format.Read-only

    Get Guild Widget

    Retrieves the guild widget in JSON format. Returns public information about a Discord guild's widget including online member count and invite URL. The widget must be enabled in the guild's server settings.

    Inputs

    guild_idstringrequired
    The ID of the Discord guild (server) to retrieve the widget for.

Workflows

Proxy API call
const user = await actions.request({
connectionName: 'discord',
identifier: 'user_123',
path: '/api/users/@me',
method: 'GET',
});
console.log(user);
Execute a tool
const result = await actions.executeTool({
connector: 'discord',
identifier: 'user_123',
toolName: 'discord_get_current_user_application_entitlements',
toolInput: {},
});
console.log(result);