Supabase + iMessage — Send Messages from Your Database

Trigger iMessages from Supabase database events. Use Edge Functions to call the Sendblue REST API and add messaging to your app without managing infrastructure.

How to Connect Supabase + Sendblue

1

Get Your Sendblue API Keys

Sign up for a Sendblue account and grab your API key and secret. Store them as Supabase secrets using supabase secrets set SENDBLUE_API_KEY=...

2

Create an Edge Function

Write a Supabase Edge Function that calls POST https://api.sendblue.co/api/send-message. Accept the recipient phone number and message body as parameters from your database trigger or client app.

3

Wire Up Database Triggers

Use Supabase Database Webhooks or Postgres triggers to invoke your Edge Function when rows are inserted or updated in your messages, orders, or contacts table.

4

Handle Inbound Replies

Create a second Edge Function to receive Sendblue's inbound webhook. Parse the payload and insert the reply into your messages table. Optionally push updates to clients via Supabase Realtime.

Key Features

Edge Function Integration

Call the Sendblue API from Supabase Edge Functions. Deno-based, globally distributed, and no servers to manage. Deploy with a single CLI command.

Database-Driven Triggers

Send iMessages when database rows change. New order? Text a confirmation. Support ticket updated? Notify the customer. All triggered from Postgres events.

Realtime Replies

Combine Sendblue webhooks with Supabase Realtime to push incoming iMessage replies to your frontend instantly. Build live chat experiences backed by your database.

Smart Routing

Sendblue detects iMessage availability automatically. iPhone users get blue bubbles; Android users receive SMS. No conditional logic needed in your Edge Functions.

Row-Level Security

Use Supabase RLS policies to control who can trigger messages and view conversation history. Enterprise-grade access control on your messaging data.

Media & Attachments

Send images and files stored in Supabase Storage. Pass the public URL to the Sendblue API and deliver rich media through iMessage.

Why Supabase + iMessage?

Supabase is the open-source Firebase alternative that developers love. By connecting Sendblue's REST API, you can add iMessage and SMS capabilities to any Supabase-powered app without third-party SDKs or messaging infrastructure.

The developer experience: Supabase Edge Functions are Deno-based and deploy in seconds. A simple fetch() call to the Sendblue API is all it takes to send an iMessage. Combine that with Postgres triggers, and you have event-driven messaging that scales with your database.

The connection is straightforward — there's no native integration to install. Your Edge Functions make standard HTTP requests to the Sendblue API at https://api.sendblue.co/api/send-message. This means you have full control over retry logic, error handling, rate limiting, and message composition.

For SaaS builders, this is a powerful pattern: use Supabase for your data layer and auth, Sendblue for messaging, and Supabase Realtime to push conversation updates to your frontend. Add Sendblue's FaceTime Audio calling to enable voice communication from the same Edge Function pattern.

Get started with Supabase + Sendblue

Free sandbox, no credit card required. Start sending iMessages from your database in minutes.

Get API Access

Frequently Asked Questions

Does Sendblue have a native Supabase integration?

Sendblue does not have a native Supabase integration. You connect the two by calling the Sendblue REST API from Supabase Edge Functions or by using database webhooks to trigger external API calls. It's a developer-friendly setup that takes minutes.

Can I trigger iMessages from Supabase database changes?

Yes. Use a Postgres trigger with pg_net or a Supabase Database Webhook to call a Supabase Edge Function when rows are inserted or updated. The Edge Function then calls the Sendblue API to send the iMessage.

How do I store incoming message replies in Supabase?

Configure a Sendblue inbound webhook pointing to a Supabase Edge Function. The function receives the webhook payload (sender number, message content, timestamp) and inserts it into your messages table.

What about contacts without iMessage?

Sendblue automatically detects iMessage availability and falls back to SMS for Android users. Your Edge Function doesn't need any special logic — Sendblue handles the routing automatically.