How to add webhooks to your app
Give your users a way to create their own webhooks. Each webhook should have a URL (where events will be sent); you may also want to let users select the individual events they want to receive, like GitHub does.
Webhooks listen for events—things that happen—in your application. When an event occurs, you must notify each webhook by sending a POST request to the URL provided by the user. Some applications may only support a single event, but if your application has multiple events (or you plan to add more events in the future), it's helpful to do some planning. Once users start receiving your webhooks they become difficult to change—just like an API.
Your backend is how you will actually send the webhook requests. While it may seem like overkill to build a "backend" just to make a POST request, there's a bit more to it. Because users are depending on webhooks to actually reach their applications, you need to be resilient to failures and other problems.How to Structure Webhooks »