{"id":20597739,"url":"https://github.com/triggerdotdev/supabase-to-loops","last_synced_at":"2025-03-06T15:21:49.753Z","repository":{"id":134990804,"uuid":"607698909","full_name":"triggerdotdev/supabase-to-loops","owner":"triggerdotdev","description":"✨ Trigger.dev Supabase Webhooks to Loops.so","archived":false,"fork":false,"pushed_at":"2023-03-15T15:33:55.000Z","size":114,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-02T00:08:39.385Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://app.trigger.dev/templates/supabase-to-loops","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/triggerdotdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-28T13:59:13.000Z","updated_at":"2024-08-15T12:40:27.000Z","dependencies_parsed_at":"2023-05-06T14:00:21.976Z","dependency_job_id":null,"html_url":"https://github.com/triggerdotdev/supabase-to-loops","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/triggerdotdev%2Fsupabase-to-loops","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/triggerdotdev%2Fsupabase-to-loops/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/triggerdotdev%2Fsupabase-to-loops/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/triggerdotdev%2Fsupabase-to-loops/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/triggerdotdev","download_url":"https://codeload.github.com/triggerdotdev/supabase-to-loops/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242231442,"owners_count":20093636,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T08:23:45.413Z","updated_at":"2025-03-06T15:21:49.722Z","avatar_url":"https://github.com/triggerdotdev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## ✨ Trigger.dev Supabase to Loops.so\n\nThis repo uses [Supabase Webhooks](https://supabase.com/docs/guides/database/webhooks) with the generic [webhookEvent](https://docs.trigger.dev/reference/webhook-event) trigger to send updates whenever a user record is created in a Supabase table to [Loops.so](https://loops.so), the Loops.so API and our generic [fetch](https://docs.trigger.dev/functions/fetch) function.\n\n```ts\nimport { secureString, Trigger, webhookEvent } from \"@trigger.dev/sdk\";\n\nnew Trigger({\n  // Give your Trigger a stable ID\n  id: \"supabase-to-loops\",\n  name: \"Supabase to Loops.so\",\n  // Trigger on a webhook event, see https://docs.trigger.dev/triggers/webhooks\n  on: webhookEvent({\n    service: \"supabase\", // this is arbitrary, you can set it to whatever you want\n    eventName: \"user.inserted\", // this is arbitrary, you can set it to whatever you want\n    filter: {\n      type: [\"INSERT\"], // only trigger on INSERT events\n      table: [\"users\"], // only trigger on the users table\n    },\n  }),\n  // The payload of the webhook is passed as the event argument\n  async run(event, ctx) {\n    if (!process.env.LOOPS_API_KEY) {\n      throw new Error(\"Missing LOOPS_API_KEY environment variable\");\n    }\n\n    await ctx.fetch(\n      \"Send to Loops\",\n      \"https://app.loops.so/api/v1/contacts/create\",\n      {\n        method: \"POST\",\n        headers: {\n          Accept: \"application/json\",\n          Authorization: secureString`Bearer ${process.env.LOOPS_API_KEY}`,\n        },\n        body: {\n          email: event.record.email,\n          createdAt: event.record.created_at,\n          firstName: event.record.first_name,\n          lastName: event.record.last_name,\n          userId: String(event.record.id),\n        },\n      }\n    );\n  },\n}).listen();\n```\n\n## 🔧 Install\n\nYou can easily create a new project interactively based on this template by running:\n\n```sh\nnpx create-trigger@latest supabase-to-loops\n# or\nyarn create trigger supabase-to-loops\n# or\npnpm create trigger@latest supabase-to-loops\n```\n\nFollow the instructions in the CLI to get up and running locally in \u003c30s.\n\n## 🔁 Get your Loops.so API Key\n\nFollow the instructions in [the Loops.so API docs](https://tryloops.notion.site/API-5b453a52dd7c4b419aa4647410de9770) for how to get your API Key.\n\nOnce you have the API Key from Loops, set the `LOOPS_API_KEY` env variable in the `.env` file at the root of this project:\n\n```\nLOOPS_API_KEY=\"your Loops api key here\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftriggerdotdev%2Fsupabase-to-loops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftriggerdotdev%2Fsupabase-to-loops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftriggerdotdev%2Fsupabase-to-loops/lists"}