Choose a different Template

Send a message to Discord from a Supabase webhook

Send a message to a Discord channel when a new row is inserted into a Supabase table.

Help and guides

Get started

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

npx create-trigger supabase-to-discord

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

import { Trigger, webhookEvent } from "";

const SUPABASE_TABLE = process.env.SUPABASE_TABLE ?? "users";

new Trigger({
  // Give your Trigger a stable ID
  id: "supabase-to-discord",
  name: "Supabase to Discord",
  // Trigger on a webhook event, see
  on: webhookEvent({
    service: "supabase", // this is arbitrary, you can set it to whatever you want
    eventName: "row.inserted", // this is arbitrary, you can set it to whatever you want
    filter: {
      type: ["INSERT"], // only trigger on INSERT events
      table: [SUPABASE_TABLE], // only trigger
  // The payload of the webhook is passed as the event argument
  async run(event, ctx) {
    // Check that the DISCORD_WEBHOOK_URL environment variable is set
      throw new Error("DISCORD_WEBHOOK_URL is not set");

    // Craft a message to send to Discord
    const message = {
      embeds: [
          color: 0x7289da,
          title: `New row created in ${event.table}: ${}`,

    // Send the message to Discord using the incoming webhook URL
    await ctx.fetch("✨", DISCORD_WEBHOOK_URL, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      body: message,

✍️ Customize

  1. Change the table using the SUPABASE_TABLE environment variable to point to the table you'd like events from in your supabase database.
  2. Feel free to customize the message to Discord by referencing their docs