> This page is part of EVVA for Developers (https://developers.evvahub.com), the documentation of the EVVA Partner API. The API is in developer preview and the SDK packages are not yet published: do not suggest installing them. Index: https://developers.evvahub.com/llms.txt

# TypeScript SDK

## Requirements

| Requirement          | Detail                                                                                                     |
| -------------------- | ---------------------------------------------------------------------------------------------------------- |
| Node.js              | **22 or later** — supported 22, 24 and 26; **24 LTS recommended**. Node.js 20 and older are not supported. |
| Runtime dependencies | None                                                                                                       |
| Module formats       | ES modules and CommonJS                                                                                    |

## Install

> **Info**
>
> Coming at general availability. Until then, this page shows the requirements and how the SDK is used.

## Configure

**`client.ts`**

```typescript title="client.ts"
import { EvvaPartnerClient } from '@evvahub/partner-sdk';

export const evva = new EvvaPartnerClient({
  baseUrl: 'https://api.evvahub.com',
  credentials: {
    method: 'client_secret_basic', // or 'client_secret_post'
    clientId: process.env.EVVA_CLIENT_ID!,
    clientSecret: process.env.EVVA_CLIENT_SECRET!,
  },
});
```

`private_key_jwt` keeps every secret inside your infrastructure — register the **public** key in the Partner Hub and
keep the private key in your secret manager:

**`private_key_jwt`**

```typescript title="private_key_jwt"
credentials: { method: 'private_key_jwt', clientId, privateKey: pem, keyId: 'key-2026-12', algorithm: 'ES256' }
```

**`Create an ES256 key pair`**

```bash title="Create an ES256 key pair"
openssl ecparam -name prime256v1 -genkey -noout | openssl pkcs8 -topk8 -nocrypt -out evva-app.pem
openssl pkey -in evva-app.pem -pubout -out evva-app.pub.pem
```

Each token request signs a fresh assertion. To rotate, register the new public key, switch `keyId` and `privateKey`,
then remove the old key. See [Requesting tokens](/authentication/tokens).

## First calls

**`first-calls.ts`**

```typescript title="first-calls.ts"
const me = await evva.app.me();
console.log(me.application.name, me.environment, me.scopes);

const { items } = await evva.accounts.list();
for (const account of items) console.log(account.creatorId, account.scopes);
```

Every operation of the [API reference](/api-reference) is reachable and typed — request bodies, queries, path
parameters and answers — through the resource helpers or `evva.call('<operationId>', …)`. Lists have async iterators
(`iterate()`).

## Receive events and reply

**`bot.ts`**

```typescript title="bot.ts"
import { EvvaPartnerClient, isEventType } from '@evvahub/partner-sdk';

const me = await evva.app.me();

const stream = evva.eventStream({
  consumerId: 'my-bot',
  applicationId: me.application.id, // the application's id — never the OAuth client id
  handler: async (event) => {
    if (!isEventType(event, 'message.received')) return;
    await evva.messages.sendText(event.creatorId!, event.data.conversationId, 'Thanks — we will get back to you!', {
      idempotencyKey: `reply-to-${event.data.messageId}`,
    });
  },
});
evva.shutdownOnSignals();
await stream.start();
```

Give a production consumer **durable** stores: `FileCheckpointStore` / `FileDedupStore` on one host, or your own
`CheckpointStore` and `DedupStore` on a shared database. The in-memory stores are for tests.

| You want                     | Use                                                                                      |
| ---------------------------- | ---------------------------------------------------------------------------------------- |
| Low latency and no loss      | `evva.eventStream({…})` — realtime plus feed catch-up, one handler, shared deduplication |
| Batch, cron or replay        | `evva.feedConsumer({…}).drain()`                                                         |
| A long-running feed consumer | `evva.feedConsumer({…}).start()`                                                         |

## Errors

| Error                                       | When                                                                                                |
| ------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| `ValidationError`                           | `400`                                                                                               |
| `AuthError`                                 | `401`                                                                                               |
| `PermissionError`                           | `403`                                                                                               |
| `NotFoundError`                             | `404`                                                                                               |
| `ConflictError`, `IdempotencyConflictError` | `409`                                                                                               |
| `CursorExpiredError`                        | `410 CURSOR_EXPIRED`                                                                                |
| `RateLimitedError`                          | `429` — `retryAfterMs`, `level`                                                                     |
| `ServerError`, `NetworkError`               | `5xx`, no response                                                                                  |
| `ApprovalRequiredError`                     | `202 APPROVAL_REQUIRED` — `approvalId`, `expiresAt`. Nothing was done; see [Approvals](/approvals). |

## Webhooks

**`webhooks.ts`**

```typescript title="webhooks.ts"
import { FileDedupStore, WebhookHandler } from '@evvahub/partner-sdk';

const webhooks = new WebhookHandler({
  secret: [process.env.EVVA_WEBHOOK_SECRET!, process.env.EVVA_WEBHOOK_SECRET_PREVIOUS!].filter(Boolean),
  dedupStore: await FileDedupStore.open('./.evva/dedup.log'),
  onEvent: async (event) => queue.push(event),
});

const result = await webhooks.handle({ headers: req.headers, body: rawBody }); // the RAW body
res.status(result.status).end(); // 204 handled/duplicate · 401 signature · 400 payload · 500 retry me
```

## Polling statuses that have no event

**`waiters.ts`**

```typescript title="waiters.ts"
const { state } = await evva.media.waitUntilProcessed(creatorId, mediaAssetId); // ready | failed | unavailable
const post = await evva.content.waitUntilPublished(creatorId, contentId);
```

Waiters back off with full jitter (1 s doubling to 30 s), honour `Retry-After`, and give up after 10 minutes.

## Next steps

#### [Quickstart](/quickstart)

Your first integration, end to end.

#### [Webhooks](/webhooks/overview)

Subscribe and verify.

#### [Realtime](/realtime)

The protocol under the event stream.

#### [API reference](/api-reference)

Every operation.