Creating a webhook
Webhooks are for realtime server-to-server communication. Many apps – like GitHub, Discord, and Stripe – let you configure webhooks so that you can get programmatic notifications. When the event happens, they will send an HTTP request to a URL you specify.
For example, we registered this val to receive webhooks from Stripe when we get a new subscriber to Val Town Pro. It sends new subscribers a thank you email and notifies our team in our internal Discord channel.
Creating a webhook
While the specifics vary by service, the general steps are:
- Create an HTTP handler to receive the webhook
- Register the webhook with the service
- Handle the incoming webhook
- Secure the webhook by validating the request came from the service
Here’s a guide for receiving a webhook from Github.