# Using Nori

Nori is the customer layer for Resend and Stripe. It keeps one record per customer, built from the events your app sends, what they pay in Stripe and the emails your Resend account sends them. Connect Stripe first and it shows who left in the last 90 days and why, whose payment is failing now and whose trial ends this week. Then it runs four signals (trial ending before the goal, trial ending and ready to pay, stalled after signup, paying customer went quiet), posts each flag to Slack with its facts, and starts the right email through your own Resend account. This guide covers setup, the Stripe snapshot, the customer record, signals, the Resend and Slack outputs, plans, and the HTTP API.

## Getting started

Nori never sends email and never bills. Email belongs to Resend, billing belongs to Stripe, and the customer belongs to Nori. Set it up in this order:

1. **Connect Stripe** in **Setup**, with a restricted read-only key. Nori imports your customers and every subscription they've had, then shows who left in the last 90 days (and whether their card failed or they chose to), whose payment is failing now, whose trial ends this week, and trial to paid. It refreshes about every 30 minutes.
2. **Connect Resend** with an API key from your Resend account. From then on Nori keeps a copy of every email that account sends, syncs lists to Resend segments, and sends custom events that start your Automations. It also reads the emails your account sent recently, so records aren't empty until the first webhook.
3. **Send events from your app** with the HTTP API: `identify` when someone signs up, `track` when they do something that matters. See [Connect your app](https://nori.so/docs#quick-start).
4. **Pick your goal event** in **Setup**, from the events Nori has received. The goal is the one event that means a customer got value, such as a first deploy.
5. **Preview each signal, then turn it on.** Each signal shows who it would flag right now before anything reaches Slack or Resend.
6. **Optional: add Slack.** Install the Nori app and pick a channel. Every flagged customer posts there with the facts behind it, and the first time a channel is picked Nori posts one digest of your Stripe customers.

## Your Stripe snapshot

The first screen after Stripe connects, before any event has been sent. It is in **Setup** under Connect Stripe, on **Home**, and on its own page, **Your Stripe customers**. Every name opens the customer. The numbers refresh with each Stripe import, about every 30 minutes, and cover the last 90 days.

| Section | What counts |
| --- | --- |
| Lost in the last 90 days | Paying subscriptions that ended in the last 90 days, where the customer has no live subscription left (a plan change is not a loss). Split by Stripe's cancellation reason: **chose to cancel**, **card failed**, or other. The lead line says how many didn't choose to leave. |
| Payment failed now | Customers whose subscription Stripe says is past due or unpaid. |
| Trials ending in the next 7 days | Customers on a Stripe trial that ends within 7 days, with what they'd pay. Once Nori has events for them it shows their last event and whether they reached the goal; until then the row says “Send events to see”. |
| Trial → paid | Customers whose trial ended in the last 90 days, and how many of them kept a subscription after it. Under 5 trials it shows counts only, no percentage. |

Every list is per Stripe customer: several subscriptions make one row, with their amounts added up.

## Customers

Every customer has one record. It holds their details from `identify`, their event timeline from `track`, their Stripe plan, MRR, trial and subscription dates, every email your Resend account has sent them since you connected it, and the notes and tags your team adds. Details from your app and from Stripe are read-only, because the next sync would overwrite a hand edit. Notes and tags sit alongside them.

Nori works out a stage for each customer from their Stripe status, the goal event and the went-quiet signal. The first row that matches wins:

| Stage | Means |
| --- | --- |
| Churned | Stripe says the subscription was canceled. |
| Payment failed | Stripe says the subscription is past due or unpaid. |
| At risk | The went-quiet signal currently flags them (whether or not that signal is turned on). |
| Paying | Stripe says the subscription is active. |
| Reached the goal | Did the goal event and is not paying yet. |
| On a trial | Stripe says the subscription is trialing, or there is no Stripe subscription and a `trialEndsAt` detail from `identify` is still in the future. |
| Signed up | Known to Nori, with none of the above yet. |

**Lists** are saved filters over customers, built from their details, events and Stripe state, such as “on a trial, signed up this month, never did the goal event”. Describe one in plain words or build it from the filter chips. Each list shows its count and the customers that match, with the reason each one matches, and can sync to Resend as a segment.

## Signals

A signal is a fact about one customer worth acting on. Nori runs four, every 15 minutes. Three need your goal event; the fourth only needs Stripe and whether events arrive at all.

| Signal | Fires when |
| --- | --- |
| Trial ending, goal not reached | On a trial that ends in the next 3 days, never did the goal event, and is not paying. |
| Trial ending, ready to pay | On a trial that ends in the next 3 days, did the goal event, and is not paying yet. |
| Stalled after signup | Signed up 3 to 30 days ago, never did the goal event, is not on a trial, is not paying, and has not canceled. |
| Paying customer went quiet | Paying (Stripe status active), no events in the last 7 days, and at least 8 events in the 4 weeks before that (about twice a week). Not flagged while a teammate is active: another customer with the same `accountId` detail or the same Stripe customer sent an event in the last 7 days. |

“On a trial” means Stripe says the subscription is trialing, or there is no Stripe subscription and a `trialEndsAt` detail came with `identify` (see [Trial dates](https://nori.so/docs#trial-dates)). Events dated in the future are ignored.

Every flagged customer shows the facts that made the signal fire. The trial signals show the trial end date, the goal event and how many times they did it, their signup date and their plan. Stalled after signup shows the signup date, the goal event, and their last event and when. Paying customer went quiet shows the last event and when, their usual use (“About 28 events a week”), their plan and MRR, and when they became a customer.

- **Flagged once until it clears.** A customer is flagged once per signal. When they stop matching (they pay, do the goal event, or send events again), the flag clears, and they can be flagged again later.
- **Preview before turning on.** Signals run as soon as your workspace exists, so each one lists who it would flag right now, with the evidence, while it is still off. Nothing is sent until you turn it on. There is no replay of past days: Stripe only tells Nori the current state.
- **Turn on with or without the customers already flagged.** When you turn a signal on, only customers flagged from then on go to Slack and Resend, unless you choose to also send the ones flagged now. Connecting Slack or Resend later does not send older flags.
- **Mark a flag wrong** on the signal's page when Nori got it wrong, and undo it if you change your mind. Results count how many were marked, so you can see which signals are noisy.
- **Results.** Each signal's page shows who was flagged, who then reached the goal, who paid, and who was marked wrong, by name, for the last 30 and 90 days. “Paid” means paying now for the trial and stalled signals, still paying for went quiet. Results count every flag, whether or not it was sent. Nori counts what happened; it cannot prove the email caused it.

## Trial dates

Nori reads trial end dates from Stripe, so trials that run as a Stripe subscription in `trialing` status need no extra work.

If your trial does not live in Stripe (for example, no card up front and no subscription until they pay), send the end date as a detail with `identify`. Use `trialEndsAt` as an ISO 8601 timestamp:

**Trial end date from your app**

```json
{
  "userId": "user_123",
  "email": "jane@example.com",
  "traits": { "name": "Jane Cooper", "trialEndsAt": "2026-10-17T00:00:00Z" }
}
```

> **Note:** Send the detail again if the trial is extended, so the signals use the new date.

## Teams

If several customers share one plan, send the same `accountId` detail with `identify` for each of them. Paying customer went quiet then stays quiet while any of them is active. Customers that share a Stripe customer count as a team too.

**Two customers on one plan**

```json
{ "userId": "user_123", "email": "jane@example.com", "traits": { "accountId": "acct_acme" } }
{ "userId": "user_456", "email": "wade@example.com", "traits": { "accountId": "acct_acme" } }
```

## Resend Automations

When a signal flags a customer, Nori sends a custom event named `nori.<signal>` to your Resend account, using your own Resend key, so a Resend Automation can start on it and send the email from your domain. The event goes only to customers with an email address who have not unsubscribed. When a flag that reached Resend clears, Nori sends `nori.<signal>.cleared`, so an Automation that waits can stop.

| Signal | Event name |
| --- | --- |
| Trial ending, goal not reached | `nori.trial_ending_no_goal` |
| Trial ending, ready to pay | `nori.trial_ending_ready_to_pay` |
| Stalled after signup | `nori.stalled_after_signup` |
| Paying customer went quiet | `nori.paying_went_quiet` |

To start an Automation when a trial is ending before the goal:

1. In Resend, open **Automations** and create a new Automation.
2. For the trigger, choose a custom event and enter `nori.trial_ending_no_goal`.
3. Add the email step. Payload fields such as `firstName` and `goalEvent` are available to the template and to conditions.
4. Turn the Automation on in Resend, then turn the signal on in Nori. Resend creates a contact for the email if one does not exist yet.

From **Setup** you can send a `nori.test` event to your own address, to check an Automation trigger before a real flag fires.

Each event carries a `payload`. Dates are ISO 8601 and missing values are `null`:

| Event | Payload fields |
| --- | --- |
| Every event | `signal` (the signal's name without the `nori.` prefix), `contactExternalId` (your user ID), `firstName` |
| `nori.trial_ending_no_goal`, `nori.trial_ending_ready_to_pay` | plus `trialEndsAt`, `goalEvent`, `goalCount`, `signedUpAt`, `plan` |
| `nori.stalled_after_signup` | plus `signedUpAt`, `goalEvent`, `lastEventName`, `lastEventAt` |
| `nori.paying_went_quiet` | plus `lastEventName`, `lastEventAt`, `eventsPerWeek`, `plan`, `mrrCents`, `subscribedAt` |
| `nori.<signal>.cleared` | `signal`, `contactExternalId` only |

**Example: the event Resend receives**

```json
{
  "event": "nori.paying_went_quiet",
  "email": "jane@example.com",
  "payload": {
    "signal": "paying_went_quiet",
    "contactExternalId": "user_123",
    "firstName": "Jane",
    "lastEventName": "pipeline_run",
    "lastEventAt": "2026-10-01T09:14:00Z",
    "eventsPerWeek": 28,
    "plan": "Team",
    "mrrCents": 50000,
    "subscribedAt": "2026-06-12T08:30:00Z"
  }
}
```

Each signal you have turned on also has a list, synced to your Resend account as a segment named `Nori: <signal title>` (for example `Nori: Paying customer went quiet`), for a Broadcast or for conditions inside an Automation. It holds the customers flagged while the signal was on, until their flag clears. Customers flagged while it was off are not on it. Customers Nori knows are unsubscribed are never added, and Nori never changes Resend's unsubscribe flag.

> **Note:** Custom events and list syncs use your Resend key and count against Resend's rate limit of 10 requests a second per team. Nori spaces its calls to Resend to about 5 a second and backs off when Resend asks.

## Slack

In **Setup → Add Slack**, add the Nori app to your Slack workspace, then pick the channel where signals post. To use a private channel, invite @Nori to it in Slack first. Send a test post from Setup to see where signals land. Nori posts one message per flagged customer. The message names the signal and the customer, lists the facts that made it fire (for example the last event and when, their usual use per week, their plan and MRR, when they became a customer, or the trial end date), and links to their record in Nori.

Messages are post-only. There are no buttons or threads to act on in Slack. Anything you do about a customer happens in Resend, in Stripe, or on their record.

## Connect your app

1. In Nori, open **Setup → Send events from your app** and create a key. It starts with `nori_sk_`.
2. Save it on your server as `NORI_API_KEY`. Never put it in browser or mobile code.
3. Send `identify` to create or update a customer, using your app's user ID. Include `signedUpAt`, because the stalled and trial signals count from it.
4. Send `track` for the product actions that matter, including the one you will pick as the goal event.
5. In Nori, open **Setup → See all events**. Each event shows **Received** once it arrives.

Using Claude Code, Cursor or another coding agent? Go to [Set up with a coding agent](https://nori.so/docs#agents).

## Set up with a coding agent

Use this prompt in your app's repository. Tell the coding agent which details and product events you need.

**Prompt**

```text
Add Nori to this app. Nori keeps one record per customer from our product
events, Stripe and Resend, and flags who is about to pay or leave. Read the full
guide first:
https://nori.so/docs.md

Then:
1. Add one server-only module that calls Nori over plain HTTP. No SDK.
   Read the key from the NORI_API_KEY env var. Add it to the env example file.
2. Call identify when a user is created or their relevant details change.
   userId is our database's user ID, never the email. Include signedUpAt.
   If our trials do not live in Stripe, include trialEndsAt (ISO 8601) in traits.
3. Ask which product events matter, unless supplied. One of them is the goal
   event: the action that means a customer got value. Use exact event names.
4. Call track after each relevant action has been saved successfully.
   Use one stable messageId per occurrence; reuse it only when retrying that event.
5. Wherever Stripe customers are created, set metadata.userId to our user ID,
   so Nori can join billing to the right customer.
6. Send calls from background jobs. Retry network errors and 5xx responses;
   fix invalid requests or credentials before retrying 400 or 401 responses.
   A Nori failure must never block the user's action.

When you're done, list every file you changed and where each event fires.
```

Agents can read this page as Markdown at [`/docs.md`](https://nori.so/docs.md). There's a short index at [`/llms.txt`](https://nori.so/llms.txt).

## API authentication

**Every request**

```text
Base URL:      https://api.nori.so
Method:        POST
Auth header:   Authorization: Bearer nori_sk_…
Content-Type:  application/json
```

- Each key belongs to one workspace. Create keys in **Setup → Send events from your app**; the list of keys, and revoking one, is in **Settings**.
- Call the API from your server only. Anyone with the key can add customers to your workspace.
- Timestamps are ISO 8601 strings with a time zone, like `2026-10-02T09:14:00Z`. Milliseconds since 1970 work too.
- Bodies can be up to 1 MB.

## identify: create or update a customer

Use `identify` to create a customer record or update an existing one. Send it when someone signs up, when their details change, or when importing existing customers.

**POST /v1/identify**

```bash
curl -X POST https://api.nori.so/v1/identify \
  -H "Authorization: Bearer $NORI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "userId": "user_123",
    "email": "jane@example.com",
    "traits": { "name": "Jane Cooper", "plan": "free" },
    "signedUpAt": "2026-10-02T09:14:00Z"
  }'
```

| Field | Type | What it is |
| --- | --- | --- |
| `userId` | string, required | Your app's ID for this customer, up to 256 characters. Use your database ID, not the email. |
| `email` | string | The address Resend knows them by. Nori uses it to match their emails and to send signal events to Resend. Without it, no email history and no Resend events. |
| `traits` | object | Details about the customer, such as `name`, `company`, `plan`, `trialEndsAt` or `accountId`. Supplied fields replace existing values; omitted fields are kept. |
| `signedUpAt` | timestamp | When they signed up in your app. The stalled and trial signals count from it. If it's missing, Nori uses `traits.createdAt` or `traits.created_at`, then the first time it saw them. |
| `timestamp` | timestamp | When this happened. It counts as activity, so leave it out when you import old data. |

**Response**

```json
{ "ok": true, "contactId": "…", "created": true }
```

`created` is `false` when the customer already existed. Nori takes the name from `traits.name`, or from `firstName` and `lastName` (or `first_name` and `last_name`). If you leave out `email`, it reads `traits.email`.

> **Note:** `identify` updates the record but does not record an event. If a list depends on `signed_up`, send that event with `track` too.

## track: record a product event

Use `track` to record a completed action, such as deploying a pipeline or inviting a teammate. Send it once your app has saved the action.

**POST /v1/track**

```bash
curl -X POST https://api.nori.so/v1/track \
  -H "Authorization: Bearer $NORI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "userId": "user_123",
    "event": "deployed_pipeline",
    "properties": { "pipeline": "main" },
    "messageId": "deployed_pipeline:user_123:first"
  }'
```

| Field | Type | What it is |
| --- | --- | --- |
| `userId` | string, required | The same ID you send to `identify`. |
| `event` | string, required | The event name, up to 128 characters. Use a consistent format, such as `deployed_pipeline`. The goal event and list rules match names exactly. |
| `properties` | object | Details stored with this event, such as the pipeline ID or feature name. |
| `timestamp` | timestamp | When it happened. Defaults to now. Set it when you import old events. |
| `messageId` | string | A unique ID for this occurrence, up to 256 characters. Nori stores it once per workspace. Reuse it for retries; use a new ID for the next occurrence. |
| `email` | string | The customer's email, if you never sent `identify` for them. |

**Response**

```json
{ "ok": true, "contactId": "…", "eventId": "…", "duplicate": false }
```

`duplicate` is `true` when Nori already has that `messageId`. No second event is stored, and `eventId` is `null`. If the `userId` is new, `track` creates the customer.

## Example: the events a signal uses

The trial and stalled signals need two things from your app: when each customer signed up, and whether they did the goal event. Signup comes from `identify`'s `signedUpAt`. The goal comes from a `track` event you name after the action, such as `deployed_pipeline`, and pick as the goal in Nori.

**Example timeline**

```text
Oct 2   identify  user_123  jane@example.com  signedUpAt Oct 2   → Signed up
Oct 2   Stripe: subscription trialing, trial ends Oct 16        → On a trial
Oct 5   track     user_123  deployed_pipeline                   → Reached the goal
Oct 13  trial ends in 3 days, goal reached, not paying          → Trial ending, ready to pay
        Nori posts to Slack and sends nori.trial_ending_ready_to_pay to Resend
Oct 15  Stripe: subscription active                             → Paying; the flag clears
```

Had Jane never deployed, the same trial would have fired “Trial ending, goal not reached” on Oct 13 instead, with `goalCount` 0 in the payload, and “Stalled after signup” from Oct 5.

## batch: import customers and events

Use `batch` to import customers and old events, or to send many calls in 1 request. Each item is an `identify` or `track` call with a `type` field.

**POST /v1/batch**

```bash
curl -X POST https://api.nori.so/v1/batch \
  -H "Authorization: Bearer $NORI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "batch": [
      { "type": "identify", "userId": "user_123", "email": "jane@example.com",
        "signedUpAt": "2026-09-01T10:00:00Z" },
      { "type": "track", "userId": "user_123", "event": "deployed_pipeline",
        "timestamp": "2026-09-03T10:00:00Z", "messageId": "deployed_pipeline:user_123:first" }
    ]
  }'
```

- Up to 1,000 items per request, and 1 MB per body. Chunks of 500 are a safe size.
- Nori runs every `identify` first, then every `track`.
- If any item has a bad field, Nori rejects the whole request with a 400.
- Set `timestamp` and `signedUpAt` to the real dates. Then signals and lists like “signed up last week” work from day 1.

**Response**

```json
{ "ok": true, "processed": 2, "errors": [] }
```

A 200 response can still contain item errors. Check `errors` for `{ index, error }` entries; `index` is the zero-based position in your input array. Retry failed items after fixing their errors.

## Send events reliably

- **Send from your server**, after the action is saved.
- **Use a background job.** On serverless hosts, a promise you don't wait for can be dropped when the request ends.
- **Retry** network errors and 5xx responses. Reuse the same `messageId`, so a retry is never counted twice.
- **Don't retry** a 400 or 401. Fix the request or the key first.
- **Keep your app independent of Nori.** Log failed calls and retry them in the background without blocking the user's action.
- **Use the same `userId`** in every call for a customer, and set it as `metadata.userId` on their Stripe customer.
- **Don't send secrets.** No passwords, tokens or card numbers in details or event properties.

This TypeScript helper sends requests with `fetch`. Call it from your job runner, where you configure retries. You can use the same endpoints from any language that supports HTTP.

**lib/nori.ts**

```ts
// Server only. Nori is plain HTTP, so there's no SDK.
const NORI_API_URL = "https://api.nori.so"

async function send(path: "identify" | "track" | "batch", body: unknown) {
  const res = await fetch(`${NORI_API_URL}/v1/${path}`, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.NORI_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify(body),
    signal: AbortSignal.timeout(5_000),
  })
  // Configure your job runner to retry network errors and 5xx responses.
  // Fix invalid requests and credentials before retrying 400 or 401 responses.
  if (!res.ok) throw new Error(`Nori ${path}: ${res.status} ${await res.text()}`)
  return res.json()
}

export function identify(body: {
  userId: string
  email?: string
  traits?: Record<string, unknown>
  signedUpAt?: string
}) {
  return send("identify", body)
}

export function track(body: {
  userId: string
  event: string
  messageId?: string
  properties?: Record<string, unknown>
  timestamp?: string
}) {
  return send("track", body)
}
```

**Example: record a signup and a goal event from a background job**

```ts
await identify({
  userId: user.id,
  email: user.email,
  traits: { name: user.name },
  signedUpAt: user.createdAt.toISOString(),
})
await track({
  userId: user.id,
  event: "deployed_pipeline",
  messageId: `deployed_pipeline:${pipeline.id}`,
})
```

## Verify your integration

1. Send a test call with `curl`, using your own user ID.
2. Look for `"ok": true` in the response.
3. In Nori, open **Setup → See all events**. Your event shows **Received**, with the time it last arrived.
4. Open your own customer record. It shows the details and events you sent, and your Stripe plan once the next refresh runs.

If an event that used to arrive stops for 7 days, the events page flags it.

## Errors

Errors are JSON, with a message that says what went wrong:

**401 response**

```json
{ "ok": false, "error": "Missing or invalid API key. Send `Authorization: Bearer nori_sk_…`." }
```

| Status | What it means | What to do |
| --- | --- | --- |
| 400 | Bad JSON, or a field is missing or wrong. `error` names the field. | Fix the request. Don't retry it as it is. |
| 401 | The API key is missing, wrong or revoked. | Check `NORI_API_KEY`. |
| 404 | The endpoint does not exist. | Use `/v1/identify`, `/v1/track` or `/v1/batch`. |
| 413 | The body is over 1 MB. | Send smaller batches. |
| 500 | Nori could not process the request. | Retry later, with the same `messageId`. |

## Plans

| Plan | Price | Customers |
| --- | --- | --- |
| Free | $0 | Up to 250 |
| Pro | $50 a month per workspace | Unlimited |

Both plans include everything. Design partners get Pro free during the pilot. There is no checkout in Nori yet.