Skip to content

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:

  1. Create an HTTP handler to receive the webhook
  2. Register the webhook with the service
  3. Handle the incoming webhook
  4. Secure the webhook by validating the request came from the service

Here’s a guide for receiving a webhook from Github.