Choose a different Template

Create a contact from a Supabase webhook

Create a contact in when a new user row is inserted into a Supabase table, using Supabase webhooks.

Help and guides

Get started

Run this command in your terminal to create a new project using this template.

npx create-trigger supabase-to-loops

This template uses Supabase Webhooks with the generic webhookEvent trigger to send updates whenever a user record is created in a Supabase table to, the API and our generic fetch function.

import { secureString, Trigger, webhookEvent } from "";

new Trigger({
  // Give your Trigger a stable ID
  id: "supabase-to-loops",
  name: "Supabase to",
  // Trigger on a webhook event, see
  on: webhookEvent({
    service: "supabase", // this is arbitrary, you can set it to whatever you want
    eventName: "user.inserted", // this is arbitrary, you can set it to whatever you want
    filter: {
      type: ["INSERT"], // only trigger on INSERT events
      table: ["users"], // only trigger on the users table
  // The payload of the webhook is passed as the event argument
  async run(event, ctx) {
    if (!process.env.LOOPS_API_KEY) {
      throw new Error("Missing LOOPS_API_KEY environment variable");

    await ctx.fetch(
      "Send to Loops",
        method: "POST",
        headers: {
          Accept: "application/json",
          Authorization: secureString`Bearer ${process.env.LOOPS_API_KEY}`,
        body: {
          createdAt: event.record.created_at,
          firstName: event.record.first_name,
          lastName: event.record.last_name,
          userId: String(,

🔁 Get your API Key

Follow the instructions in the API docs for how to get your API Key.

Once you have the API Key from Loops, set the LOOPS_API_KEY env variable in the .env file at the root of this project:

LOOPS_API_KEY="your Loops api key here"