Getting Started

Discord Integration Setup Guide

Published · Last updated

Super Speedy Chat supports instant bidirectional Discord integration. Visitor messages appear in Discord threads immediately, and admin replies in Discord are relayed back to the WordPress chat in real-time.

How It Works

  • WordPress to Discord: When a visitor sends a message, it’s pushed instantly to a Discord thread via the bot API. Each conversation gets its own thread in a designated channel.
  • Discord to WordPress: A companion Node.js bot listens on the Discord Gateway. When someone replies in a thread, the bot relays the message to a WordPress REST endpoint, where it appears in the conversation.

Authentication between the bot and WordPress uses a shared webhook secret sent via the X-SSC-Secret header.


Prerequisites

  • A Discord account with permission to create bots
  • A Discord server (guild) where you want chat threads to appear
  • Node.js 18+ installed on the server that will run the companion bot (can be the same server as WordPress, or a separate one)
  • Super Speedy Chat plugin activated on your WordPress site

Step 1: Create a Discord Bot

  1. Go to the Discord Developer Portal
  2. Click New Application, give it a name (e.g. “Site Chat”), and click Create
  3. Go to the Bot section in the left sidebar
  4. Click Reset Token and copy the bot token – you’ll need this for both WordPress settings and the companion bot. Store it securely; you won’t be able to see it again.
  5. Under Privileged Gateway Intents, enable:
    • Message Content Intent (required so the bot can read message content in threads)
  6. Click Save Changes
Common mistake

Forgetting Message Content Intent is the single most common setup failure. Without it the bot connects and even starts cleanly, but every reply you type in Discord arrives at the bot as empty text and never reaches the visitor. If replies silently vanish, check this first.

Step 2: Invite the Bot to Your Server

  1. In the Developer Portal, go to OAuth2 > URL Generator
  2. Under Scopes, select bot
  3. Under Bot Permissions, select:
    • Send Messages
    • Send Messages in Threads
    • Create Public Threads
    • Read Message History
    • View Channels
  4. Copy the generated URL and open it in your browser
  5. Select your server from the dropdown and click Authorize

Step 3: Get the Channel ID

  1. In Discord, open User Settings > Advanced and enable Developer Mode
  2. Right-click the channel where you want chat threads to appear
  3. Click Copy Channel ID

