# Cowliss

## Track an event, send an email

1. Install the SDK and create one client with your API key and source id.

   ```sh
   npm install @cowliss/sdk
   ```

   ```ts
   import { Cow } from "@cowliss/sdk";

   const cow = new Cow({
     apiKey: process.env.COW_KEY!,
     sourceId: process.env.COW_SOURCE_ID!,
   });
   ```

2. Track what happened. The profile is created on the first call.

   ```ts
   await cow.track({
     identifiers: { userId: "user_1", email: "ada@acme-demo.io" },
     event: "order.placed",
     properties: { orderId: "A-2291", total: 4200 },
   });
   ```

3. Send the receipt. The `from` address has to be on a domain your organization verified.

   ```ts
   const { deliveryId } = await cow.emails.send({
     to: "ada@acme-demo.io",
     from: "Acme <hello@acme.com>",
     subject: "Your receipt for A-2291",
     html: "<p>Thanks for your order.</p>",
   });
   ```

   `deliveryId` is the [delivery](/emails/delivery/) that records whether it arrived. To send a template from your repo instead, see [`emails.send`](/sdk/emails/).

That same `order.placed` event can start an automation that waits, checks, and emails on its own: the [Quickstart](/quickstart/) builds one.

## Add it with your agent

Paste this into Claude Code, Cursor, or any coding agent working in your repo:

```text
Add Cowliss to this app. Read https://docs.cowliss.com/llms.txt first, then
https://docs.cowliss.com/sdk/index.md.

1. Install @cowliss/sdk and create one Cow client, reading the API key from
   COW_KEY and the source id from COW_SOURCE_ID.
2. Call cow.identify when a user signs up or signs in, with their userId and email.
3. Call cow.track for the events this app already records (sign-up, purchase,
   and the like). Keep the event names this app already uses.
4. Send transactional email (receipts, password resets) with cow.emails.send
   instead of the current mail provider, from an address on our verified domain.

Do not await tracking calls on the request path; pass an onError that logs.
```

The commands, if you would rather run them yourself:

```sh
npm install @cowliss/sdk            # the client your app calls
npm install --save-dev @cowliss/cli # the cow CLI
npx cow login                       # browser sign-in, once
npx cow init                        # automations and email templates live in .cowliss/
```

Give the agent the product as tools with the MCP server: add
`https://api.cowliss.com/mcp` to any MCP client and sign in, or run the full
tool table locally:

```sh
claude mcp add cow -- npx -y @cowliss/cli mcp
```

Every page here is also markdown (append `index.md` to its URL), the site map is [`/llms.txt`](/llms.txt), and the API is [`/openapi.json`](/openapi.json). See [CLI and MCP for agents](/guides/agents/).

## Next

- [Quickstart](/quickstart/)
- [Your repo](/guides/repo/)
- [API reference](/reference/api/)
- [CLI reference](/reference/cli/)
