# Discord (NEW)

{% embed url="<https://youtu.be/VjZhtKbDArc>" %}

To integrate Discord with your Voiceflow project, you will need to follow the same steps as shown in the [quick start](/documentation/getting-started/quickstart.md) section. In short, in the admin panel, you will need to:

1. Create a Client Company
2. Create a Voiceflow Project and associate the Voiceflow project to the Client Company
3. Create a Client Integration and associate the Client Company & Voiceflow Project to the integration

## Discord Bridge Server

To use Discord as an integration channel, we created a dedicated Bridge Application. This is because Discord does not operate through HTTP requests, but WebSockets. To enable communications between Discord and FlowBridge we need to have a server listening to all the changes on the discord server and forward them to your FlowBridge environment.&#x20;

You can read more on the repository: [https://github.com/FlowBridge/flowbridge-discord-bridge](https://github.com/FlowBridge/flowbridge-discord-bridge/releases/tag/v1.0.0)&#x20;

Or directly download the `flowbridge-discord-bridge` PHAR file on the releases page: [https://github.com/FlowBridge/flowbridge-discord-bridge/releases](https://github.com/FlowBridge/flowbridge-discord-bridge/releases/tag/v1.0.0)

The entire project is open source so you can tweak and adjust it to your personal needs!

#### Discord Bot Setup

1. Go to [Discord Developer Portal](https://discord.com/developers/applications)
2. Create a new application or select an existing one
3. Go to **Bot** section and create a bot
4. Copy the bot token to your \`.env\` file
5. Enable **Privileged Gateway Intents**:
   1. MESSAGE CONTENT INTENT
   2. SERVER MEMBERS INTENT
6. Go to **OAuth2 > URL Generator**:
   1. Select scopes: \`bot\`, \`applications.commands\`
   2. Select permissions: \`Send Messages\`, \`Read Message History\`, \`View Channels\`
7. Use the generated URL to invite the bot to your server

#### FlowBridge Setup

1. Login to your FlowBridge environment
2. Create a new integration and associate it with a Voiceflow Project and Client Company
3. Select "Discord" from the integration channels
4. Paste the Discord Bot Token from the previous step during the Discord Integration creation process
5. Click create
6. On the view integration page (which you automatically go to after creation), you see a button on the top right named "Integration Info"
   1. Within the popup, you can find the tenant URL and integration ID required inside the `.env` file

## Running the Discord Bridge

#### Docker Deployment through Docker Compose (Easiest)

You can use the Docker Hub hosted version of the bridge to easily host it somewhere. Below is docker hub repository, and an example `docker-compose.yml` file\
\
Save this as `docker-compose.yml`

```yaml
services:
  discord-bridge:
    image: michaelflowbridge/flowbridge-discord-bridge:1.0.0-amd64
    container_name: flowbridge-discord-bridge
    restart: unless-stopped
    environment:
      APP_NAME: "FlowBridge Discord Bridge"
      APP_ENV: production
      DISCORD_TOKEN: ""  # <-- fill this
      FLOWBRIDGE_TENANT_URL: "https://xxxxx.flowbridge.app" # <-- fill this
      FLOWBRIDGE_INTEGRATION_ID: ""  # <-- fill this
      FLOWBRIDGE_VERIFICATION_TOKEN: ""  # <-- fill this
      MESSAGE_CHANNELS: "both"
      MESSAGE_TRIGGER: "mentions_only"
      FLOWBRIDGE_WEBHOOK_RETRIES: 3

    volumes:
      - ./storage:/app/storage
```

Remember to fill in the environment variables as needed.

You can now use the docker compose command to run the server: `docker compose up`

#### Running through PHP directly

For information on the specifics of running the Discord Bridge, check out the README file located inside the `/builds` directory of the repository: <https://github.com/FlowBridge/flowbridge-discord-bridge/tree/main/builds>&#x20;

In short, you need to:

1. Download the `flowbridge-discord-bridge` file from the `./builds` directory OR from the [Releases page](https://github.com/FlowBridge/flowbridge-discord-bridge/releases)
2. You also need to download the `.env.example` file, rename it to `.env` and keep it within the same directory as the `flowbridge-discord-bridge` file.
3. Edit the values in `.env` to contain the discord bot token as well as the integration information of your flowbridge environment
4. Now, open a terminal, and run `php flowbridge-discord-bridge` (PHP must be installed on the device)
5. Your bot is now running as long as the flowbridge-discord-bridge server remains alive!

### Customizing the Discord Bridge

The discord Bridge application is fully open source. This means you can customize it completely to your needs. It is built on top of [Laracord](https://laracord.com/) a PHP based framework built on top of Laravel Zero built specifically for Discord Bot usage.&#x20;

If you want more information on the specifics on how to customize and build upon the bridge application, check out the [Laracord Documentation](https://laracord.com/docs/2.x/installation) at <https://laracord.com/>&#x20;


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flowbridge.app/documentation/social-integrations/discord-new.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
