Skip to content

Supabase webhooks

Handling Supabase webhooks in Val Town allows you to run arbitrary logic whenever an INSERT, UPDATE, or DELETE happens in your database. For example, for new user signups you could set up an email, Slack, or Discord notification, or enrich user data with Clay.

Create a new val using the webhook template, or remix this example val:

Enable Database > Webhooks in the Supabase dashboard, which will install as an Integration:

Supabase Dashboard > Integrations > Database Webhooks

To wire up your HTTP val:

  1. Click “Create a new hook”
  2. Name your webhook
  3. Select what table (e.g. users) and events (e.g. INSERT) to hook into
  4. Copy your val’s HTTP endpoint and paste it in
  5. Create a random secret and add it as a header

Supabase Dashboard > Integrations > Database Webhooks > Create a new database webhook

  1. Store the secret as an environment variable in your val

Val Town environment variable

Reference Supabase’s database webhooks docs for more information about payloads, monitoring, and local development.

The hard-coded secret we added above is quick but imperfect security. For more robust signature verification, you can reference this supabaseVerifiedWebhook val.