Skip to content

Integrate with Discord

Connect your agent to a Discord bot to chat with it remotely.

Learning objectives

In this guide, you will learn how to:

  • Create a Discord bot and generate an API token.
  • Invite the bot to your Discord server with the required permissions.
  • Connect the bot to OpenClaw and configure channel access policies.
  • Pair your Discord account with the bot so you can chat with your agent.

Prerequisites

  • Discord account: Required to create the bot application.
  • Discord server: A server where you have permissions to add bots.

Step 1: Create a Discord bot

  1. Log in to the Discord Developer Portal with your Discord account.

  2. Click New Application.

    New application in Discord developer portal

  3. Enter a name for the new app, agree to terms, and then click Create.

    Create an application window

  4. From the left sidebar, select Bot.

  5. Scroll down to the Privileged Gateway Intents section and enable the following settings:

    • Presence Intent
    • Server Members Intent
    • Message Content Intent
  6. Click Save Changes.

  7. Scroll up to the Token section, click Reset Token, and then copy the generated token for your Discord bot. You need the token for channel configuration later in Control UI.

    Reset token

Step 2: Invite the bot to server

  1. From the left sidebar, select OAuth2, and then find the OAuth2 URL Generator section:

    a. In Scopes, select Bot and applications.commands.

    OAuth2 URL Generator

    b. Scroll down to Bot Permissions, set as the following image. You can modify the settings later.

    Bot permissions

  2. Copy the Generated URL at the bottom.

  3. Paste the URL into a new browser tab, select your Discord server from Add to server, click Continue, and then click Authorize.

    The bot is authorized and added to your server.

    Bot added to server

Step 3: Configure the channel

Run the OpenClaw configuration wizard to connect your Discord bot.

  1. Open the OpenClaw CLI.

  2. Run the following command to start the configuration wizard:

    bash
    openclaw configure --section channels
  3. Configure the settings as follows:

    SettingsOption
    Where will the Gateway runLocal (this machine)
    ChannelsConfigure/link
    Select a channelDiscord (Bot API)
    How do you want to provide this Discord bot tokenEnter Discord bot token
    Enter Discord bot tokenPaste the bot token from Step 1
    Configure Discord channels accessYes
    Discord channels accessOpen (allow all channels)
    Select a channelFinished
    Configure DM access policies now?
    (default: pairing)
    Yes
    Discord DM policyPairing (recommended)

Step 4: Authorize your account

For security, the bot does not talk to unauthorized users. You must pair your Discord account with the bot.

  1. Open Discord and send a Direct Message (DM) to your new bot. The bot will reply with an error message containing a Pairing Code.

  2. Open the OpenClaw CLI and enter the following command:

    bash
    openclaw pairing approve discord {Your-Pairing-Code}
  3. Once approved, you can start chatting with your agent in Discord.

Next steps