> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Sender plugin

> Sender.net email marketing - subscribers, groups, segments, fields, campaigns and their reports, transactional emails, workflows, custom events and signed account webhooks.

Use **Sender** through Corsair: one client, typed API calls, local DB sync, and incoming webhooks.

Create an API access token in Sender under Settings > API access tokens; the plugin sends it as a Bearer token to [https://api.sender.net/v2](https://api.sender.net/v2).
Lists return `data`, `links` and `meta` (current\_page, last\_page, total). Paging and sorting inputs differ per operation: most take page and limit, some also order and direction (see each operation's inputs).
Sending (campaigns.send, campaigns.schedule, transactional.send, messages.send, workflows.start) emails real people and is marked destructive. Campaign and transactional sender addresses must be on a domain verified in the Sender account.
Webhooks: Sender signs each delivery with HMAC-SHA256 of the raw body (header X-Sender-Hmac-Sha256, lowercase hex) using the account's signing secret (Settings > Webhooks), stored as the webhook signature. After rotating it, store `<new>,<old>` for 10 minutes, then the new one alone. A `webhookSecret` plugin option replaces the stored secret, so with that option set, put the pair in the option instead. The body carries no topic: create each webhook with `?topic=<topic>` on its URL (for example `https://.../sender?topic=subscribers/new`). Without it, only groups/new, campaigns/new and bounces/new can be told apart by their payload.

**What you get:**

* 66 typed API operations
* 7 synced entities (`campaigns`, `fields`, `groups`, `segments`, `transactionalCampaigns`, `webhooks`, and 1 more) for fast `.search()` / `.list()`
* 8 incoming webhook event types

## Setup

**1. Install**

```bash npm theme={null}
npm install corsair @corsair-dev/sender better-sqlite3
npm install --save-dev @types/better-sqlite3
```

```bash yarn theme={null}
yarn add corsair @corsair-dev/sender better-sqlite3
yarn add --dev @types/better-sqlite3
```

```bash pnpm theme={null}
pnpm install corsair @corsair-dev/sender better-sqlite3
pnpm install --save-dev @types/better-sqlite3
```

```bash bun theme={null}
bun add corsair @corsair-dev/sender better-sqlite3
bun add --dev @types/better-sqlite3
```

**2. Add the plugin**

```ts corsair.ts theme={null}
import Database from 'better-sqlite3';
import { createCorsair } from 'corsair';
import { sender } from '@corsair-dev/sender';

export const corsair = createCorsair({
	plugins: [
		sender(),
	],
	database: new Database('corsair.db'),
	kek: process.env.CORSAIR_KEK!,
	multiTenancy: true,
	hub: {
		projectApiKey: process.env.CORSAIR_API_KEY!,
		signingSecret: process.env.CORSAIR_SIGNING_SECRET!,
	},
});
```

With `multiTenancy: true`, scope calls with `corsair.withTenant(id)`. See [Quick start](https://docs.corsair.dev/quick-start.md) for KEK + Hub keys, and [Multi-tenancy](https://docs.corsair.dev/concepts/multi-tenancy.md) for account isolation.

**3. Choose authentication**

> [tab] API Key (Recommended)
>
> Store the Sender API key before the first call: `pnpm corsair setup --plugin=sender --tenant=acme api_key=<your-key>` (leave out `--tenant` without `multiTenancy`), or pass it as `key` in the plugin options. With Hub, each tenant enters their own key on the connect page. See [API key auth](https://docs.corsair.dev/concepts/api-key).
>
> ```ts theme={null}
> sender()
> ```
>
> More: [API Key](https://docs.corsair.dev/concepts/api-key)

**4. Connect a tenant**

Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see [Connect / OAuth](https://docs.corsair.dev/management/connect).

```ts theme={null}
const { connectUrl } = await corsair.manage.connect.createLink({
	plugin: 'sender',
	tenantId: 'acme',
});
// redirect the user's browser to connectUrl
```

## Example API calls

**List subscribers**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.sender.api.subscribers.list({ limit: 10 });
```

**Create a group**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.sender.api.groups.create({ title: 'Newsletter' });
```

See the full list on the [API](https://docs.corsair.dev/plugins/sender/api.md) page.

## Query synced data

Synced entities support `tenant.sender.db.<entity>.search()` and `.list()`: `campaigns`, `fields`, `groups`, `segments`, `transactionalCampaigns`, `webhooks`, `workflows`.

See [Database](https://docs.corsair.dev/plugins/sender/database.md) for filters and operators.

## Webhooks

This plugin registers **8** webhook event types. Configure the provider to POST to your Corsair HTTP handler, then use `webhookHooks` on the plugin factory.

See [Webhooks](https://docs.corsair.dev/plugins/sender/webhooks.md) for every event path and payload shape, and [Webhooks concept](https://docs.corsair.dev/concepts/webhooks.md) for routing.

## What's next

> [card] [API reference](https://docs.corsair.dev/plugins/sender/api.md)
>
> Every `sender.api.*` operation with input and output types.

> [card] [Database](https://docs.corsair.dev/plugins/sender/database.md)
>
> Synced entities, search filters, and operators.

> [card] [Webhooks](https://docs.corsair.dev/plugins/sender/webhooks.md)
>
> Event paths, payloads, and `webhookHooks` examples.

> [card] [Connect / OAuth](https://docs.corsair.dev/management/connect)
>
> createLink, Hub delivery, and tenant connect flows.

> [card] [Use with agents](https://docs.corsair.dev/mcp-adapters/mcp-adapters)
>
> Expose this plugin's operations as MCP tools.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.