Step 4: Configure WordPress Settings

  1. In wp-admin, go to Super Speedy Chat > Settings (or the chat admin page)
  2. Click the Discord tab
  3. Fill in:
    • Enable Discord: Check this box
    • Bot Token: Paste the token from Step 1
    • Channel ID: Paste the channel ID from Step 3
  4. Click Save Changes
  5. After saving, the page will show:
    • Webhook Secret: An auto-generated secret (you’ll need this for the bot)
    • Endpoint URL: The REST endpoint URL (e.g. https://yoursite.com/wp-json/ssc/v1/discord/incoming)
  6. Click Test Connection. Checks 1 to 9 cover the WordPress to Discord direction and pass straight away; check 10 passes once the companion bot from Step 5 is running. See Testing the connection for what each check means.
Note

At this point the WordPress to Discord direction already works: visitor messages will start opening threads in your channel. The companion bot in Step 5 only adds the Discord to WordPress direction so your replies flow back. Until then, reply from the wp-admin inbox.

Step 5: Set Up the Companion Bot

The companion bot is a small Node.js application included in the plugin at bot/. The steps below are for Linux. On a Windows server, follow Discord Companion Bot on Windows instead.

Copy the bot to its own folder outside your web root before running it, never inside wp-content/plugins/super-speedy-chat/bot/. The bot’s .env file holds your Discord bot token and webhook secret, and nothing under your web root is guaranteed to stay private: a misconfigured server, a directory listing or a path traversal bug can expose it. A plugin update also replaces the whole plugin folder, deleting your .env and node_modules. /opt/ssc-discord-bot/ is a good location; /home/youruser/ssc-discord-bot/ or /srv/ssc-discord-bot/ work equally well, as long as the folder is not under /var/www/, public_html/ or htdocs/.

1. Copy the bot to a location outside your web root:

sudo mkdir -p /opt/ssc-discord-bot
sudo cp -r /var/www/yoursite/wp-content/plugins/super-speedy-chat/bot/. /opt/ssc-discord-bot/
sudo chown -R www-data:www-data /opt/ssc-discord-bot
cd /opt/ssc-discord-bot

2. Install dependencies:

npm install

3. Create the environment file by renaming the template:

mv env-example .env

4. Edit .env and replace the four placeholder values with the ones from the previous steps. If your folder had no env-example, create .env with exactly this content:

# Discord Bot Token (from Discord Developer Portal > Bot > Token)
DISCORD_BOT_TOKEN=your_discord_bot_token_here

# Discord Channel ID (right-click channel > Copy Channel ID)
DISCORD_CHANNEL_ID=your_channel_id_here

# WordPress REST endpoint URL (from Super Speedy Chat > Discord > Bot Connection Info)
WP_ENDPOINT_URL=https://your-site.com/wp-json/ssc/v1/discord/incoming

# Webhook Secret (from Super Speedy Chat > Discord > Bot Connection Info)
WP_WEBHOOK_SECRET=your_webhook_secret_here

5. Restrict permissions on the .env file so only the bot process owner can read it:

chmod 600 /opt/ssc-discord-bot/.env

6. Start the bot:

npm start

You should see [SSC Bot] Logged in as ... confirming the bot has connected to Discord.

Step 6: Keep the Bot Running (Production)

For production use, you’ll want the bot to run persistently. Here are some options:

Using PM2 (recommended)

npm install -g pm2
cd /opt/ssc-discord-bot
pm2 start discord-bot.js --name ssc-discord
pm2 save
pm2 startup  # follow the instructions to auto-start on reboot

Using systemd

Create /etc/systemd/system/ssc-discord-bot.service:

[Unit]
Description=Super Speedy Chat Discord Bot
After=network.target

[Service]
Type=simple
User=www-data
WorkingDirectory=/opt/ssc-discord-bot
ExecStart=/usr/bin/node discord-bot.js
Restart=on-failure
RestartSec=5
EnvironmentFile=/opt/ssc-discord-bot/.env

[Install]
WantedBy=multi-user.target

Then:

sudo systemctl enable ssc-discord-bot
sudo systemctl start ssc-discord-bot

Testing the connection

The full Test Connection needs Super Speedy Chat 1.17.0 and companion bot 1.1.0 or newer.

Click Test Connection on the Discord tab. It runs every check below and marks each one passed, failed (with Discord’s own error text), a warning, or not run when it needs an earlier check to pass. A failed check never stops the others, so one run shows everything that needs fixing.

The test posts “Super Speedy Chat connection test from your site. Safe to ignore.” in your channel and starts a thread from it. Delete them afterwards if you like.

#CheckIf it does not pass
1Discord is enabledA warning only: tick Enable Discord and save. The other checks still run, so you can fix everything before switching it on.
2Bot token and channel ID are filled inFill in the empty field and save.
3Bot token is valid401: Unauthorized: reset the token in the Developer Portal (Step 1) and paste it again.
4Bot can see the channelUnknown Channel: the ID is wrong, copy it again (Step 3). Missing Access: the bot is not in the server or cannot view the channel (Step 2). “is a forum channel” (or voice, category): use a normal text channel.
5Bot can post in the channelMissing Permissions: give the bot Send Messages in that channel.
6Bot can start a threadMissing Permissions: give the bot Create Public Threads.
7Bot can post in the threadGive the bot Send Messages in Threads.
8Visitor messages are forwarded right nowA warning: you are outside opening hours with Discord forwards paused while away, or today’s channel forwarding limit is reached.
9No failed sends to DiscordA warning showing when the last real send failed and Discord’s error.
10Companion bot answersThe bot is not running, its DISCORD_CHANNEL_ID is a different channel, it cannot reach WP_ENDPOINT_URL, or its discord-bot.js is older than 1.1.0: copy in the latest discord-bot.js and package.json and restart it. A wrong WP_WEBHOOK_SECRET is reported by name.
11Optional: a reply in Discord reaches your websiteNever a failure. Reply anything in the test thread within 60 seconds to check the full reply path. If check 10 passes but your reply never arrives, turn on Message Content Intent (Step 1).
Did you know?

Check 10 needs nobody at the keyboard. The companion bot recognises its own test message and answers your website, which proves it is running, watching the right channel and using the right secret.

How Conversations Appear in Discord

  • When a visitor starts a new conversation, a thread is created in your configured channel with the visitor’s name and page URL
  • Each visitor message appears in the thread immediately
  • Any reply you type in the Discord thread is relayed back to WordPress and appears in the visitor’s chat bubble
  • Thread names include the visitor’s display name for easy identification

Troubleshooting

Test Connection reports a failure

Each check names what failed and Discord’s own error. The table in Testing the connection gives the fix for each one.

Messages not appearing in Discord

  • Run Test Connection: checks 1 to 9 cover this direction
  • Confirm Enable Discord is checked in settings
  • Verify the bot has permissions to send messages and create threads in the target channel

Discord replies not reaching WordPress

  • Run Test Connection: check 10 shows whether the bot answers, and check 11 tests a real reply
  • Make sure the companion bot is running (pm2 status or systemctl status ssc-discord-bot)
  • Check the bot’s console output for errors
  • Verify the WP_ENDPOINT_URL in .env is correct and publicly accessible
  • Verify the WP_WEBHOOK_SECRET in .env matches the secret shown in WordPress settings
  • If your site is behind a firewall or basic auth, the bot won’t be able to reach the endpoint

Bot starts but doesn’t relay messages

  • Ensure Message Content Intent is enabled in the Discord Developer Portal (Step 1.5)
  • Make sure the bot has Read Message History and View Channels permissions in the target channel
  • Check that messages are being sent in threads within the correct channel (not in the channel itself)

Thread not created for a conversation

  • The thread is created when the first visitor message is sent after Discord is enabled
  • Check the PHP error log for any Discord API errors
  • Verify the bot has Create Public Threads permission in the channel

Further reading

the feature overview and why you’d use it
keep the relay bot running reliably
the same setup on Windows with PowerShell
what visitors see agents called when you reply from Discord
disclose that conversation context is relayed to Discord

Comments

▲
▼
1/1