Web hooks - Basics

There are 2 ways to know the status of a transaction/activity happening on a different app/system which is required to another platform to further proceed it own process:

  1. Web hooks
  2. Polling

First we will close polling. Polling is simply checking the status of the process in a defenite time interval. The problem with it is you always want to keep knocking the door of the other system. So we found a modern alternative "Web hooks".

Most modern web applications like Stripe, Slack, Discord supports web hooks. Now we will take a look how it works.

For example, if you want Stripe to notify your backend server about an activity (for example: A user's payment processing). This notification mechanism can help you add this information to your database and further processes the user's deliverables.

How to identify the Web hook is not delivered by a Hacker ?

This scenario can happen if there is not way of authenticating the hook. In our earlier context Stripe will give us a secret key and while sending a hook Stripe will attach a hash along with request which you can utilize to validate the authenticity of the hook. To learn more about hashes please have at look here. This is so important for a web hook system.

References

What are webhooks?
You might have seen webhooks mentioned in your apps’ settings and wondered if they’re something you should use. The answer, in a nutshell, is probably yes. Webhooks are one way that apps can send automated messages or information to other apps. It’s how PayPal tells your accounting app when your...