> For the complete documentation index, see [llms.txt](https://docs.convai.com/api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.convai.com/api-docs/plugins-and-integrations/other-integrations/discord/hosting-discord-bot-from-replit.md).

# Hosting Discord Bot from Replit

Successfully host a Discord Bot server connected with Convai API from Replit

### [Link to the Repl](https://replit.com/@Himadri-Sankar2/ConvaiDiscordIntegration?v=1)

Here are the steps listed to run the discord bot server from Replit successfully

### Steps:

1. Sign up to [Replit](https://replit.com/), then visit the link mentioned above to get to the published Repl.
2. Once you are on the page, click on **Fork Repl**.

   Click on **Fork Repl** again from the pop-up notification.

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FV1YumpobVXjpbghw9VVB%2Fdbhr-ss-1.png?alt=media&amp;token=aa8bb722-d206-47a4-a22c-675d48ef70d3" alt=""><figcaption></figcaption></figure>
3. This will create a fork of the code in your account. Once it has been forked successfully, it will open the code in the editor for you.

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FclmZoyy5xSQ4xLKvkin4%2Fdbhr-ss-2.png?alt=media&amp;token=3e8582c3-f022-4afa-af99-575bbbfbcd83" alt=""><figcaption></figcaption></figure>
4. Go over to **Secrets** in the bottom left corner of the screen.

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FqnkbJ5bsgiaM7WLVP7AU%2Fdbhr-ss-3.png?alt=media&amp;token=b3da6429-77b0-4cb4-8b7b-311d62202f83" alt=""><figcaption></figcaption></figure>
5. Now Add the following credentials. Copy the Keys directly from here to avoid any typos.

   1. Convai API Key Details:

      ```properties
      Key: CONVAI_API_KEY
      Value: <your unique API key from Convai>
      ```
   2. Convai Character ID:

      ```properties
      Key: CONVAI_CHARACTER_ID
      Value: <the unique ID of the character that you designed on Convai website>
      ```
   3. Allowed Channels:

      ```properties
      Key: ALLOWED_CHANNELS
      Value: <mention the name of the channels separated by ','. Example: 'chat-with-convaibot,interactive-avatars'>
      ```
   4. Discord Bot Details:

      ```properties
      Key: DISCORD_BOT_TOKEN
      Value: <the token generated while creating the discord bot>
      ```

   Note: ALLOWED\_CHANNELS restricts the bot to respond to only the channels mentioned in the list. This affects all the servers the bot has been invited to. For new server additions, you need to add the new list of allowed channels to the list. This might also require you to re-run the Repl.
6. After you have entered the details, it should look something like this

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FBU6cmAtCB45WMIW26Hr8%2Fdbhr-ss-5.png?alt=media&amp;token=54256b61-5b45-43e5-bc55-c1495d838744" alt=""><figcaption></figcaption></figure>
7. Then click on the **Run** button at the top to start the bot. Once you have the log, saying the bot has started, you are all done.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.convai.com/api-docs/plugins-and-integrations/other-integrations/discord/hosting-discord-bot-from-replit.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
