Skip to main content

Create a Discord Bot

Creating a Bot

In order to send an email, you have to provide your bot token to the robot. To do this in a secure way, we created a vault system that works much like online password managers' security mechanisms. To learn more about Vaults please go to this guide.

  1. Go to Discord Web and log in.

  2. Navigate to the application page.

  3. On the top right, click the New Application.

New Application

  1. Give a name to your application then create your application.

Create Bot

  1. On the left menu, click Bot then click Add Bot

  2. Click Reset Token and copy the new token by using Copy button. We will need this token later as an API Key/Token vault item. For more information about creating vault items see here

  3. On the left menu, click Oauth2 and go to URL Generator.

  4. In Scopes, choose bot and bot permissions will be disappear scroll down and give permissions that you want to use. In this tutorial, we will use send message.

  5. After this, url will be generated at the end of page, copy it then go to the url to choose the server that you want to add bot.

  6. Click continue then click authorize. That's it, you added your bot to your server.

Sending Messages to a Discord Channel

  1. Create a new project from Flow Designer

  2. Follow the vault guide and create a new vault if you did not create a vault before.

  3. Open your vault ( in this example the previously created vault's name is Sample Vault )

Sample Vault

  1. Click "Create Item" and then "API Key/Token"

Create Vault Item

  1. Give a name to your Vault Item

Vault Item Naming

  1. Fill the value section with your bot token, then press SAVE.

  2. You need to install Discord Bot package for using this package in your flow, to learn how to install a package see here.

  3. Create the following flow by drag-and-dropping the nodes from the node palette, or by right clicking on the empty board. You can search the nodes by name.

Flow

  • Below is the list of nodes used in this flow:
  • Trigger -> Inject
  • Discord Bot -> Connect
  • Discord Bot -> Send Channel Message
  • Discord Bot -> Send Disconnect
  • Flow -> Stop
  1. Click Connect node and select your newly created vault item.

Flow

  1. Click Send Channel Message node and fill out Channel Id and Message Text. To learn channel id go to discord and right click to channel that you want to send message then click copy id.

Discord Channel Id

note

If you are not able to see the copy id, you may need to switch to developer mode from Discord settings.

  1. Run the flow.

Result