WebHooks, an enhanced mode of HTTP interaction, is a user-defined HTTP callback that is defined, maintained, and managed by a third-party user, a developer, as if allowing someone to mount a network cable to your Web site or application's hooks to receive your push message in real time, So the web hooks, hence the name. In this way, a publish/subscribe model is provided for connected Web APIs and SaaS services, and then the MicroServices Architecture event bus (Message Queuing) is the component that determines availability, and communication between microservices is done by defining hooks. This way we no longer need to deploy highly available message queues alone to ensure that our services are unblocked and can save a lot of human and financial resources.
Web Hook working mechanism
Simply put, when our SaaS system changes, such as the user orders, blog comments, submit code to the warehouse, etc., will send a request to the response hook configuration HTTP callback. Webhooks can be seen as a concise sub/pub mode, except that the carrier of the event is an HTTP POST request.
Because of the simplicity of webhooks, many mainstream SaaS systems are now exposed to their own webhooks, such as Dropbox, GitHub, GitLab, Instagram, MailChimp, PayPal, Slack, Trello, For example, we can define a web hook for the GitHub code submission, a web hook for PayPal's payment status, so that it can receive push information from the app in real time, without the need for real-time rotation to request real-time information.
Webhook Processing Pipeline
Receiving end
- The receiver is responsible for handling the specific style of WebHook from the given sender and enforcing security checks to ensure that the sender is indeed expecting a WebHook request.
- Handlers are typically run by user code to handle specific WebHook.
Reference Links:
Https://en.wikipedia.org/wiki/Webhook
Https://blogs.msdn.microsoft.com/webdev/2015/09/04/introducing-microsoft-asp-net-webhooks-preview
https://developer.github.com/webhooks/
Https://github.com/aspnet/WebHooks
Https://docs.microsoft.com/zh-cn/aspnet/webhooks
Webhooks-web Hooks