Author picture Fikayo Adepoju Oreoluwa

How to Get Started with Discord Webhooks

Published


Discord is a digital platform that allows its users to engage in both voice and text-based conversations. Discord also gives users the power to share media and organize conversations into different channels based on privacy and the members involved. Some of the conversations in Discord involve external applications and services, thereby the ability to bring information from these external systems into Discord channels is of great service to its users. This is where Discord webhooks come in, as they are an HTTP-based communication technology that allows external applications to send information into Discord channels.

In this article, you will be introduced to Discord webhooks, what they do, how they operate, and how to set one up quickly. We will also look at an example use case and try to answer common questions developers ask when they start working with webhooks in Discord.

What do webhooks do in Discord?

You may have worked with webhooks on other providers like GitHub, Shopify, or CircleCI, or this may be your first time working with webhooks. In either case, it is first necessary to understand the role of webhooks in Discord, as the role of webhooks often varies from platform to platform.

Discord webhooks provide an easy way to get automated messages and data updates into a Discord channel. Simply put, an external source of information can use Discord webhooks to communicate its information into a Discord channel.

This helps enhance the quality of conversations in Discord, as more information can be brought in through integration with numerous external sources using the technology of Discord webhooks.

Let's say, for example, that a finance team uses Discord for conversations and would like to have their daily sales summary records posted to their Discord channel at the end of each business day. These records may reside in a custom accounting application or a payment/subscription management SaaS application, like Chargebee, that supports sending out information using webhooks. The team can then set up automated messages from these external sources to be posted to their Discord channel using Discord webhooks.

To receive an external message, a Discord webhook provides a webhook URL. The Discord webhook URL is an HTTP endpoint that can receive a payload using the POST request method. Any application that is capable of sending an HTTP POST message can send a payload of information to the Discord webhook URL.

The only compulsory property in a webhook payload is the content property, whose value is the textual message to be posted in the channel. Note that only text-based Discord channels support webhooks. Voice channels in Discord cannot use webhooks.

You can also upload files, embed objects, and add attachments to the message sent to the Discord channel.

For details on how to send a message into a Discord channel using a Discord webhook, click here.

Where can I find Discord webhooks?

Discord webhooks are a component of Discord servers. Thus, every webhook is scoped to a particular server and is connected to a channel that resides on that server. This helps you to organize your webhooks based on their purpose.

To find the webhooks that belong to a server, go to the server settings page by clicking the down arrow beside the server name to open the server's context menu, as shown below:

where to find discord webhooks

Click Server Settings and go to Integrations on the side menu. There, you can see your webhooks and create new webhooks.

discord webhook integrations

How do I add a webhook to Discord?

There are two ways to create a Discord webhook, either through the graphical user interface (web or app) or through the Discord API. The easiest way is through the user interface, and if you want to manage your Discord webhooks in automated workflows, this is the recommended way to add a webhook to Discord.

To add a webhook to your Discord server, follow the steps listed below:

  • Go to the Integrations page on your Discord server as described above and click Create Webhook
  • Give your webhook a descriptive name and select the channel you want your messages to be sent to
  • Remember to click Save Changes when you make any change to your webhook configuration

add new webhook integration in Discord

That's all! You now have a webhook added to your server in order to send messages to the channel you have selected. Click Copy Webhook URL to get your webhook URL and use it to send messages from external applications into your Discord channel.

If you wish to use the API to create and manage your Discord webhooks, you can check out this detailed tutorial.

Discord webhook example

Earlier on, we discussed an example use case for Discord webhooks involving a finance team keeping track of their daily sales information by posting the sales summary to their Discord channel. This is just one of the many use cases for Discord webhooks.

In this section, we will take a look at a common use case for Discord webhooks amongst application developers. Developers manage their code using version controls systems (VCS) like Git, and by collaborating with other developers through cloud remote repository providers like GitHub.

In a team setting, the developers on the team often push code to the same remote repository to update the codebase. If the team uses Discord for communication, it can be very useful to get real-time updates in the team's Discord channel when a developer pushes a new update to the codebase on GitHub. This is where Discord webhooks come in.

Through the following steps, the team can set up a communication channel between GitHub and Discord to receive updates in the team's Discord channel when a new update is pushed.

  • Create a Discord webhook on the team's server to send messages to the team's channel
  • Get the webhook URL for the webhook created
  • Use the webhook URL to create a webhook on GitHub and subscribe for the push event (the push event is triggered when a new commit is pushed to the GitHub repository)

With this setup, anytime a team member pushes code to the GitHub repository, a commit message is sent to the team's Discord channel. A typical GitHub commit message in a Discord channel is shown below:

receive notification in Discord

For a detailed tutorial on this use case, check out this article.

Discord webhooks Frequently Asked Questions

In this section, I have curated a few commonly asked questions about Discord webhooks. If your questions are not covered here, I encourage you to check out the official Discord webhooks introduction page and developer documentation.

QuestionAnswer
How do I link a webhook to Discord?If your external application supports sending outbound messages using webhooks (e.g. GitHub, Shopify, etc.), you can use the Discord webhook URL to set up a webhook on these platforms.
Are Discord webhooks free?As of the time of writing, Discord webhooks are completely free.
Are Discord webhooks POST or GET?POST
What is the message format for Discord webhooks?Details on Discord webhooks message format can be found here.
How do I view a Discord webhook?Go to Server Settings → Integrations to view and create webhooks.
How do I get my Channel ID?You first need to turn on Developer Mode at User Settings → Advanced. You can then right-click on your channel to copy the ID.
Can I create multiple webhooks on a Discord Channel?Yes, you can create multiple Discord webhooks that target the same channel.
Can I use a single webhook URL for more than one external application?Yes, you can use a single webhook URL to send more than one type of message to a Discord channel.
Can I attach files to my Discord webhook messages?Yes, you can send files in your Discord webhook messages; find out more details here.
How do I delete a webhook?You can delete a Discord webhook by using the Delete webhook button on the user interface or deleting it through an API call.
Where is the Discord webhooks API?Documentation for the Discord webhooks API can be found here.
Are webhooks supported in voice channels?As of the time of writing, Discord webhooks are only supported in text-based channels.

Conclusion

In this article, we have been able to dip our toes into the world of Discord webhooks. Discord webhooks provide a way for developers to extend the platform by integrating it with external applications. The integration process is so flexible that any application capable of sending an HTTP request can integrate with Discord. This gives multiple applications the ability to communicate with the platform, and helps users collaborate better.

Happy coding!