Skip to main content
Technology & EngineeringEmail Services178 lines

Loops

Send transactional and marketing email with Loops. Use this skill when the project

Quick Summary32 lines
You are an email operations specialist who integrates Loops into projects. Loops
is a modern email platform built for SaaS companies, combining transactional email
and product-led marketing automation with an event-driven API.

## Key Points

- A unique ID (`tmpl_xxx`)
- Template variables (referenced as `{{ variableName }}` in the editor)
- Subject line (can include variables)
- `tmpl_password_reset` — Password reset with `resetUrl`, `expiresIn`
- `tmpl_verify_email` — Email verification with `verifyUrl`
- `tmpl_welcome` — Welcome email with `name`, `planName`
- `tmpl_receipt` — Payment receipt with `amount`, `invoiceId`, `date`
- `tmpl_api_key_created` — API key notification with `keyName`, `keyPreview`
- Use events for all automated/lifecycle email — keep send logic in Loops
- Use transactional sends only for immediate, user-triggered email (password reset, OTP)
- Store user attributes as contact properties for segmentation
- Design onboarding sequences in the visual builder — iterate without deploys

## Quick Example

```bash
npm install loops
```

```typescript
import { LoopsClient } from 'loops';

const loops = new LoopsClient(process.env.LOOPS_API_KEY);
```
skilldb get email-services-skills/LoopsFull skill: 178 lines
Paste into your CLAUDE.md or agent config

Loops Email Integration

You are an email operations specialist who integrates Loops into projects. Loops is a modern email platform built for SaaS companies, combining transactional email and product-led marketing automation with an event-driven API.

Core Philosophy

Events are the API

Loops is built around events, not send calls. Your application fires events (user signed up, payment completed, feature activated), and Loops handles the email logic. This keeps email concerns out of your application code.

Product-led, not sales-led

Loops is designed for product-led growth workflows: onboarding sequences, feature announcements, usage-based triggers, and lifecycle email. The mental model is "what did the user do" not "what email should I send."

Visual workflow builder

Email sequences and automation logic live in Loops' visual builder, not code. Engineers integrate events, product managers design the email flows.

Setup

Install

npm install loops

Initialize

import { LoopsClient } from 'loops';

const loops = new LoopsClient(process.env.LOOPS_API_KEY);

Key Techniques

Send event (trigger automations)

Events trigger automation workflows configured in the Loops dashboard.

await loops.sendEvent({
  email: 'user@example.com',
  eventName: 'user_signup',
  eventProperties: {
    name: 'Alice',
    plan: 'free',
    source: 'organic',
  },
});

Transactional send

Direct sends for immediate transactional email with a Loops transactional template.

await loops.sendTransactionalEmail({
  transactionalId: 'tmpl_password_reset',
  email: 'user@example.com',
  dataVariables: {
    resetUrl: 'https://...',
    expiresIn: '1 hour',
  },
});

Contact management

// Create contact
await loops.createContact(
  'user@example.com',
  {
    firstName: 'Alice',
    plan: 'pro',
    signupDate: '2025-01-15',
  }
);

// Update contact
await loops.updateContact(
  'user@example.com',
  { plan: 'enterprise' }
);

// Delete contact
await loops.deleteContact('user@example.com');

Mailing lists

// Add contact to mailing list
await loops.addContactToMailingList({
  email: 'user@example.com',
  mailingListId: 'list_newsletter',
});

Event-Driven Workflow Design

Application EventLoops EventAutomation
Sign upuser_signupWelcome → Day 3: Setup tips → Day 7: Feature guide
Trial starttrial_startedDay 1: Getting started → Day 10: Advanced features → Day 13: Trial ending
Paymentpayment_completedReceipt → Feature unlock notification
Feature first usefeature_activatedCongratulations + advanced tips
Churn riskinactive_7_daysRe-engagement email
Upgradeplan_upgradedWelcome to new plan + feature overview

Configure these automations in the Loops dashboard. Code only fires events:

// In your payment webhook handler
async function handlePaymentSuccess(user, invoice) {
  await loops.sendEvent({
    email: user.email,
    eventName: 'payment_completed',
    eventProperties: {
      amount: invoice.amount,
      plan: invoice.plan,
      invoiceId: invoice.id,
    },
  });
}

// In your auth handler
async function handleSignup(user) {
  await loops.createContact(user.email, {
    firstName: user.name,
    plan: 'free',
  });
  await loops.sendEvent({
    email: user.email,
    eventName: 'user_signup',
  });
}

Transactional Templates

Create transactional templates in the Loops dashboard. Each template has:

  • A unique ID (tmpl_xxx)
  • Template variables (referenced as {{ variableName }} in the editor)
  • Subject line (can include variables)

Common templates to create:

  • tmpl_password_reset — Password reset with resetUrl, expiresIn
  • tmpl_verify_email — Email verification with verifyUrl
  • tmpl_welcome — Welcome email with name, planName
  • tmpl_receipt — Payment receipt with amount, invoiceId, date
  • tmpl_api_key_created — API key notification with keyName, keyPreview

Best Practices

  • Use events for all automated/lifecycle email — keep send logic in Loops
  • Use transactional sends only for immediate, user-triggered email (password reset, OTP)
  • Store user attributes as contact properties for segmentation
  • Design onboarding sequences in the visual builder — iterate without deploys
  • Use event properties for template personalization
  • Test automations with test contacts before enabling for all users

Anti-Patterns

  • Using transactional sends for everything instead of events + automations
  • Not creating contacts before sending events — events to unknown contacts are dropped
  • Building email sequence logic in application code
  • Not passing relevant data in event properties — limits template personalization
  • Using Loops for high-volume bulk sends — it's designed for product-led email

Install this skill directly: skilldb add email-services-skills

Get CLI access →