> ## 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.

# SatisMeter plugin

> Customer feedback with SatisMeter - read projects, surveys, responses and survey statistics, manage users and their traits, and record events that survey targeting can match on.

Use **SatisMeter** through Corsair: one client, typed API calls.

Create an API key in SatisMeter under Settings > Integrations > API. That page also shows the Project ID, and the Survey Keys section lists each survey's ID. The plugin needs both: no API endpoint lists projects, so the project ID has to come from the dashboard.

Things to know before you call:

* **Use the API key, not the read or write key.** In newer projects a read request made with the read key returns 403, and a Users API request made with the write key returns 403 too. Your browser snippet keeps using the write key; leave it as it is.
* **A 404 `Project not found` means the project ID.** Both bases look the project up before they check the key, so a wrong project ID answers 404 whichever key you send. A wrong key on the right project answers `403 Forbidden` on both bases.
* **One key, two bases.** Survey reads live under `/api/v3`; the users operations live under `/api` with no version. The plugin picks the base for each call.
* **Two calls page by cursor.** `responses.list` and `responses.listForSurvey` return at most 20 rows unless you pass `pageSize` (up to 100). Read `page.nextPageCursor` and pass it back as `pageCursor`; when it is absent there are no more pages.
* **The default date range is 30 days.** Both response listings only return the last month unless you pass `startDate`, so older responses need an explicit range.
* **A tracked event is not readable back.** `users.track` returns 204 and the event is stored, but the users API never exposes it: the `events` list in `users.list` holds survey activity (such as a filled response), not tracked events, and a track with no event name is rejected with `400 Event not specified`. Treat the 204 as acceptance, not as proof the event reached targeting. Survey targeting on events is configured in the dashboard.
* **Writes are not retried.** `users.track` counts the event every time it arrives and `users.upsert` re-applies traits, so a failed write is reported rather than replayed: the write may have landed. Reads are replayed on a 500 or a dropped connection.
* **`users.remove` is irreversible.** It takes the internal `id` from `users.list`, not the `userId` you sent, and deleting a user does not delete their responses: it anonymises them.
* **Personal data.** Responses carry the answering user's email, traits and IP address. The plugin stores none of it locally; `referrer` is returned because the API returns it, but it is never written to the event log, since a URL can carry a token.
* **No webhooks.** SatisMeter does not send them.

**What you get:**

* 10 typed API operations

## Setup

**1. Install**

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

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

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

```bash bun theme={null}
bun add corsair @corsair-dev/satismeter 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 { satismeter } from '@corsair-dev/satismeter';

export const corsair = createCorsair({
	plugins: [
		satismeter(),
	],
	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)
>
> No setup required yet. When you make your first request as a tenant, Corsair prompts for the API key.
>
> ```ts theme={null}
> satismeter()
> ```
>
> 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: 'satismeter',
	tenantId: 'acme',
});
// redirect the user's browser to connectUrl
```

## Example API calls

**List a project's surveys**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.satismeter.api.surveys.list({ projectId: '61fce0adea447e24ec27d606' });
```

**Record an event for survey targeting**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.satismeter.api.users.track({ projectId: '61fce0adea447e24ec27d606', userId: '007', event: 'completed-checkout' });
```

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

## What's next

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

> [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.