lib/onboarding.ts
1import { LoopsClient } from "loops"
2
3const loops = new LoopsClient(process.env.LOOPS_API_KEY)
4
5// Sync the signed-up user as a contact
6await loops.updateContact({
7 email: user.email,
8 userId: user.id,
9 properties: { planName: "Team" },
10})
11
12// Start the onboarding workflow
13await loops.sendEvent({
14 userId: user.id,
15 eventName: "projectCreated",
16 eventProperties: { projectName: "Q3 launch" },
17})

Why build on the Loops API

One REST API behind every SDK, skill, and agent tool.

MarketingProductTransactional
Contacts and events

One API for every email

Marketing, product, and transactional email share the same contacts and events.

POST /api/v1/events/send200
{ "eventName": "plan.upgraded",
"userId": "usr_123" }

Events start workflows

Send an event from your backend and the matching workflow takes it from there.

openapi.jsonloops-api skillMCP server

Agent-ready

An OpenAPI spec and an API skill give coding agents everything they need.

JavaScriptGoNuxtPHPRuby

SDKs for your stack

Official SDKs for JavaScript, Go, Nuxt, PHP, and Ruby.