Discord Integration#

Connect your Discord bot to Outeract for automated messaging in servers, channels, and direct messages.

Overview#

PropertyValue
Platform TypeDISCORD
AuthenticationBot Token
Webhook TypeDedicated
Message Limit2000 characters

Prerequisites#

  • Discord account
  • Discord server (for testing)
  • Discord application created at discord.com/developers

Setup Guide#

Step 1: Create a Discord Application#

  1. Go to Discord Developer Portal
  2. Click New Application
  3. Enter an application name
  4. Click Create

Step 2: Create a Bot#

  1. In your application, go to Bot section
  2. Click Add Bot
  3. Confirm by clicking Yes, do it!
  4. Under Token, click Reset Token
  5. Copy and save the token securely
**Important**: You can only view the token once. If you lose it, you'll need to regenerate it.

Step 3: Configure Bot Settings#

In the Bot section:

SettingRecommended
Public BotOff (unless you want others to add it)
Requires OAuth2 Code GrantOff
Presence IntentOn (if needed)
Server Members IntentOn
Message Content IntentOn (required for reading messages)

Step 4: Set Bot Permissions#

  1. Go to OAuth2URL Generator
  2. Select scopes: bot, applications.commands
  3. Select bot permissions:
    • Send Messages
    • Read Message History
    • Attach Files
    • Embed Links
    • Add Reactions

Step 5: Add Bot to Server#

  1. Copy the generated OAuth2 URL
  2. Open in browser
  3. Select your server
  4. Authorize the bot

Step 6: Create Platform Connection#

mutation {
  createPlatformConnection(
    platformName: DISCORD
    name: "My Discord Bot"
    config: {
      bot_token: "your-bot-token"
      application_id: "your-application-id"
      public_key: "your-public-key"
    }
  ) {
    id
    webhookUrl
  }
}

Step 7: Configure Interactions Endpoint#

  1. In Discord Developer Portal, go to your application
  2. In General Information, set Interactions Endpoint URL to your webhook URL
  3. Discord will verify the endpoint

Supported Features#

Message Types#

TypeSendReceiveNotes
TextUp to 2000 characters
EmbedsRich formatted messages
FilesUp to 8MB (25MB with Nitro)
ImagesPNG, JPEG, GIF, WebP
ReactionsEmoji reactions

Capabilities#

  • Server channels (text channels)
  • Direct messages (DMs)
  • Threads
  • Embeds and rich formatting
  • File attachments

Sending Messages#

Basic Message#

mutation {
  sendMessage(
    platformConnectionId: "pc_discord_123"
    toExternalId: "123456789012345678"  # User or channel ID
    message: "Hello from Outeract!"
  ) {
    id
    status {
      success
    }
  }
}

Message with File#

mutation {
  sendMessage(
    platformConnectionId: "pc_discord_123"
    toExternalId: "123456789012345678"
    message: "Check out this file"
    fileIds: ["file_xyz789"]
  ) {
    id
  }
}

External ID Format#

Discord uses Snowflake IDs (18-19 digit numbers):

EntityExample
User123456789012345678
Channel987654321098765432
Server111222333444555666

Webhook Events#

Message Received#

{
  "event_id": "evt_abc123",
  "event_type": "message.inbound",
  "payload": {
    "message": {
      "text": "Hello!",
      "role": "user"
    },
    "platform": "discord"
  },
  "edges": {
    "sent_by": {
      "external_id": "123456789012345678"
    }
  }
}

Message Content Intent#

**Required**: Enable **Message Content Intent** in your bot settings, or you won't receive message content.

As of August 2022, Discord requires privileged intents for reading message content. Without it, message.content will be empty.

Troubleshooting#

“Bot token is invalid”#

  • Verify you copied the complete token
  • Check if token was regenerated
  • Ensure no extra whitespace

“Missing Permissions”#

  • Check bot role has required permissions
  • Ensure bot role is higher than managed roles
  • Verify channel-specific permission overrides

“Cannot send messages to this user”#

  • User has DMs disabled
  • User blocked the bot
  • No mutual servers

“Missing Access”#

  • Bot not in the server
  • Bot doesn’t have access to the channel
  • Check channel permission overwrites

“Message content empty”#

  • Enable Message Content Intent in bot settings
  • Re-authorize bot if intent was added after

Rate Limits#

Discord has various rate limits:

ScopeLimit
Per channel5 messages/5 seconds
Per user DM5 messages/5 seconds
GlobalVaries by endpoint

Outeract handles rate limits automatically with retries.

Security#

Outeract validates Discord interactions using Ed25519 signatures:

  1. Extracts signature and timestamp from headers
  2. Verifies signature using your application’s public key
  3. Rejects requests with invalid signatures

Resources#