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:
- Web hooks
- 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.