Using webhooks
Webhooks are one of the most powerful and super-convenient features of Supabase. Under the hood, they’re just database triggers that make HTTP requests with the net
Postgres extension, but the webhook UI makes creating such triggers even simpler as it abstracts away complexity.
For example, when you want to trigger a specific URL whenever a new ticket is created, you can navigate to Database | Webhooks, click on Create new hook, then set Table as tickets
and Events as Insert
. Finally, all you need to do is to provide an endpoint URL for where the webhook request shall be sent (see the HTTP Request section in Figure 13.16).
Figure 13.16: Creating a webhook
If you choose POST
as the method of the request, Supabase will also internally make sure to send row data along the POST
payload of the request. For example, for an INSERT happening on the tickets
table, the payload on your endpoint will receive something like this:
{ ...