More about Webhooks.

Oct 4, 2019

If you have developed websites that come with the integration of an API like Payment Gateways or SMS Providers then you might have definitely come across this term called the webhooks.

If you don’t know what it actually means then this is the right post for you to read. Webhooks are meant to be called user-defined HTTP callbacks but why? Let us see here.

Let me give you an example with an SMS service provider. If you want to send an automatic SMS with the application or software you have built then consider what are the step you use to do it.
First, you will create an API request to the API Provider with all the information like the message, mobile number, etc. Later the provider will grab all the information and process the request. In this case, SMS is something that could be delayed with multiple factors like network or anything. Coz of this you will never know whether your message is sent or not.
But when the message is actually sent, the network provider will inform the API service provider with the update about the message whether it is sent or not. So now, the API has the result of the request made by the user but the application is not notified about the update.

This is where webhooks plays its role. After making a request to the Application, the application cannot wait for the API response because this will create so many issues like unwanted load and so on. To avoid this webhooks were introduced. This Webhook is actually an HTTP Post request sent to the application by the API itself. So the Application doesn’t wanna wait for the response instead the Application is provided with an HTTP callback with all the data and the status of the request that is made to the server. Both the requests and responses will have a unique ID or a param which will help you identify which response belongs to which request.

Let us discuss this thing with a live scenario :

Let us consider that you are going to a hospital and you are booking a reservation there. Since there is a lot of reservations already they will ask you to book your reservation and ask you to wait for a while. When your call comes, a representative will come and inform you that you can go now. You will be never standing somewhere to wait for the queue to get over which will result in leg pain or anything like that. So to avoid such a situation this plan is used. The hospital representative will identify you with your reservation number.

Here you are the API request and the hospital representative is the API provider and the hospital is the network provider when we consider an SMS gateway API.

So like this, there are many usages of webhooks in different applications like Subscription Management, Payment Reports and more.

I hope you now have an idea about webhooks with this post. If you have any questions about this, feel free to add that in the “reviews” section. Our Forum is always open to answer questions related to programming. Feel free to add your programming questions over there. That’s it.

Happy Coding Guys !!!

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.