All integrations

Discord Integration

How to Connect Discord to NIVA · Slash Command Integration Guide

15–20 minutesMedium8 steps

Connect NIVA to Discord via slash commands. Users type <code>/ask &lt;question&gt;</code> in any channel and your AI bot replies. NIVA uses Discord's Interactions Endpoint · a stateless webhook approach with Ed25519 signature security, no persistent connection needed.

Before you begin

  • NIVA botmaster account with a bot configured
  • Discord account with server management permission

Step-by-step setup

  1. 1

    Create a Discord Application

    • Go to https://discord.com/developers/applications
    • Click New Application
    • Enter a name (e.g. NIVA Bot) and click Create
    • From General Information, copy the Application ID and Public Key
  2. 2

    Add a Bot and Get Token

    • Left sidebar → BotAdd BotYes, do it!
    • Click Reset TokenYes, do it!
    • Copy the Bot Token shown
    • Under Privileged Gateway Intents, no special intents are needed for slash commands
    Bot token is shown only once. Keep it secure.
  3. 3

    Get Your Discord Server (Server) ID

    • Open the Discord app or web version
    • Click the ⚙️ User Settings icon
    • Go to Advanced
    • Enable Developer Mode
    • Right-click your Discord server in the left sidebar
    • Click Copy Server ID
    The copied Server ID is your Guild ID used for slash command registration.
  4. 4

    Configure in NIVA Botmaster

    • Open your NIVA botmaster → Omnichannel
    • Click Configure on the Discord card
    • Paste Application ID, Public Key, and Bot Token
    • Set Slash Command Name (default: ask)
    • Click Save & Activate
    • Copy the Webhook URL
  5. 5

    Set Interactions Endpoint URL

    • Back in Discord Developer Portal → General Information
    • Paste your NIVA Webhook URL into Interactions Endpoint URL
    • Click Save Changes
    • Discord will send a PING to verify · NIVA responds automatically
    If verification fails, ensure your server is publicly reachable via HTTPS.
  6. 6

    Create the Slash Command

    • Left sidebar → Slash CommandsNew Command
    • Set Name to ask (or your chosen command name)
    • Set Description to something like "Ask the AI bot a question"
    • Add an option: Name question, Type STRING, Required Yes
    • Click Save
  7. 7

    Invite the Bot to Your Server

    • Left sidebar → OAuth2URL Generator
    • Under Scopes, check bot and applications.commands
    • Under Bot Permissions check Send Messages
    • Copy the generated URL and open it in a browser
    • Select your server and click Authorize
  8. 8

    Test the Integration

    • Open Discord → go to any channel in your server
    • Type /ask · you should see the slash command appear
    • Fill in the question and send
    • Discord shows "Bot is thinking…" then your bot replies

Troubleshooting

Interactions URL verification fails
Server not reachable via HTTPS. Use ngrok for local dev.
401 on PING
Public Key copied wrong · re-check in General Information.
Slash command not visible
Wait up to 1 hour for global command propagation, or use guild-specific commands for instant testing.
Bot does not reply
Check Discord card shows Active in NIVA Omnichannel.