Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: add SQL example for creating webhooks (#17877)

Han Qiao6d72aa7b8a95
diff --git a/apps/docs/pages/guides/database/webhooks.mdx b/apps/docs/pages/guides/database/webhooks.mdx
index 3c821f8a77b..70a8c3daca1 100644
--- a/apps/docs/pages/guides/database/webhooks.mdx
+++ b/apps/docs/pages/guides/database/webhooks.mdx
@@ -35,6 +35,20 @@ This video demonstrates how you can create a new customer in Stripe each time a
1. Select the table you want to hook into.
1. Select one or more events (table inserts, updates, or deletes) you want to hook into.
+Since webhooks are just database triggers, you can also create one from SQL statement directly.
+
+```sql
+create trigger "my_webhook" after insert
+on "public"."my_table" for each row
+execute function "supabase_functions"."http_request"(
+ 'http://localhost:3000',
+ 'POST',
+ '{"Content-Type":"application/json"}',
+ '{}',
+ '1000'
+);
+```
+
We currently support HTTP webhooks. These are sent as a `POST` request with a JSON payload.
## Payload