> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.recursiv.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.recursiv.io/_mcp/server.

# Notifications

## Overview

The notifications resource manages push notification tokens for mobile and web push.

## Register a push token

```typescript
import { Recursiv } from '@recursiv/sdk';

const r = new Recursiv();

// Register a push notification token (e.g., from Expo or Firebase)
await r.notifications.registerToken({
  token: 'ExponentPushToken[xxxxxxxxxxxx]',
  platform: 'ios', // 'ios' | 'android' | 'web'
});
```

## Unregister a token

```typescript
// Remove a push token when the user logs out or disables notifications
await r.notifications.unregisterToken({
  token: 'ExponentPushToken[xxxxxxxxxxxx]',
});
```

## Methods

| Method                                               | Description                        |
| ---------------------------------------------------- | ---------------------------------- |
| `r.notifications.registerToken({ token, platform })` | Register a push notification token |
| `r.notifications.unregisterToken({ token })`         | Remove a push notification token   |

## In-app notifications

For in-app notification feeds, use the inbox resource:

```typescript
// Get notification feed
const { data: items } = await r.inbox.list({ limit: 20 });

for (const item of items) {
  console.log(`${item.title} — ${item.status}`); // "unread" or "read"
}

// Mark as read
await r.inbox.markRead(item.id);
```

## Platform setup

### Expo (React Native)

```typescript
import * as Notifications from 'expo-notifications';

// Get the push token
const { data: token } = await Notifications.getExpoPushTokenAsync();

// Register with Recursiv
await r.notifications.registerToken({
  token: token,
  platform: Platform.OS, // 'ios' or 'android'
});
```

### Web Push

```typescript
// Get browser push subscription
const registration = await navigator.serviceWorker.ready;
const subscription = await registration.pushManager.subscribe({
  userVisibleOnly: true,
  applicationServerKey: vapidPublicKey,
});

await r.notifications.registerToken({
  token: JSON.stringify(subscription),
  platform: 'web',
});
```