For the unaware, those who are wondering what the heck is this “Webhooks” are, you have landed on the right webpage.
It is an API concept that has been getting incorporated in various online services. A Webhook, which is also known as “Web Callback” or “HTTP push API,” is a way for an app to provide or send real-time data/information to other applications. It is responsible for sending automated messages and data to other applications at the same time any action takes place.
Have you ever pondered, when you make any operation on your online payment systems, how your accounting app gets updated automatically and notify you immediately as the transaction occur? Yes, it is nothing other than a Webhook aiding the communication process between different apps with providing real-time data.
Don’t confuse a Webhook with API as both have different behaviour of working. To put it simply, an API does stuff when you ask it to, while a Webhook does stuff on it’s own when certain criteria is met or scenarios takes place.
I hope until now you have got the idea of what Webhooks are and the aim behind employing it. Pretty understandable, right?
Discord Webhooks – An brief overview
Discord, as you might know, has an inbuilt Webhooks function that makes the process of getting automated messages and sending data updates to text channels doable for the server. All you have to do is, create a Webhook endpoint on your Discord server and you will get a Webhook URL generated that you can place into several different services (of your choice) to connect the two.
It is not feasible to link Discord to every websites or service you may want for sending messages outwards but only for the ones that are built to incorporate webhooks easily. However, if you are a programmer, you will undoubtedly be having the upper hand for the job.
How to create and use Webhooks in Discord
Firstly, you have to look for the Webhook compatible service that you want to connect your Discord to receive messages from. For your quick reference, GitHub, CircleCI, and DataDog are the few popular ones on which you can use Webhook.
GitHub Webhook Tutorial
If you want to customize your Discord server with GitHub commits and pull requests, or anything similar, you can follow up with the steps mentioned below.
Part 1: Create a Webhook on Discord
- Log in to Discord, open your server, and under “Text Channels” click on the small gear option.
- On the left pane, tap on the option “Webhooks.”
- Next, click on “Create Webhook” and type in the Name, select a Channel from the drop-down menu you’d like to send commits, and choose a Webhook icon of your choice.
- Scroll a bit, and you will find the “Webhook URL that will be needed to link it to the other websites.” Simply copy it and tap on the Save button.
Part 2: GitHub Webhook integration
Next, in order to make the Webhook working, you need to integrate it to the other website, in my case, I am taking GitHub as the service to link with.
- Log in to your GitHub account and choose the repository you want to get updates from in your Discord channel, and click on Settings.
- On the left pane, click on “Webhooks.”
- Next tap on “Add Webhooks” and paste the “Discord generated Webhook URL” in the box asking for “Payload URL.”
Don’t forget to append ‘/github’ at the end of the URL since it’s important to make the Webhook work properly.
- Select the Content-type to “application/json,” choose “Send me everything,” and lastly tap on “Add webhook.”
- Once done, you should check if it’s working fine or not by simply updating something or starring the repository. Any updates on the GitHub repo onwards will show up to your Discord text channel.
Time to wrap up this guide! I hope it helped you understand the basics of Webhooks and how you can integrate it to the compatible sites or services to work in your favor. As previously mentioned if you are a programmer, you can implement as many of tweaks as you want to make a highly customizable Webhook.