This guide explains how to create a Discord application that is restricted to your own Discord server (organization) and how to collect the required credentials to connect it with our Node.js Discord integration. The setup ensures the bot is private, not publicly distributed, and responds with private (ephemeral) messages using slash commands.Overview#
By default, Discord applications are private and not listed publicly. This setup ensures:The app is not publicly distributed
The bot can be installed only in your organization's server
Credentials remain private to your organization
Bot responses are visible only to the user who triggers them
You will create a Discord application, configure permissions, generate credentials, and connect them to our Node.js service.Prerequisites#
Before starting, make sure you have:Administrator permissions in your Discord server
Access to the Discord Developer Portal
Permission to install bots in your server
Step 1: Create a New Discord Application#
3.
Enter an application name (example: Python Expert)
4.
Check the box to agree to the Discord Developer Terms of Service and Developer Policy
Discord applications are private by default and are NOT publicly listed.
Step 2: Add a Bot User#
1.
In the left sidebar, click on Bot
2.
Click Add Bot (or Reset Token if the bot already exists)
3.
Click Yes, do it! to confirm
4.
You'll see your bot's username and a Reset Token button
Step 3: Get Your Bot Token#
1.
Click Reset Token (you may need to enter your 2FA code)
2.
Click Copy to copy the token
3.
Save this token securely - you'll need it for the .env file
Never share this token publicly - it gives full control of your bot. Store it securely and treat it like a password.
DISCORD_BOT_TOKEN=your_bot_token_here
Step 4: Enable Required Intents#
Still in the Bot section:1.
Scroll down to Privileged Gateway Intents
2.
Enable the following intents:SERVER MEMBERS INTENT (required for role-based permissions)
MESSAGE CONTENT INTENT (required to read message content)
These intents are required for your bot to receive events listed under GUILD_MEMBERS and message content in most messages.
1.
In the left sidebar, click on OAuth2 → URL Generator
3.
Under Bot Permissions, select:Read Messages/View Channels
Step 6: Invite the Bot to Your Server#
1.
Scroll down and copy the Generated URL
2.
Paste the URL in your browser
3.
Select the server where you want to add the bot
5.
Complete the CAPTCHA if prompted
The bot should now appear in your server (offline until you run it).
Step 7: Get Your Application ID (Optional)#
If you want to register slash commands for a specific server during development:Get Application ID#
1.
Go back to General Information in the left sidebar
3.
Save this for later (you'll use it as DISCORD_CLIENT_ID)
Get Server (Guild) ID#
2.
Go to User Settings → Advanced
4.
Right-click on your server icon
DISCORD_GUILD_ID=your_server_id_here
Troubleshooting#
If the bot doesn't appear online, verify your bot token is correct
Ensure both required intents are enabled in the Bot settings
Check that all required permissions are granted during bot invitation
Verify the bot has access to the channel where you're testing
Security Best Practices#
Never commit tokens to version control
Use environment variables or secure secret management
Regularly rotate tokens if exposed
Only grant minimum required permissions
Keep your bot private to your organization