If you're looking to automate your backend workflows or trigger actions based on your PostgreSQL database activity, Supabase and n8n make a powerful duo. Supabase is an open-source Firebase alternative built on top of Postgres, while n8n is a flexible, open-source workflow automation tool. Together, they let you build event-driven automations—without writing repetitive backend code. In this guide, you’ll learn exactly how to connect Supabase to n8n, including triggers, polling, and direct API queries.
Whether you're a solo developer or a small team looking to save time, this step-by-step tutorial will help you integrate Supabase into your n8n workflows with minimal setup.
Why Connect Supabase to n8n?
Connecting Supabase with n8n allows you to:
- Trigger workflows when database entries are created, updated, or deleted
- Sync your Postgres data with external tools like Google Sheets, Slack, Notion, or ClickUp
- Automate backend processes like notifications, approvals, or archiving
- Collect and process real-time data via Supabase’s REST and Realtime APIs
Here are a few practical use cases:
| Use Case | Description |
|---|---|
| New User Signup | Automatically send a welcome email when a new user is added to Supabase |
| Order Processing | Trigger an external webhook when a new order record is created |
| Record Backup | Copy new rows from Supabase to Airtable or Google Sheets |
Now, let’s start by enabling the connection.
Step 1: Get Your Supabase Project Credentials
To connect Supabase to n8n, you'll need a few key details:
- Project URL – Your Supabase REST endpoint
- Anon/Public API Key – Found under your project settings
- Database Table – The name of the table you want to monitor or fetch data from
How to Find These:
- Go to your Supabase Dashboard
- Navigate to
Project Settings > API - Copy your Project URL and anon/public API key
- Take note of the target schema and table (usually under schema
public)
Step 2: Set Up Supabase API Requests in n8n
Since n8n doesn’t (yet) have a built-in Supabase node, you can use the HTTP Request node to interact with its REST API.
Example: Get All Rows from a Supabase Table
- Add a HTTP Request node
- Use the following configuration:
Method: GET
URL: https://<your-project>.supabase.co/rest/v1/<your-table>
Headers:
apikey: YOUR_SUPABASE_API_KEY
Authorization: Bearer YOUR_SUPABASE_API_KEY
Prefer: return=representation
- Replace
<your-project>and<your-table>appropriately
This will fetch all rows from the specified table.
If you want more control, you can add filters like ?select=* or ?id=eq.123 in the URL to narrow down results.
Tip: You can even build dynamic queries using expressions in n8n based on data received from other triggers.
Step 3: Trigger n8n Workflows Based on Supabase Events
Supabase provides Realtime functionality via database triggers combined with its WebSocket layer. But a more reliable way to push data to n8n is through Supabase Edge Functions.
Method A: Use a Webhook Node in n8n + Supabase Edge Function
- In n8n, add the Webhook Trigger node (GET or POST)
- Copy the webhook URL and make sure n8n is accessible externally
- On Supabase:
- Go to
Edge Functions - Create a new function (e.g.,
notify-n8n.js) - Inside the function, make a
fetchrequest to your n8n webhook with the event data
- Go to
- Link this function to a Postgres trigger using SQL like:
create or replace function notify_n8n()
returns trigger as $$
begin
perform net.http_post('https://your-n8n-url/webhook/endpoint', json_build_object(
'record_id', new.id,
'data', new.*
)::text);
return new;
end;
$$ language plpgsql;
create trigger on_insert
after insert on your_table
for each row
execute function notify_n8n();
This setup ensures that every time a new record is added, n8n gets real-time notification.
If setting up Edge Functions feels advanced, another option is polling, shown below.
Step 4: Poll Supabase Periodically with n8n
If you don't need instant results or want to avoid setting up triggers, polling is simpler.
- Add a Cron Node to schedule checks (e.g., every 5 minutes)
- Connect it to an HTTP Request that queries Supabase for recent changes
- Use filters like
?created_at=gte.2024-05-01T00:00:00Zto fetch recent entries only
Combine this with a Set node or If condition to avoid retrieving duplicates, or send only new data downstream.
To persist last-run timestamps, you can use static data or environment variables in n8n.
Step 5: Use Supabase Data Anywhere in Your Workflow
Once you fetch data from Supabase, you're free to use it across n8n nodes like:
- Send emails with data using Send Email
- Post summaries to Slack or Telegram
- Store results in Airtable, Notion, or drive business logic through API calls
For advanced marketing workflows, check out the complete guide to n8n marketing automation.
Tips for a Smooth Integration
- Always use the
Prefer: return=representationheader when writing data via Supabase’s API - Maintain secure storage for your API key using environment variables or credentials node
- Use built-in n8n features like the IF, SplitInBatches, and Merge nodes for added logic
- Combine with Google Sheets or Calendar integration for powerful automation scenarios
FAQ
Can I write data back to Supabase from n8n?
Yes, using the HTTP Request node with POST, PATCH, or DELETE methods, you can insert, update, or delete rows in Supabase via its RESTful API.
Is there a native Supabase node in n8n?
Currently, no. But n8n’s modular design and HTTP Request node make it easy to work with Supabase’s APIs manually.
How do I secure my Supabase API key in n8n?
Use the Credentials feature in n8n to securely store and reference your API key, rather than hardcoding it into each workflow.
Can I connect Supabase's Realtime updates directly to n8n?
Not directly via WebSockets. However, using Supabase Edge Functions or polling methods is both reliable and flexible for most use cases.
What’s the difference between using a Webhook and polling?
Webhooks are event-driven and fast—they push data to n8n as soon as it happens. Polling is scheduled and simpler to set up but adds a delay depending on frequency.
By learning how to connect Supabase to n8n, you're unlocking the ability to automate nearly anything triggered by your database events. Whether you're building a SaaS backend, internal tool, or side project, this integration bridges the gap between data and action.
Copy-paste templates.
Beginner friendly.