---
title: "Discord"
description: "Interact with your agent through Discord"
---

You can create a Discord application and connect your IronClaw agent to it. Once configured, you can talk to your agent in direct messages or add it to a group chat so it can participate there.

<Note>
If you haven't set up your agent yet, follow our [Quickstart guide](../quickstart)
</Note>

---

## Set up the Discord channel

<Steps>

<Step title="Create a new application">

In order to create a new Discord application, navigate to the [Developer Portal](https://discord.com/developers/applications).

<Steps>
    <Step title="New Application">
      Click on the "New Application" button, give it a name (e.g. IronClaw), and click "Create".
    </Step>
    <Step title="Get your bot token">
    Navigate to the "Bot" tab on the left sidebar, under the "Token" section click on "Reset Token" and copy the token that is generated. You will need this token to connect your Discord application to IronClaw.
    </Step>
</Steps>

</Step>
<Step title="Configure the Discord channel in IronClaw">

    Invoke the IronClaw CLI onboard wizard using the `--channels-only` flag to configure only the channels without going through the entire onboarding process again:

    ```
    ironclaw onboard --channels-only
    ```

    <Steps>
        <Step title="Config the Tunnel">
            If you have not setup a `Tunnel` yet, the wizard will ask you to choose a tunnel provider and set it up. We recommend using [ngrok](https://dashboard.ngrok.com/) for its ease of use and reliability.

            ![ngrok setup](/images/channels/tunnel.png)
        </Step>
        <Step title="Install the Discord channel">
        Select the Discord channel from the list of available channels to install it.
        </Step>
        <Step title="Add your bot token">
            Enter the bot token from the `"Bot"` tab in the [Discord Developer Portal](https://discord.com/developers/applications), and the public key from the `"General Information"` tab.
        </Step>
    </Steps>
</Step>
<Step title="Start IronClaw">
    Start the `ironclaw` agent:

    ```
    ironclaw
    ```
</Step>

<Step title="Add the bot to your Discord server">

  Discord does not allow to message bots directly, so you will first need to add it to a server you are part of, and then you can DM the bot from there.

  Generate an invite URL in the "OAuth" section of the [Discord Developer Portal](https://discord.com/developers/applications) with the following `scopes` enabled:

    - bot
    - applications.commands

  Then select - at minimum - the following `Bot Permissions`:

      - View Channels
      - Send Messages
      - Read Message History
      - Add Reactions

  Copy the generated URL at the bottom, paste it into your browser, select your server, and click Continue to connect. You should now see your bot in the Discord server.

</Step>

<Step title="Enable mentions in group chats">
  In order to be able to trigger the bot in group chats, you need to edit the `.ironclaw/channels/discord.capabilities.json` file and add the `channel ID` of the channel where you want the bot to be active to the `mention_channel_ids` list.
  
  <Tip>
  To get the channel ID, **enable Developer Mode** in your **Discord settings**, right-click on the channel where you want the bot to be active, and click "Copy ID".
  </Tip>
</Step>

<Step title="Direct Messaging">
  Now that you share a server with the bot, you can send it a direct message. Click on its name in the member list and send them a direct message. The bot will reply with a pairing command that you need to execute in the terminal to complete the pairing process and start chatting with your agent.
</Step>

</Steps>

