Migrate Supabase webhooks to Sequin webhook sinks
How to migrate Supabase webhooks to Sequin webhook sinks.
This guide shows you how to migrate Supabase webhooks to Sequin webhook sinks.
You may want to move your existing Supabase webhooks to Sequin because Sequin webhook sinks provide additional features, observability, and reliability:
- Exactly-once processing guarantees ensuring every event is processed once and only once.
- Automatic retries and backoff for failed events.
- Filtering of events with no PL/pgSQL required.
- Backfill support to sync historical data.
- End-to-end observability and debugging tools for failed events.
- Sinks to other streams and queues like SQS and Kafka.
You can easily move your existing Supabase webhooks to Sequin by creating Sequin HTTP push consumers.
Prerequisites
You are about to migrate a Supabase webhook to a Sequin webhook sink that sends HTTP POST requests to your endpoint when database rows change.
You’ll need the following:
- A Supabase project
- Sequin installed locally or a Sequin Cloud account
- Your Supabase database connected to Sequin
Example Supabase webhook to migrate
As an example, here’s a webhook trigger in Supabase for a hypothetical orders
table:
In this example, a postgres trigger fires anytime a new record is added to the orders
table. The trigger then fires a webhook (via pg_net
) to send the data to an HTTP endpoint.
When the trigger fires, Supabase sends the data to the endpoint with the following payload:
Create a Sequin webhook sink
To replicate this exact webhook in Sequin, you’ll create a webhook sink on the orders
table with no filters. Here’s how to do it:
Create a new sink
Navigate to the “Sinks” tab, click the “Create Sink” button, and select “Webhook Sink”.
Select source table
Select your Supabase database and the public.orders
table.
Choose message type
Specify whether you want to receive changes or rows from the table. In this case, you want to receive changes.
Specify change types
In “Records to process”, set the consumer to capture just INSERT
operations:
Configure backfill
Leave “Backfill” toggled off for now.
Configure message grouping
Under “Message grouping”, leave the default option selected to ensure events for the same row are sent to your webhook endpoint in order.
Configure delivery settings
Under “Delivery configuration”, choose a conservative value for “Request timeout” and set “Batch size” to 1.
Configure HTTP endpoint
Add your webhook URL and any required headers.
Name and create sink
Give your sink a name (e.g. orders_webhook_sink
) and click “Create Webhook Sink”.
Now, when you create a new order in Supabase, Sequin will capture the change and send it to your endpoint:
Sequin’s data payload is slightly different than Supabase’s webhook payload:
- Sequin’s
metadata
field includes additional metadata about the consumer and the table. - Sequin captures the operation type (e.g.
insert
,update
,delete
) in theaction
field not thetype
field. - Sequin captures changes for
update
anddelete
operations in thechanges
field not theold_record
field.- Updates: Sequin’s
changes
object only contains the changed columns and their old values, while Supabase’sold_record
field contains the prior state of the entire record before it was updated. - Deletes: Sequin’s
record
field contains the prior state of the record before it was deleted and thechanges
field isnull
, while Supabase’sold_record
contains the the prior state of the record before it was deleted and therecord
field isnull
.
- Updates: Sequin’s
Was this page helpful?