How to segment your Supabase users before sending
Sending to all your users makes sense sometimes: a product update, a critical announcement, a changelog. But many of the most useful emails are targeted. An upgrade prompt to free-tier users, a nudge to people who haven't logged in for 30 days, a feature announcement that only matters on one plan.
BroadcastMail lets you filter by any column in your Supabase user table without writing code. Here's how to set it up and what you can do with it.
What filterable columns are
A filterable column is any column in your user table that you mark as available for targeting. BroadcastMail reads its type (text, number, boolean, or timestamp) and offers the matching operators: equals, greater than, before, is true, and so on.
You pick them during setup in the Configure filterable columns step, or later from Settings > Connections. Only the columns you select are read, which keeps the connection narrow and lets you leave anything sensitive out entirely.
Good candidates are the words you'd use to describe a group of users out loud: plan, role, created_at, last_seen_at, is_verified, country.
Filtering examples
You build filters with dropdowns. BroadcastMail shows the equivalent SQL next to the recipient count, so you can see exactly who will get the email before you send.
By plan
The most common segment. Send an upgrade prompt to the free tier, or a billing notice only to paying customers.
-- Free-tier users
where plan = 'free'By signup date
Welcome a recent cohort, or ask your earliest users for feedback.
-- Signed up in the last 7 days
where created_at > now() - interval '7 days'Add a second condition to narrow it further. These are users who joined in the last 30 days and haven't upgraded:
where created_at > now() - interval '30 days'
and plan = 'free'By boolean flag
Flags like has_completed_onboarding drive some of the most effective emails you can send: a short, specific nudge to people who started setup and stopped.
where has_completed_onboarding = false
and is_verified = trueBy role
In team-based apps, admins and members need different messages. Billing changes go to admins; a new editor feature goes to everyone who edits.
where role = 'admin'Personalise with variables
Any filterable column also works as a variable in your subject line or body. Write it as {{column_name}}.
Subject: {{first_name}}, you're one step from launch
Hi {{first_name}},
You connected your project but haven't sent a campaign yet.
It takes about two minutes from here.Pair the variable with the filter that makes it true. If you mention someone's plan in the copy, filter on plan so every recipient gets a sentence that fits. If a column is sometimes empty, preview a few recipients first; a missing name otherwise reads "Hi ,".
What you can't filter by yet
Filters work on columns in the one user table you connected. Cross-table joins aren't supported yet, so a condition like "users who created more than three projects" won't work if projects live in their own table.
The workaround is to bring the value onto the user table. A column kept current by a trigger turns a cross-table question into a simple filter:
alter table profiles add column project_count int not null default 0;
create function bump_project_count() returns trigger as $$
begin
update profiles
set project_count = project_count + 1
where id = new.owner_id;
return new;
end;
$$ language plpgsql;
create trigger on_project_created
after insert on projects
for each row execute function bump_project_count();Mark project_count as filterable and you can send to project_count >= 3. Join support is on the roadmap.
Email your Supabase users today
Connect your project and send your first campaign in about five minutes. Free up to 500 recipients a month.