Skip to main content

Discord Agent Integration

Introduction

Connect your ChatCrafterAI agent to Discord to communicate with your community members through this platform. This guide walks you through the complete setup process.

Prerequisites

Before connecting Discord to ChatCrafterAI, ensure you have:

Discord Account

A Discord account is required to create and manage agents. Create one at discord.com if you don’t have one.

Server Admin Access

You need administrator permissions on the Discord server where you want to add your agent. Create your own server or get admin access from an existing server owner.

Discord Developer Portal Access

All Discord users can access the Developer Portal to create agent applications. No special approval or business verification is required.

Setup Process

Step 1: Create Discord Application

  1. Navigate to Discord Developer Portal:
  2. Create New Application:
    • Click “New Application” button
    • Enter your agent name (e.g., “Support Agent”, “ChatCrafter Assistant”)
    • Accept Discord’s Terms of Service
    • Click “Create”
  3. Configure Application Settings:
    • Add description of what your agent does
    • Upload agent avatar image (optional)
    • Save changes

Step 2: Create Agent User

  1. Navigate to Agent Section:
    • Click “Agent” in the left sidebar
    • Click “Add Agent” button
    • Confirm by clicking “Yes, do it!”
  2. Configure Agent Settings:
    • Set agent username (can be different from application name)
    • Upload agent avatar (appears in Discord channels)
    • Enable “Public Agent” if you want others to invite it
    • Disable “Requires OAuth2 Code Grant” (unless you need it)
  3. Get Agent Token:
    • Under “Token” section, click “Reset Token”
    • Click “Copy” to copy your agent token
    • IMPORTANT: Save this token securely - it won’t be shown again
    • Never share this token publicly or commit it to version control
  4. Configure Privileged Gateway Intents:
    • Scroll down to “Privileged Gateway Intents”
    • Enable “Message Content Intent” (required for reading messages)
    • Enable “Server Members Intent” if you need member data
    • Save changes

Step 3: Set Agent Permissions

  1. Navigate to OAuth2 Section:
    • Click “OAuth2” in left sidebar
    • Click “URL Generator” sub-section
  2. Select Scopes:
    • Check “agent” scope
    • Check “applications.commands” (for slash commands)
  3. Select Agent Permissions:
    • Required permissions:
      • Read Messages/View Channels
      • Send Messages
      • Embed Links
      • Attach Files
    • Optional permissions:
      • Manage Messages (to delete agent’s own messages)
      • Read Message History
      • Add Reactions
  4. Generate Invite URL:
    • Copy the generated URL at the bottom
    • Save this URL - you’ll use it to invite the agent

Step 4: Invite Agent to Server

  1. Open Invite URL:
    • Paste the URL from Step 3 into your browser
    • Select the server where you want to add the agent
    • Click “Continue”
  2. Authorize Permissions:
    • Review the requested permissions
    • Click “Authorize”
    • Complete CAPTCHA if prompted
  3. Verify Agent Joined:
    • Open Discord and go to your server
    • Check the member list - your agent should appear (offline/gray status is normal until connected)

Step 5: Connect in ChatCrafterAI

  1. Navigate to Channels:
    • Log into ChatCrafterAI dashboard
    • Select your agent
    • Click “Channels” in sidebar
    • Choose “Discord”
  2. Enter Agent Token:
    • Paste your Discord agent token from Step 2
    • Verify no extra spaces are included
    • Click “Connect Discord”
  3. Verify Connection:
    • Wait for verification (5-10 seconds)
    • Confirmation message appears when successful
    • Your agent status in Discord should change to online (green)
  4. Activate Channel:
    • Toggle “Discord Channel” to “Active”
    • Your agent is now live on Discord

Step 6: Test the Integration

  1. Send Test Message:
    • Open Discord server where agent was added
    • Go to any channel where agent has permissions
    • Send a message mentioning the agent: @YourBotName hello
  2. Verify Agent Response:
    • Agent should respond within 1-2 seconds
    • Response should match your agent’s training
    • Check conversation flows naturally
  3. Test Commands:
    • Try slash commands if configured
    • Test different message types
    • Verify rich responses render correctly
  4. Check ChatCrafterAI Dashboard:
    • Return to ChatCrafterAI
    • Open “Conversations” view
    • Confirm test conversation appears
    • Review for accuracy

