Connect a Discord bot to the ChatHub inbox
Create a Discord application, get the bot token, enable the message content intent, invite the bot to your server, then add the Discord channel in ChatHub to receive and reply to messages in the shared inbox.
What this guide covers#
The ChatHub Discord channel receives direct messages sent to your bot and messages in the text channels of your servers, then lets staff reply from the shared inbox — with attachments, quoted replies, buttons, and message recall.
Unlike the other channels, Discord does not push messages over a webhook. ChatHub opens a persistent connection to Discord and keeps it alive, so the installation needs no public HTTPS domain: a server behind NAT or on an internal network still receives everything.
All Discord-side configuration happens in the Developer Portal and takes about ten minutes. You need administrator rights on the Discord server you want to connect, because inviting the bot requires the Manage Server permission.
1. Before you start#
- 1
A Discord account with a verified email, used to sign in to the Developer Portal at discord.com/developers/applications.
- 2
A Discord server where you hold the Manage Server permission. If you only want to try things out, create a new free server in the Discord app.
- 3
Administrator rights in ChatHub so you can open Channels and add an account.
2. Create the application and its bot#
- 1
Open discord.com/developers/applications and sign in to your Discord account.
- 2
Click New Application in the top right.
- 3
In the Create an application dialog, fill in the Name field — this becomes the bot name your customers see — tick the terms checkbox and click Create.
- 4
Discord may ask you to confirm you are not a robot; finish that check before the application is created.
- 5
In the left menu, open Bot. A new application already ships with a bot; this page is where you set its avatar and display name.
3. Get the bot token#
The bot token is this channel's only secret: anyone holding it can read and send messages in every server the bot is in. Discord shows a token exactly once, right after you reset it, so copy it and paste it straight into ChatHub.
- 1
Still on the Bot page, find the Token section and click Reset Token. Discord asks for confirmation and may request your two-factor code if it is enabled.
- 2
Copy the token that appears.
- 3
Paste it into ChatHub following step 6 below before you leave the page. If you close the page too early, simply reset the token again — the old one stops working at that moment.
- 4
If you want to be the only person who can invite the bot, turn off the Public Bot switch just below and save the change.
4. Enable the message content intent#
Discord treats message content as sensitive data, so by default a bot is told a message exists but cannot see the text. Without this step the channel still connects, but nothing reaches the inbox — and ChatHub reports exactly that reason.
- 1
On the Bot page, scroll down to Privileged Gateway Intents.
- 2
Turn on Message Content Intent.
- 3
Click Save Changes in the bar at the bottom of the page and wait for the confirmation that the bot was updated.
5. Invite the bot to your server#
A bot only reads the channels it is in and has permission for. This step builds an invite link that carries the minimum permission set.
- 1
In the left menu, open OAuth2 and scroll down to the OAuth2 URL Generator block.
- 2
Under Scopes, tick bot.
- 3
Under Bot Permissions, tick View Channels (General Permissions column) plus Send Messages, Attach Files and Read Message History (Text Permissions column).
- 4
Copy the link from the Generated URL box at the bottom, open it in a browser, pick the server and confirm the permissions.
- 5
Open Discord and check that the bot now appears in the server member list.
6. Add the Discord channel in ChatHub#
- 1
In ChatHub, go to Administration -> Channels and click Add account in the top right.
- 2
In the channel type column of the dialog, scroll to the bottom and select Discord.
- 3
Give the channel a memorable name, for example Community Discord — this name only appears inside ChatHub to tell channels of the same type apart.
- 4
Paste the bot token into the Bot token field. ChatHub checks the token shape immediately and reports an error if part of it is missing.
- 5
Click Create account. The channel dialog opens with the status Disconnected.
- 6
Click Connect. After a few seconds the status turns to Active, and the channel name and avatar are replaced by the bot's own name and picture.
7. Test it and fix common errors#
- 1
In Discord, post a message in a text channel the bot can see, or send the bot a direct message.
- 2
Open Messages in ChatHub: the new conversation appears with a Discord badge on the corner of the avatar.
- 3
Reply from ChatHub and check that the message lands in the right place in Discord.
When something goes wrong, ChatHub writes the cause on the channel card instead of a raw Discord code:
- 1
Discord rejected this bot token — the token was reset again, so the stored copy is dead. Get a new token and recreate the channel.
- 2
The bot is missing the message content intent — go back to step 4 and turn on Message Content Intent.
- 3
The bot has no permission in this channel — open the channel settings in Discord, go to Permissions, and grant its role the permissions listed in step 5.
- 4
This person does not accept direct messages from the bot — they must share a server with the bot and allow direct messages from server members in their Discord privacy settings.
8. Scope and limits worth knowing#
- 1
Group messages: the Sync group messages switch in the channel dialog decides whether server text channels reach the inbox at all. Turn it off and only direct messages remain. You can also exclude individual channels once they have sent their first message.
- 2
History sync: only messages in server text channels can be pulled, up to 200 messages per channel and 500 channels per run. Old direct messages cannot be pulled because Discord does not let a bot list its own inbox.
- 3
Long messages: Discord caps a message at 2,000 characters, so ChatHub splits a longer reply into consecutive messages.
- 4
Attachments: 25 MB on a server without boosts. Files customers send are copied into ChatHub storage on arrival, because Discord attachment links expire after about a day.
- 5
Mentions: messages ChatHub sends never trigger @everyone or @here, even when the text contains those words.
- 6
Messages from other bots and from webhooks stay out of the inbox, so two bots sitting in one channel cannot answer each other in a loop.
- 7
Discord has no read receipts for bots, so the inbox does not show whether a customer has seen a message.