Skip to main content
Integrations

Discord

Connect the agent to Discord through the interactions endpoint, to answer slash commands and components.

Discord

The Discord integration lets the agent answer slash commands and message components in Discord servers, through the interactions endpoint.

Reach it through the Settings icon → Integrations tab → the Discord card.


Turning the integration on

Turn on the toggle in the Discord card. The configuration fields appear once it is on.


How it works

  1. A user runs a command (a slash command or a button) in a server where the bot is installed.
  2. Discord sends the interaction to Roberty's public endpoint.
  3. Roberty validates the Ed25519 signature with the application's public key.
  4. The agent runs and the answer comes back in the same request.
info

This integration does not use the WebSocket gateway; it works only with the HTTP interactions model. That keeps the operation simple (no live connection to hold open) but limits it to commands and components — messages in ordinary channels are not processed.


The configuration fields

FieldRequiredWhat it is
Bot TokenYesThe token from the Bot tab in the Discord Developer Portal
Public KeyYesThe application's public key, from the General Information tab
Guild IDNoRestricts the bot to a single server (the Discord server's ID)
Channel IDNoRestricts the bot to a single channel within that server

Creating the bot in the Discord Developer Portal

1. Create the application

  1. Go to the Discord Developer Portal and create a new application.
  2. On the Bot tab, click Reset Token and note the value (shown once) — that is the Bot Token.
  3. On the General Information tab, copy the Public Key and the Application ID.

2. Configure the interactions endpoint

On the application's General Information tab, set Interactions Endpoint URL to:

https://agent-backend.roberty.app/integrations/discord/<AGENT_ID>

Replace <AGENT_ID> with the ID of the Roberty agent that will receive the interactions — use Copy ID at the top of the Integrations tab.

On save, Discord sends a PING and requires a valid answer; Roberty's endpoint already answers correctly, as long as the public key is configured on the agent.

3. Configure the agent in Roberty

Fill in Bot Token, Public Key and, optionally, Guild ID and Channel ID to restrict the bot.

4. Add the bot to the server

  1. In the Discord portal, go to OAuth2 → URL Generator.
  2. Tick the bot applications.commands scope and the permissions you want.
  3. Open the generated URL and pick the server.

5. Register the slash commands

Register them through Discord's API (with curl, for example):

bash
curl -X POST \
-H "Authorization: Bot YOUR_BOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"ask","description":"Ask the agent","options":[{"type":3,"name":"message","description":"Your question","required":true}]}' \
"https://discord.com/api/v10/applications/APPLICATION_ID/commands"

Roberty takes the value of the first text parameter (type 3) as the agent's input.


Security validation

Every request must carry:

  • X-Signature-Ed25519
  • X-Signature-Timestamp

Roberty checks the signature with the agent's publicKey and answers 401 Invalid signature if it does not hold.


The interaction types it handles

TypeWhat happens
1 PINGAnswered { type: 1 } automatically.
2 APPLICATION_COMMANDRuns the agent with the first text parameter.
3 MESSAGE_COMPONENTRuns the agent using the custom_id as the input.

The agent's answer is truncated at 2000 characters (Discord's limit for a single message).


References