This n8n template captures chat data (like user ID, name, or address) and saves it to a Supabase PostgreSQL database. It’s built for testing now but designed to work with WhatsApp, Slack, or similar platforms later, where chat inputs aren’t predefined.
Guide with images can be found on: https://github.com/JimPresting/Supabase-n8n-Self-Hosted-Integration/
To let your n8n instance talk to Supabase, add a firewall rule in your VPC network settings (e.g., Google Cloud, AWS, etc.).
Go to VPC Network settings.
Add a new firewall rule:
allow-postgres-outbound
0.0.0.0/0
(allows all; restrict to Supabase IPs for security)IPv4 ranges
and add the n8n VM’s IP range, orNone
if any VM can connectTCP
5432
(default PostgreSQL port)Save the rule.
Log into your Supabase Dashboard.
Go to your project, click the Connect button in the header.
Copy the PostgreSQL connection string:
postgresql://postgres.fheraruzdahjd:[YOUR-PASSWORD]@aws-0-eu-central-1.pooler.supabase.com:6543/postgres
[YOUR-PASSWORD]
with your Supabase account password (no brackets) and replace the string before that with your actual unique identifier.6543
or 5432
)—use what’s in the string.This workflow takes chat data, maps it to variables, and stores it in Supabase. It’s built to handle messy chat inputs from platforms like WhatsApp or Slack in production.
Trigger Node: "When clicking 'Test workflow'" (manual trigger).
Set Node: "Set sample input variables (manual)".
id
, name
, address
to mimic chat data.id
will be something unique like a phone number, account ID, or account number.Sample Agent Node: Uses a model (e.g., GeminiFlash2.0 but doesn't matter).
Supabase PostgreSQL Node: "Supabase PostgreSQL Database".
id
, name
, address
) to a table.id
(like a phone number or account ID) is the key. Extra fields like name
or address
let us keep all user info in one place for later use (e.g., analytics or replies).Output Node: "Update additional values e.g., name, address".
id
, name
) to our database fields.id
as a key (phone number, account ID, etc.) with extra fields like name
makes this workflow flexible for many use cases, like user profiles or support logs.In the n8n workflow, set up the Supabase PostgreSQL node:
aws-0-eu-central-1.pooler.supabase.com
(from the connection string)6543
(or what’s in the connection string)postgres
postgres.fhspudlibstmpgwqmumo
(from the connection string)Set the node to Insert or Update:
id
to a unique column in your Supabase table (e.g., phone number, account ID).name
, address
to their columns.Test the workflow to confirm data saves correctly.
0.0.0.0/0
. Find Supabase’s IP ranges in their docs and use those.