Webhooks Explained

Adegbola IbukunJah
Jul 15 · 3 min read

APIs are increasingly becoming very important in digital communications across the web which brings about a growing need for the usage of Webhooks. In this article we would understand what Webhooks really are, When they should be used instead of APIs, how they are consumed, and example sites to try out when looking to implement Webhooks.

What are Webhooks?

Webhooks are sometimes referred to as a reversed API, but this isn’t entirely true. A Webhook (also called a web callback or HTTP push API) is a way for an app to provide other applications with real-time information. A Webhook delivers data to other applications meaning you get data immediately. This differs from an API because an API doesn’t provide you with real-time information, instead you have to poll for data every time to get it in real time. A Webhook will make an HTTP request to your app (typically a POST request), and you will interpret the data returned to you.

When Should You Use Webhooks?

APIs demands lots and lots of resources as more and more requests come in meaning that there is always a need to fulfill requests even when they are not needed and if a server can’t handle the request, the request can and will not be completed, it is always better to use a Webhook at this time as real-time data will only be sent when new data is available.

How to Consume a Webhook

The first step needed to consume a Webhook is to give the Webhook provider a URL endpoint where data will always be sent to. This is most often done through a back-end panel. This always means that you need to set up a URL in your app that’s accessible from the public web.

The Second step to consuming a Webhook is receiving the response in either JSON or XML format and then storing the data received in a database so you can use afterward.

For Opening your URL endpoint over the internet a tool like ngrok would be very useful.

For Mocking your requests you can use a tool like PostMan or cURL.

Trying Out Webhooks

The best way to truly understand how Webhooks work is to try one. Fortunately, lots of services use Webhooks so you can easily play with them to fully grasps how they work. Check out some of this sites below:

Conclusion

Most applications end up using APIs and Webhooks side by side in creating a system that communicate the right data at the right time. I hope you would try out a Webhook in your next project. Thank you for reading!

If you found this article helpful, 👏👏👏.

Adegbola IbukunJah

Written by

Software Engineer @ Paga, Java | JavaScript Developer, Autodidact, AI Lover.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade