Because some Discord chats include other programs and services, the ability to pull data from these systems into Discord channels is quite helpful to its users. Discord webhooks are an HTTP-based communication protocol that enables other apps to transmit data into Discord conversations.
In this post, you’ll learn about what are webhooks on Discord, how they work, and how to create one quickly.
What Do You Need to Use Webhooks on Discord?
Webhooks on Discord are typically used to push notifications. These notifications are delivered to a text channel as messages, updates, or any other type of information. All of this can be automated with the correct implementation. This form of automation can make admins’ and moderators’ lives a little simpler.
However, not all websites or applications are compatible with Discord’s webhooks. Some may be extremely simple to accomplish, while others may necessitate some programming experience.
To assist you in determining which websites are supported, below is a list compiled from Discord’s official webhooks support post:
Support Discord webhooks:
Don’t support webhooks:
Creating Discord webhooks is a straightforward process. The fundamental requirements are as follows:
- Having a Discord account
- Having a Discord server or administrator permission.
How to Make a Discord Webhook
A Discord webhook may be created in two ways: via the graphical user interface (web or app) or using the Discord API. The user interface is the simplest way to create a webhook to Discord, and it is the preferred method if you wish to manage your Discord webhooks in automated processes.
Follow the steps below to add a webhook to your Discord server:
Sign in to your Discord account using a computer or the Discord app. Select the Create a server option and give the server a proper name.
Navigate to Server Settings (click on your server name in the top-left). Select the Integrations tab from the drop-down menu.
The webhook can be found under the Integrations section of your Discord server. You may do this by selecting the Create Webhook option.
Edit the Discord Webhooks Integration.
You may adjust your Discord Webhooks Integration as follows :
Modify the Avatar: At the upper left, click on the Discord Webhooks avatar next to the Name to change its details.
Select a Publishing Channel: Choose the appropriate text channel from the drop-down menu To publish your Discord Webhooks.
Name your Webhook: Naming is essential for recognizing several Discord Webhooks established for various services.
Finally, Click Copy Webhook URL button. Remember to click Save Changes when you modify your webhook configuration.
You now have a ready webhook for your server. It’s time to use the URL in GitHub to put it into action.
You’ll need to go to your GitHub repository to do so.
Navigate to Server Settings and then to the Webhooks tab.
The Add webhook button can be found here.
Check that you still have the correct webhook URL copied, then enter it into the Payload URL field. Select application/json as the content type. Leave SSL verification untouched.
Under that, make sure you’ve selected Just the push event.
When you’ve completed all necessary information, click Add Webhook.
That’s all! Every time you update your repository, a notification will be sent to your Discord server.
Webhooks Key Features
Webhooks are a utility that allows you to send messages to text channels without using the Discord program. You can also update or delete messages sent via the webhook directly. This feature can be accessed via two structures: Webhook and WebhookClient. WebhookClient is an enhanced version of a Webhook that allows you to send messages without the use of a bot client.
Webhooks are popular in the industry due to the following features:
To use Webhooks, all you need is their URL and a website to which the Webhooks will be linked. Webhooks, unlike conventional bots, are hosted on Discord. This typically saves you the trouble of having to make a financial investment in order to utilize them.
Webhooks enable numerous sorts of automation backed by other services, as well as the ability to deliver clear messages manually. These functionalities support a variety of use cases, such as providing updates, logging, writing custom messages for aesthetic reasons, and so on.
You may give each of your Webhooks a unique name and picture. Furthermore, each message delivered by these Webhooks might be distinct. You may have many Webhooks on various channels that you can utilize as needed.
How to Use a Discord Webhook
You may have used webhooks before on other platforms such as GitHub, Shopify, or CircleCI, or this may be your first time. In either scenario, understanding the role of webhooks in Discord is needed, as the role of webhooks differs from platform to platform.
Discord webhooks make it simple to receive automated messages and data changes in a Discord channel. Simply put, Discord webhooks allow an external source of information to communicate with a Discord channel.
This improves the quality of Discord conversations by allowing more information to be brought in via integration with a variety of other sources via the Discord webhooks technology.
For example, a finance team utilizes Discord for communication and would like their daily sales summary records to be posted to their Discord channel at the closing of each business day. These records could be in a custom accounting program or a payment/subscription management SaaS solution, such as Chargebee, enabling sending information out via webhooks. Using Discord webhooks, the team may set up automated messages from various external sources to be posted to their Discord channel.
A Discord webhook gives a webhook URL to receive an external message. Discord’s webhook URL is an HTTP endpoint that accepts data via the POST request method. A payload of information can be sent to the Discord webhook URL by any program capable of delivering an HTTP POST message.
The sole required property in a webhook payload is the content property, whose value is the textual message to be posted on the channel. It’s worth noting that webhooks are only available in text-based Discord channels. Webhooks are not supported in Discord voice channels.
You can also attach files, insert objects, and upload files to the Discord channel message.
Example of Discord Webhook
Previously, we provided an example Discord webhooks use case involving a finance team maintaining track of their daily sales statistics by uploading the sales summary to their Discord channel. This is only one of several Discord webhook applications.
This section will explore a frequent application developer use case for Discord webhooks. Developers use version control systems (VCS) such as Git to manage their work, and they collaborate with other developers via cloud remote repository providers such as GitHub.
When working in a team, the developers frequently push code to the same remote repository to keep the codebase up to date. If the team communicates using Discord, receiving real-time information in the team’s Discord channel when a developer makes a new update to the codebase on GitHub might be pretty valuable. Here’s when Discord webhooks come in handy.
The team can establish a communication channel between GitHub and Discord using the procedures below to get updates in the team’s Discord channel whenever a new update is pushed.
Make a Discord webhook on the team’s server to transmit messages to the team’s channel.
Obtain the webhook URL for the newly established webhook.
Create a webhook with the webhook URL and subscribe to the push event – the push event occurs when a new commit is pushed to the GitHub repository.
When a team member contributes code to the GitHub repository using this configuration, a commit message is issued to the team’s Discord channel.
Webhooks can send messages to text channels and retrieve, edit, and delete their own messages. These methods apply to both Webhook and WebhookClient.
Webhooks, like bots, can send up to ten embeds per message. They can also transmit attachments as well as regular content. The method used to send to a webhook, Webhook#send(), is quite similar to sending to a text channel. Webhooks can also specify how the username and avatar will appear when the message is sent.
Webhook#fetchMessage() can be used to retrieve messages previously sent by the Webhook.
To edit messages previously sent by the Webhook, use Webhook#editMessage().
To erase messages previously sent by the Webhook, use Webhook#deleteMessage().