What are webhooks and how they work? If you are new to about the webhook and want to know what are webhooks: how they work and how to set up them then this is right place for you. In this article I will discuss about what is another name for webhook and is webhook a HTTP request?
What are webhooks?
A webhook is an http-based callback function that allows communication between 2 applications. A callback function is basically a function that is passed as an argument into another function which executes the callback function as part of its job.
Basically, there are many situations where we need this kind of functionality, like if we want to do something on an event occurrence on the server side, then this callback function approach can do much help, for example if we want to notify users automatically once a comment being posted on their blogs.
One solution to this problem could be like, at some regular time interval, we (as a client) ask from the server whether the comment is logged or not. If it is logged, then we notify the user and if it is not, then after some time we again ask the server.
This solution definitely can work, but there is a problem with this approach. Here in this solution, we are wasting our resources because we are asking the server again and again for new data.
Another best solution could be if we could tell the server that whenever you find new data, then tell us immediately. To achieve this use case, the callback functions come into the picture. So, in this case, we (as a client) create an http-based API as a callback function and we provide that API URL to the server. Now the server calls that API URL whenever he receives new data. So, in this case, we are saving lots of resources because the server automatically notifies the client whenever he receives new data rather than the client continuously asking the server for the same.
Other real life examples where webhooks work are like in WhatsApp and Gmail applications. Whenever the server receives a new message, it automatically notifies the clients (WhatsApp and Gmail) to fetch new data rather than these applications continuously asking the server for new messages.
There
are many platforms which support webhooks. Some of those platforms are as
below:
- GitHub
- Trello
- Confluence
- Google Calendar
Some other practical cases of webhooks could be as below:
- Daily automatic email reminders for meetings
- Confirmations of processed and completed payments
- Sync changes in customer data between applications
If you have any queries/suggestions or want
to ask any questions you can comment below or can email me on my email id.
Thank you for reading this article and by
giving your time.
Could you please create a demo article on same topic?
ReplyDeleteSure, I will do that very soon.
Delete@Mobile Security you can check this article for the same https://brtechnologysolutions.blogspot.com/2023/03/what-are-webhooks-in-github-and-how-to-use-them.html
Delete