How to create a bot to discord

Many customers were asking me to develop an integration between Changelogfy and Discord, as we already had for Slack.

In case you didn't know it yet, Changelogfy is a tool developed by me for feedback gathering, roadmap planning, and changelog dissemination.

As I mentioned earlier, we already had the integration with Slack, so the plan was to do the same thing, this time for discord.

The integration works very simply, every time someone from the company publishes a new Changelog, the entire company receives an internal communication in discord about the update with the link for more details and so everyone stays updated.

So I started researching how integrations with discord worked, the first place I went to was the official documentation for developers of discord itself, which is very good by the way.

And to my pleasant surprise, the integration with Discord was much simpler than the Slack app system.

The first step is to create a webhook on your discord channel.

To do this, log into discord, go to server settings > integrations and click create webhook.

Discord Integrations

Choose a name for your integration, in this case, I used Changelogfy, if you want, you can also add an icon to make your integration more pleasant.

After that click on copy webhook URL.

Docker CTOP

Discord will provide you with a URL similar to the example below:

https://discord.com/api/webhooks/816324056313680788/L40eJVGgPoZ29KJG_74m3Ad13HRi1v9zqzdlZ-hk4xhoSM_YGazwLUmsLBpdkPhIYgJH

This will be your endpoint where we will send the HTTP POST request, in Changelogfy the JSON content below was enough.

{
    "content": null,
    "username": "Bot Name",
    "embeds": [
        {
            "title": "Title of your bot.",
            "description": "Description of your bot",
            "color": "37885" // hex color
        }
    ]
}

When executing the POST method, if all goes well, you will receive a message similar to what is in your discord channel.

Docker CTOP

Final considerations

The integration with discord is much smoother than with Slack, where I've had problems several times with app approval, updates to our app that take time to be approved, and so on.