Skip to main content

Discord Bot

Kapa can be installed as a bot on your Discord server. The bot allows users to ask questions in natural language about your product which improves developer experience as developers can find answers to their questions faster. The bot is fully customizable and can be configured to respond in specific forum channels or to direct mentions.

Example Deployments

Check out the example deployments to see examples of how communities like NextJS, SST, and Astro use the kapa Discord bot to improve their developer experience.

Setup

The following steps are required to deploy kapa to your Discord workspace:

  1. Create a dedicated Discord channel for kapa (Optional)
  2. Create a Discord integration in the kapa platforn
  3. Configure your Discord integration
  4. Install the kapa Discord bot to your Discord
  5. Enable kapa from your Discord server with a bot command

1. Create a new Discord channel (Optional)

While this step is optional, we recommend creating a dedicated channel for kapa. Avoid adding kapa to an existing help channel to keep interactions clear. Users should be able to distinguish between channels where they can expect human responses and those where kapa provides answers. We suggest naming this channel #Ask-AI to help users easily identify its purpose.

Example Deployments

Take a look at example deployments to see how communities like NextJS, SST, and Astro use the kapa Discord bot to enhance their developer experience.

2. Create a Discord Integration

Go to the Integrations tab on the kapa platform and create a new integration. When deploying to Discord, you can choose between two types of integration:

  • Discord (Single Channel): Use this option to deploy kapa to a specific channel in your Discord server. This is ideal if you want kapa active in one channel or if you need different configurations for multiple channels.

  • Discord (Global Server): This option deploys kapa to all channels in your server with the same configuration. Choose this if you want kapa to be available across multiple channels, all with the same setup.

Using Both Integration Types

You can use both integration types in the same server. For example, you can have a default configuration for all channels while applying specific settings to a single channel. Specific configurations will always override the default.

Create a Discord Channel Integration

3. Configure Your Integration

Discord integrations offer several configuration options, some mandatory and some optional.

  • Guild ID: This is the unique identifier for your Discord server. You can find it under Server Settings > Widget > Server ID.

    Discord Server ID
  • Channel ID: This is the unique identifier for the Discord channel where you want to deploy kapa. Right-click on the channel and select Copy Channel ID to find it.

    Discord Channel ID
  • Enable forum auto-reply mode: You can configure kapa to either automatically respond to new posts in a Discord channel or wait until it is mentioned with @kapa. We recommend enabling auto-reply mode so kapa responds to every new message, as this avoids requiring users to tag the bot. Below are examples of both modes:

Kapa automatically replies to all new posts when auto-reply mode is enabled

Auto-Reply

Kapa needs to be tagged when auto-reply mode is disabled

Mention Mode

Additional configuration options are available by clicking the Advanced Configuration button. These options allow you to customize kapa's default texts and responses. You can use Discord formatting to make responses more engaging. For more details, check the Formatting Tips on the configuration screen.

Don't forget to click Save to apply your changes.

4. Install kapa Discord Bot to Your Server

Install the bot from this link to your server: Discord Bot Install Link

Discord Install

5. Enable kapa Discord bot via command

At this point, you've installed the Discord bot to your server and configured its behavior through the kapa platform. The final step is to enable your Integration using a bot command from your Discord server. This confirms to the kapa platform that you have the necessary authority over the Discord channels where you want kapa to respond.

To enable the bot, open the Discord channel where you want kapa to respond. If you're enabling a Single Channel integration, run the following command:

!kapa_enable_channel <integration_id>

For Global Server mode, run this command once from any channel in your server:

!kapa_enable_server <integration_id>

The <integration_id> is the ID of the integration you created in the kapa.ai app. You can find it by clicking the Copy Integration ID button in the integrations table. Enter the command in the message box and press Enter. The bot will confirm once the integration is successfully enabled.

Enabling a Discord integration
Visibility of Bot Commands

The bot command and the confirmation message will be visible to all users in the channel. Once the bot is enabled, you can delete both the command and the bot's response to keep the channel tidy.

6. Start Using kapa.ai

Kapa bot is now ready to help!

Troubleshooting

Kapa Not Responding To Any Messages

If you encounter any problems, such as the bot not responding, there could be several reasons:

  1. Private Threads Permission: The "Create Private Threads" permission might be turned off for the role of our bot.

    To adjust this setting:

    • Navigate to Server Settings > Roles > Bot Role
    • Scroll down to Permissions
    • Ensure the Create Private Threads permission is enabled for the bot role.
  2. Role Name Conflict: In some cases, Discord might auto-create a role with the "kapa.ai" name, which gets mentioned instead of the actual bot. This can cause confusion and prevent the bot from responding.

    To resolve this:

    • Go to Server Settings > Roles
    • Find the role named "kapa.ai"
    • Rename this role from "kapa.ai" to "bot-help". By renaming the role, conflicts between mentioning a role and the bot should be eliminated.
Discord Bot Role

Kapa Follows Up With "Sorry, I Seem To Be Having Trouble"

If Kapa follows up with a message that says "Sorry, I seem to be having trouble", it might be due to the bot lacking the permission to post messages with embeds. This is often indicated by an error message like discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions.

To resolve this:

  • Check if you have disabled the "Embed Links" permission.
  • If it's disabled, enable the "Embed Links" permission for the bot role.
Discord Sorry Error