# Feedback and devices

> Report harmful content and manage push notification devices.

Source: https://maincode.com/docs/client-sdk-feedback-devices
Section: Client SDK · Matilda documentation

---

## Feedback

### `feedback.report(params, options?)`

Reports a message for harmful, inaccurate, off-topic, or privacy-violating content.

```ts title="report.ts"
await client.feedback.report({
  messageId: 'msg-456',
  conversationId: 'conv-123',
  reason: 'inaccurate',
  comment: 'The capital of Australia is Canberra, not Sydney.',
});
```

#### Parameters

| Field | Type | Description |
| - | - | - |
| `messageId` | `string` | The message being reported. |
| `conversationId` | `string` | The conversation containing the message. |
| `reason` | `'harmful' \| 'inaccurate' \| 'off_topic' \| 'privacy' \| 'other'` | Report reason. |
| `comment` | `string` | Optional additional context. |

Returns `Promise<{ reportId: string; acknowledgedAt: string }>`.

### `feedback.response(params, options?)`

Submits general response feedback (positive/negative sentiment with platform context).

```ts title="response.ts"
await client.feedback.response({
  messageId: 'msg-456',
  conversationId: 'conv-123',
  comment: 'Great answer!',
  platform: 'web',
  appVersion: '1.0.0',
});
```

#### Parameters

| Field | Type | Description |
| - | - | - |
| `messageId` | `string` | The message being rated. |
| `conversationId` | `string` | The conversation containing the message. |
| `comment` | `string` | Optional feedback text. |
| `platform` | `'web' \| 'ios' \| 'android' \| 'unknown'` | Client platform. |
| `appVersion` | `string` | App version string. |
| `buildNumber` | `string` | Build number. |

Returns `Promise<{ feedbackId: string; acknowledgedAt: string }>`.

### `feedback.reportBug(params, options?)`

Files a bug report from your application. Reports land as GitHub issues in the internal feedback repository — titled `[SDK] <title>` and labelled `sdk-feedback` — so engineering can triage them directly.

The SDK automatically stamps the report with its package name (`@maincode-ai/matilda-client-sdk`), package version, and — in Node — the Node.js version, so you usually only need `title` and `description`. Pass the optional fields to override or supply anything else.

```ts title="report-bug.ts"
await client.feedback.reportBug({
  title: 'stream() silently closes on 429',
  description: 'The stream closes without error when the API returns 429.',
  reproduction: 'Call chat.stream() in a loop until rate-limited; observe the close event.',
});
```

#### Parameters

| Field | Type | Description |
| - | - | - |
| `title` | `string` | One-line summary of the bug (required, max 200 chars). |
| `description` | `string` | What went wrong (required, max 4000 chars). |
| `reproduction` | `string` | Optional steps to reproduce (max 4000 chars). |
| `package` | `string` | Reporting package name — defaults to this SDK's package name. |
| `packageVersion` | `string` | Reporting package version — defaults to this SDK's version. |
| `nodeVersion` | `string` | Node.js version — auto-detected in Node, omitted in browsers. |
| `platform` | `'web' \| 'ios' \| 'android' \| 'unknown'` | Client platform. |
| `appVersion` | `string` | Your application's version string. |
| `idempotencyKey` | `string` | Optional key (max 128 chars) so retries don't create duplicate issues. |

Returns `Promise<{ feedbackId: string; acknowledgedAt: string }>`.

## Devices

### `devices.register(device, options?)`

Registers a push notification device.

```ts title="register.ts"
await client.devices.register({
  expo_push_token: 'ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]',
  device_id: 'device-uuid-123',
  platform: 'ios',
  app_version: '1.0.0',
});
```

#### `PushDevice`

| Field | Type | Description |
| - | - | - |
| `expo_push_token` | `string` | Expo push notification token. |
| `device_id` | `string` | Unique device identifier. |
| `platform` | `'ios' \| 'android'` | Device platform. |
| `app_version` | `string` | App version. |

Returns `Promise<{ status: string }>`.

### `devices.list(options?)`

Lists all registered push devices for the current user.

```ts
const devices = await client.devices.list();
for (const device of devices) {
  console.log(`${device.platform}: ${device.expo_push_token}`);
}
```

Returns `Promise<PushDevice[]>`.

### `devices.unregister(expoPushToken, options?)`

Unregisters a push device by its Expo push token.

```ts
await client.devices.unregister('ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]');
```

Returns `Promise<{ deleted: boolean }>`.
