# Ranla agent skill

Use Ranla as the product’s AI agent for lifecycle email. Start by learning the lifecycle:
signup, activation, conversion, and retention. Do not assume that connecting
transactional email is required.

## Defaults

- Use `RANLA_API_KEY` only on the server.
- Use `https://api.ranla.ai` unless the user gives another base URL.
- Read the product’s existing analytics and identity patterns before adding
  instrumentation.
- Prefer the business brief’s named events and the product’s real call sites.
- Do not change working transactional mail paths unless the user explicitly
  asks for transactional email too.

## Lifecycle integration

At signup, upsert the person into Audience with their email, stable product user
id, and useful attributes already available at that call site. Emit the
activation and payment events from their real product moments, plus any other
events named in the business brief. Include `email` and `user_id` when
available.

With the Node SDK:

```bash
npm install @supersend/ranla
```

```ts
import { Ranla } from '@supersend/ranla'

const ranla = new Ranla(process.env.RANLA_API_KEY!)

await ranla.contacts.upsert({
  email: user.email,
  external_id: user.id,
  attributes: { plan: user.plan },
})

await ranla.events.trigger({
  name: 'user.activated',
  user_id: user.id,
  email: user.email,
  data: { plan: user.plan },
  idempotencyKey: `evt_user_activated_${user.id}`,
})
```

Use the product’s existing test conventions and add focused coverage when
practical. Do not dump full user records or invent a second analytics system.

## Optional transactional email

Ranla can also send transactional email through the same SDK:

```ts
await ranla.emails.send({
  from: 'you@yourdomain.com',
  to: user.email,
  subject: 'Your receipt',
  html: '<p>Thanks for your purchase.</p>',
})
```

This is supported but not required for the growth integration. Do not replace a
working provider or add a parallel mail path without an explicit request.

See [Ranla’s instrumentation quickstart](/instrument-quickstart) and
[Ranla MCP](/ai/mcp).
