As moderators work towards bringing improvements to our communities, you need to consider every tool available at your disposal. One great feature that is often overlooked by moderators is webhooks, which can prove to be incredibly powerful when implemented well, especially for server automation. In this article we will be introducing webhooks, exploring how they work, and how they compare to bots in addition to going over some of the best practices when utilizing webhooks in the context of moderation on Discord.
Before we begin, we highly recommend you check out the Intro to Webhooks article published by Discord.
A webhook is sort of a “reverse API”: rather than an application you own (like a bot) calling another application to receive data when it wants it, a webhook is something you can give to someone else's application to send data to you directly as soon as there’s something to share. This makes the process very convenient and efficient for both providers and users.
Now let’s apply this definition to a more tangible example. Let’s say you aren’t around to reply to new e-mails for a while. Through the power of webhooks you could have a setup that replies automatically! When an event happens on a service (like receiving an email), that service activates your webhook and sends you the data relevant to the event that happened. That way, you have exactly the information you need to automatically reply to each new e-mail you receive.
So what does this mean for your server? Basically, Discord provides you with the ability to have a webhook that sends a message to your server when it’s activated, with the option to send the message to any channel along with having a cool name and avatar of your choice.
For example, let’s say you’re waiting for the latest chapter of your favorite webcomic series to release. You can set up a webhook that’s connected with an RSS feed. The feed will activate the webhook when the chapter is released and a message will be posted on your server to notify you about it. This can be applied to many different things - the potential is limitless!
If the service is capable of sending JSON Webhooks, Discord can often use these to create visually appealing embeds when it sends a message out. However, it can also accept raw text messages to pass along as well.
Webhooks are a great tool for services that have events that you’re interested in latching onto. This can be incredibly useful for Content Creator communities where their latest YouTube videos or Twitter posts can be funneled into channels for followers to have easy viewing access in your Discord community. You could also use this for a community that’s oriented towards an open-source technology by having events from GitHub be submitted directly to your server for people to keep track of.
There are a lot of platforms out there that provide you with the ability to handle everything by yourself- from creating the Webhook through your Discord Server Settings to plugging it into the platform you want updates from. However, this often requires you to be more familiar with at least some level of programming as many of these platforms require developer accounts. There can be a few hoops to jump through to get everything set up just right. This can often turn people off from using these types of webhooks.
However, times are changing and the barrier to entry when dabbling into the world of webhooks is much lower. These days, multiple third-party services exist that have handled all the hard techy stuff for you. They can interface with the platforms that would normally require you to do extra work to get the data you want. IFTTT and Zapier are two such services that lets you plug-and-play several useful platforms directly into your Discord server through a clean web interface that allows you to customize the type of data your webhook receives, and thus what messages are sent to your server. Just keep in mind that some services have restrictions on how many events can be sent to one webhook, so you may have to create multiple distinct webhooks for multiple functionalities. Note that these options and restrictions are entirely platform-dependent. Discord has no problems handling whatever data is thrown at its webhooks when activated, even if it’s from different sources.
There’s another use-case for Webhooks that is more unique. While they’re very useful for automated messages, they’re also great for one-off embed messages that have a very polished look! You have the ability to customize the name and the avatar of the webhook, but if you’re technologically-inclined you can create your own JSON data to activate the webhook with. This allows you to fully define the aesthetics of an embed in your message, giving a clean look to whatever information you’re sending. One possible application is nice formatting for your server rules and information, rather than just sending multiple plain text messages.
Of course, there are other possible uses, the only limit is your creativity! If you’re not too keen on developing JSON data by hand, or have no idea what a “JSON” is, services like Discohook also make it easy for anyone to take advantage of this use case. As a note, the websites linked here are not endorsed by Discord and are only a suggestion from the authors of the article.
The process of setting up webhooks can be roughly explained in five simple steps!
Step 1: In your Discord server, you will need to create a webhook and copy the webhook URL. This URL is the path for your webhook to receive an HTTP POST request from a service when an event occurs.
Step 2: From this menu, you have the ability to style your webhook with a name and avatar. We recommend at least a name to distinguish its purpose.
Step 3: If you’re using a third-party service to handle events or send messages, plug your webhook URL into the service and configure the type of events that the service should trigger for.
Step 4: If your third-party service allows you to, configure additional options that will change the look and content of your message to the way you like.
Step 5: Now that you’ve created the connection, when the event happens, the data will be sent directly to Discord and your webhook will post a message in your preferred channel!
We’ve been talking about embeds a lot, but we haven’t quite explained what they are yet! In simple terms, embedding refers to the integration of links, images, GIFs, videos and other forms of content into messages on social media. An embed itself is a part of the message that visually represents content in order to increase engagement.
As a user of Discord, you have probably seen embeds more than a few times. They often are created automatically by Discord when a user sends a link, such as allowing you to view a YouTube video within Discord when a YouTube URL is shared. But did you know that Discord Bots and Webhooks can create their own embeds with all kinds of data? They’re pretty flexible! They can have colored borders, images, text fields, and other kinds of fancy properties.
If you're a developer, the options available to you to create a good-looking embed are powerful and versatile. For non-developers, platforms may give you visualizations that help you plug-and-play data into a website for customization purposes. There are also online tools to help you do this too!
Here are several of those properties that can be modified in an embed in order to style it, to give you an idea of what’s possible when you have the ability to style your messages:
The text that is placed above the description, usually highlighted. Also directs to a URL, if given.
The part of the embed where most of the text is contained.
The message content outside the embed.
The link to the address of the webpage. Mostly used with the thumbnail, icon and author elements in order to link to an image.
Color of your embed’s border, usually in hexadecimal or decimal.
Time that the embed was posted. Located next to the footer.
Text at the bottom of the embed.
A medium-sized image in the top right corner of the embed.
A large-sized image located below the “Description” element.
Adds the author block to the embed, always located at the top of the embed.
An icon-sized image in the top left corner of the embed, next to the “Author” element. This is usually used to represent an Author icon.
Allows you to add multiple subtitles with additional content underneath them below the main “Title” & “Description” blocks.
Allows you to put multiple fields in the same row, rather than having one per row.
Markdown is also supported in an embed. Here is an image to showcase an example of these properties:
Example image to showcase the elements of an embed
An important thing to note is that embeds also have their limitations, which are set by the API. Here are some of the most important ones you need to know:
If you feel like experimenting even further you should take a look at the full list of limitations provided by Discord here.
It’s very important to keep in mind that when you are writing an embed, it should be in JSON format. Some bots even provide an embed visualizer within their dashboards. You can also use this embed visualizer tool which provides visualization for bot and webhook embeds.
There are several benefits to using webhooks in your community including simplicity, versatility, automation, customization, and accessibility.
Simplicity. Webhooks are straightforward and lacking in complexity. They have a single function, which is to send a designated message when they are activated.
Versatility. Webhooks have many different use cases, all stemming from being able to send a message upon activation. This allows for many types of automation powered by other services, or allows you to send clean looking messages manually. Both of these setups have their own various uses ranging from posting updates and logging to posting custom messages for an aesthetic purpose.
Automation. With webhooks, there isn’t a need to constantly look for updates and post them yourself. Once set up, a webhook will automatically post any updates you need.
Customization. Each webhook can have a unique name and avatar, and each message it sends can be unique as well. You can have multiple webhooks with different looks in different channels and use each of them however you like.
Accessibility. Once you create a webhook, all you need is its URL and a website that will push messages. Since these webhooks are hosted on Discord, they don’t need to be hosted like a normal bot, often saving moderation teams from encountering a financial investment to use them, and making them more easily available to all users.
Webhooks and bots, while having slight similarities, are actually very different from each other. There are several aspects we have to look at when comparing the two:
Load and security
Even though this comparison is important for better understanding of both bots and webhooks, it does not mean you should limit yourself to only picking one or the other. Sometimes, bots and webhooks work their best when working together. It’s not uncommon for bots to use webhooks for logging purposes or to distinguish notable messages with a custom avatar and name for that message. Both tools are essential for a server to function properly and make for a powerful combination.
Thanks to their simplicity and accessibility, webhooks have become a staple in many communities. Despite their limitations and lack of functions compared to bots, they’re still very useful and play an important role in the automation and decoration of your server. Overall, webhooks are a great tool for pushing various messages, with limitless customization opportunities. Ultimately, the choice of using them depends solely on your needs and preferences.