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.
Go to Discord Web and log in.
Navigate to the application page.
On the top right, click the New Application.
- Give a name to your application then create your application.
On the left menu, click Bot then click Add Bot
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
On the left menu, click Oauth2 and go to URL Generator.
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.
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.
Click continue then click authorize. That's it, you added your bot to your server.
Sending Messages to a Discord Channel
Create a new project from Flow Designer
Follow the vault guide and create a new vault if you did not create a vault before.
Open your vault ( in this example the previously created vault's name is Sample Vault )
- Click "Create Item" and then "API Key/Token"
- Give a name to your Vault Item
Fill the value section with your bot token, then press SAVE.
You need to install Discord Bot package for using this package in your flow, to learn how to install a package see here.
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.
- 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
- Click Connect node and select your newly created vault item.
- 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.
If you are not able to see the copy id, you may need to switch to developer mode from Discord settings.
- Run the flow.