Available Features

Text Messages

Send and receive text messages in Discord channels or direct messages. Supports Discord’s markdown formatting for bold, italic, code blocks, and links.

Embed Messages

Create rich embedded messages with:
  • Title and description
  • Color-coded sidebar
  • Fields for structured information
  • Footer text and timestamps
  • Thumbnail and main images
  • Author information with icon

Buttons

Add interactive buttons to messages (up to 5 per row, 5 rows max). Buttons can:
  • Trigger specific agent responses
  • Open external URLs
  • Navigate conversation flows
  • Collect user choices

Select Menus

Dropdown menus for selecting options (up to 25 options). Useful for:
  • Category selection
  • Product browsing
  • Multi-option choices
  • Filtering content

Slash Commands

Register custom slash commands that appear in Discord’s command menu:
  • /help - Get agent assistance
  • /status - Check order status
  • /support - Contact support
  • Custom commands for your use case

File Attachments

Send images, PDFs, documents, and other files up to 8MB (or 50MB with Discord Nitro on the server).

Reactions

Add emoji reactions to messages for:
  • Quick feedback collection
  • Confirmation acknowledgments
  • Poll-style interactions

Direct Messages

Respond to users via DM for:
  • Private conversations
  • Sensitive information
  • One-on-one support

Common Setup Issues

Issue: “Invalid Token”

Symptoms: ChatCrafterAI rejects the agent token Solutions:
  • Return to Discord Developer Portal
  • Go to Agent section
  • Reset token and copy the new one
  • Ensure no spaces before/after token when pasting
  • Verify you copied the entire token string

Issue: “Agent Not Responding”

Symptoms: Agent appears online but doesn’t reply to messages Solutions:
  • Verify “Message Content Intent” is enabled in Developer Portal
  • Check agent has “Read Messages” permission in the channel
  • Ensure Discord channel is activated in ChatCrafterAI (toggle is “On”)
  • Test with @mention instead of regular message
  • Check ChatCrafterAI conversation logs to see if messages are received

Issue: “Agent Shows Offline”

Symptoms: Agent appears gray/offline in member list Solutions:
  • Verify agent token is correct in ChatCrafterAI
  • Check ChatCrafterAI connection status shows “Connected”
  • Disconnect and reconnect in ChatCrafterAI
  • Regenerate agent token in Discord and update in ChatCrafterAI

Issue: “Missing Permissions”

Symptoms: Agent can’t send messages or perform actions Solutions:
  • Check channel-specific permissions (right-click channel > Edit Channel > Permissions)
  • Verify agent role has required permissions
  • Move agent role higher in server role hierarchy
  • Re-invite agent with correct permissions using OAuth URL

Best Practices

Use Embeds for Rich Responses

Discord embeds make information easier to read and more visually appealing than plain text. Use them for:
  • Product information
  • Status updates
  • Help documentation
  • Structured data

Respond to Mentions

Configure your agent to respond when mentioned with @BotName. This helps users understand how to interact with it.

Use Slash Commands

Slash commands appear in Discord’s command menu, making them discoverable. Users can see available commands by typing /.

Keep Messages Concise

Discord users expect quick, scannable responses. Structure messages with:
  • Key information first
  • Bullet points for lists
  • Code blocks for technical content
  • Embeds for detailed data

Test Permissions

Before deploying to all channels:
  • Test in a private test channel first
  • Verify all features work correctly
  • Check permissions across different channel types
  • Test with different user roles

Next Steps

Your Discord integration is now live. To maximize effectiveness:
  • Explore Cross-Channel Features: Learn how Discord conversations integrate with other channels in Cross-Channel Conversation Management
  • Configure Slash Commands: Set up custom commands for your specific use case
  • Optimize Responses: Regularly review conversations and enhance your knowledge base
  • Monitor Performance: Track engagement and response times to identify improvements