# In-app feedback

> Let people tell you what went wrong or what they think, with a feedback button and dialog in the browser (screenshots and files optional), captureFeedback in every other SDK except React Native, and an API for feedback from support, CRM and review tools.

Source: https://apphelm.dev/docs/feedback

Feedback is what a person tells you in their own words: "the export failed twice", "I love the new editor". AppHelm stores it once, scrubbed of emails and secrets, and shows it in **Product fit & feedback → Feedback**. When it is about an error, it also shows on that error's issue.

There are three ways in:

| Way | Where | What it is |
| --- | --- | --- |
| Feedback button and dialog | Browser | A ready-made form, with an optional screenshot and file. No code beyond one call |
| `captureFeedback` | Browser, iOS, Android, Flutter, Node, Python, Go, Ruby, PHP, .NET, Rust, Elixir | Send a message from your own UI, optionally about an error |
| Feedback API | Any server | Bring in feedback from support tickets, CRM notes, calls, reviews or cancellation forms |

React Native has no feedback API. Surveys are different: you ask the question and choose when (see [Surveys](https://apphelm.dev/docs/surveys)); their answers appear in the same Feedback list.

## Add a feedback button in the browser

`feedbackButton` adds a floating **Feedback** button at the bottom right of the page. It opens a short form: a text box, **Send feedback** and **Cancel**.

JavaScript (browser):
```js
import { createBrowserSdk } from "@sansavision/apphelm/browser";
import { feedbackButton } from "@sansavision/apphelm/user-feedback";

const analytics = createBrowserSdk({ key: "ahl_pub_…", workspaceId: "org_…", productId: "prd_…" });

const button = await feedbackButton(analytics, { label: "Feedback", position: "right" });
// button.remove() takes it away again
```

React:
```tsx
import { useEffect } from "react";
import { useApphelm } from "@sansavision/apphelm/react";
import { feedbackButton } from "@sansavision/apphelm/user-feedback";

function FeedbackButton() {
  const client = useApphelm();
  useEffect(() => {
    if (!client) return;
    const mounted = feedbackButton(client);
    return () => { void mounted.then((button) => button.remove()); };
  }, [client]);
  return null;
}
```

Vue / Nuxt:
```ts
import { useApphelm } from "@sansavision/apphelm/vue";
import { feedbackButton } from "@sansavision/apphelm/user-feedback";

const client = useApphelm();
if (client) await feedbackButton(client);
```

Svelte / SvelteKit:
```ts
import { onMount } from "svelte";
import { feedbackButton } from "@sansavision/apphelm/user-feedback";

// `apphelm` is the object createApphelm() returned in your layout.
onMount(() => { const mounted = feedbackButton(apphelm.client); return () => void mounted.then((b) => b.remove()); });
```

To open the same form from your own link or menu item, call `showReportDialog()` without an event id:

JavaScript (browser):
```js
document.querySelector("#send-feedback").addEventListener("click", () => analytics.showReportDialog());
```

The button and the dialog load only when used, follow the page's light or dark scheme, fit a 320 px wide screen, trap focus while open, close on **Escape** and return focus afterwards. **Send** stays disabled until something is typed. The dialog asks for no name or email.

Feedback doesn't wait for analytics consent: the person chose to send it. Only `enabled: false` stops it.

## Ask about an error

Pass the event id that `captureException` returned. The dialog then says "It looks like something went wrong." and its report shows on that error's issue, on the **Feedback** tab.

JavaScript (browser):
```js
try {
  await exportReport();
} catch (error) {
  const eventId = analytics.captureException(error);
  analytics.showReportDialog({ eventId });
}
```

React:
```tsx
import { ApphelmErrorBoundary } from "@sansavision/apphelm/react";

// Inside <ApphelmProvider>: after a render error, the boundary reports it and opens the dialog.
<ApphelmErrorBoundary fallback={<p>Something went wrong.</p>} showDialog>
  <Checkout />
</ApphelmErrorBoundary>
```

**Only for React, Next.js:**

`showDialog` takes `true` or the dialog's text (below). For an error you caught yourself, render `<ErrorReportDialog eventId={eventId} onClose={…} />` from `@sansavision/apphelm/react`; it needs an `eventId`, and has no screenshot or file option. `@sansavision/apphelm/next` re-exports `ApphelmErrorBoundary`; import `ErrorReportDialog` from `/react`.

`analytics.lastEventId()` returns the id of the last error, message or event captured, if you don't have it at hand.

## Send feedback from your own UI

`captureFeedback` sends a message you collected yourself. `associatedEventId` is optional and links it to an error.

JavaScript (browser):
```js
const id = await analytics.captureFeedback({ message: form.message.value, associatedEventId: analytics.lastEventId() });
// id is the stored feedback's id, or null when it wasn't sent
```

iOS (Swift):
```swift
try await apphelm.captureFeedback("The app froze when I tapped Pay", associatedEventId: apphelm.lastEventId)
```

Android (Kotlin):
```kotlin
Apphelm.captureFeedback("The checkout froze after I paid", associatedEventId = Apphelm.lastEventId()) { stored ->
    // FeedbackResult(id, profileId, replayed), or null when it wasn't sent. Runs on a background thread.
}
```

Flutter:
```dart
final saved = await apphelm.captureFeedback('The checkout button did nothing', associatedEventId: apphelm.lastEventId);
```

Node.js:
```ts
// The key needs feedback:write.
await apphelm.captureFeedback({ message: "It failed when I paid", associatedEventId: apphelm.lastEventId() });
```

Python:
```python
apphelm.capture_feedback("The export failed twice", associated_event_id=apphelm.last_event_id())
```

Java / Kotlin (JVM):
```kt
// Blocking: call it off the main thread.
val result = apphelm.captureFeedback("The export failed twice", associatedEventId = eventId)
```

Go:
```go
result, err := client.CaptureFeedback(ctx, apphelm.Feedback{
	Message:           "The export button did nothing",
	AssociatedEventID: client.LastEventID(),
})
```

Ruby:
```ruby
APPHELM.capture_feedback("The export button does nothing", associated_event_id: APPHELM.last_event_id)
```

PHP:
```php
$result = $apphelm->captureFeedback(
    message: $request->input('message'),
    associatedEventId: $apphelm->lastEventId(),
);
```

.NET (C#):
```cs
FeedbackResult? stored = await apphelm.CaptureFeedbackAsync("The export button does nothing", apphelm.LastEventId);
```

Rust:
```rs
let mut feedback = Feedback::new("The export button does nothing");
if let Some(id) = apphelm.last_event_id() { feedback = feedback.associated_event_id(id); }
let stored = apphelm.capture_feedback(feedback)?;
```

Elixir:
```ex
{:ok, %{"id" => _}} = Apphelm.capture_feedback(%{message: "The export never finished", associated_event_id: Apphelm.last_event_id()})
```

Every SDK scrubs the message of emails and secrets and cuts it to 5,000 characters before sending. `name` and `email` are accepted, as Sentry's SDKs take them, and are never sent.

Outside the browser, `captureFeedback` posts to `POST /api/v1/feedback` with the SDK's key, which **needs the `feedback:write` scope**. It is stored as `human` feedback with `private_analysis` permission (see [Permission](#permission)), with the release and environment as metadata.

> **Mobile keys:** A mobile app's key normally has only `events:write` ([Keys, scopes and environments](https://apphelm.dev/docs/keys-and-environments)). To send feedback from the app you must add `feedback:write` to that key. Anyone who extracts the key from the app can then send any feedback to the product through the API, so only do this if you accept that, and watch the Feedback list for abuse.

What each SDK does when sending fails or is off:

| SDK | Returns | Opted out or `enabled: false` |
| --- | --- | --- |
| Browser | The id, or `null` (`sendFeedback` instead rejects with an error that says what to do) | Not sent with `enabled: false`; sent while analytics consent is withheld |
| iOS | `FeedbackResult?`; throws `invalid_feedback` for an empty message and when the server refuses | Returns nil |
| Android | `onResult(null)`; the core client returns null and throws for a blank message | Returns null |
| Flutter | `ApphelmFeedbackResult?`, null on failure; `ArgumentError` for an empty message | Dropped while opted out (null); null with `enabled: false` |
| Node | `{ id, profileId, replayed }`; throws without a product or message | Dropped |
| Python, Go, Ruby, PHP, .NET, Rust, Elixir | The stored result, or that SDK's "dropped" value or error | Dropped |

## Screenshots and files (browser)

Both are off by default. Turn them on for the button or the dialog:

JavaScript (browser):
```js
feedbackButton(analytics, { screenshot: true, attachments: true });
analytics.showReportDialog({ eventId, screenshot: true, attachments: true });
```

- **`screenshot: true`** offers **Add a screenshot of this page**. It draws a copy of the page masked with session replay's rules: input values masked, password, one-time-code and card fields never read, `.apphelm-mask` and `maskSelector` text masked, `.apphelm-no-capture` and `blockSelector` drawn as boxes, and your `replay` options (`maskAllText`, schematic mode) honoured. The dialog itself is left out. Where the browser can share a screen, **Capture a screen…** asks the person to pick a tab, window or screen and keeps one frame, with the page's masked parts covered. The person sees the screenshot and can remove it before sending.
- **`attachments: true`** lets the person add one file.

The screenshot is offered only when the person has given replay consent (`setConsent({ analytics: true, replay: true })`) and the page is one replay records: not a path with `auth`, `sign-in`, `sign-up`, `login`, `logout`, `billing`, `checkout`, `payment`, `admin` or `account/security` as a segment (so `/settings/billing` neither), nor one of your `replay.blockedPaths`. See [Session replay](https://apphelm.dev/docs/session-replay#what-is-masked).

From your own UI, `captureFeedback` and `sendFeedback` take files too:

JavaScript (browser):
```js
await analytics.captureFeedback({
  message: "Here are the steps.",
  attachments: [{ data: blob, filename: "steps.txt", kind: "attachment" }],
});
```

| Limit | Value |
| --- | --- |
| Files per message | One screenshot and two other files |
| Types | PNG, JPEG, WebP, PDF, plain text. A screenshot must be an image |
| Size | 5 MB each |
| Screenshot | At most 2,560 px on its longest side, under 4.8 MB |

AppHelm checks each file's bytes against its type and removes image metadata (EXIF, including GPS position, XMP, IPTC and comments) before storing it. Files show on the issue's Feedback tab and in Product fit & feedback, and only members of the workspace can open them.

Screenshots and files are browser only. No mobile or server SDK sends them.

## Change the text and the look

The dialog takes its text as options; anything you leave out keeps its default.

| Option | Default |
| --- | --- |
| `title` | "Send feedback", or "It looks like something went wrong." with an `eventId` |
| `subtitle`, `messageLabel`, `messagePlaceholder` | Text for each case |
| `submitLabel` | "Send feedback", or "Send report" with an `eventId` |
| `cancelLabel`, `successMessage` | "Cancel", and "Thank you. Your report was sent to the team." |
| `theme` | `"auto"` (the page's scheme), `"light"` or `"dark"` |
| `onSubmit(id)`, `onClose()` | Called when it is sent, and when it closes |

The button takes `label` (default "Feedback"), `position` (`"right"`, the default, or `"left"`; always at the bottom) and `theme`, plus every dialog option except `eventId`.

There are no colour options. Restyle both with CSS custom properties on `.apphelm-feedback`:

```css
.apphelm-feedback {
  --apphelm-feedback-accent: #0f766e;
  --apphelm-feedback-accent-fg: #ffffff;
  --apphelm-feedback-radius: 6px;
  --apphelm-feedback-font: inherit;
}
```

The others are `--apphelm-feedback-bg`, `-fg`, `-muted`, `-border`, `-field`, `-field-fg`, `-button`, `-button-fg` and `-backdrop`.

## What is sent

The browser dialog, the button and `captureFeedback` send the message, the event id when there is one, and the page's address, to `POST /api/feedback/report` with the public project key and an allowed origin. AppHelm keeps only the address's path.

- The message is scrubbed of emails and secrets and cut to 5,000 characters, in the browser and again on the server.
- Your `beforeSend` sees it as a `$feedback` event: `{ name: "$feedback", properties: { message, event_id, attachments } }`, where `attachments` lists each file's `index`, `kind`, `filename`, `content_type` and `bytes`, never the contents. Return `null` to drop the feedback, or return the list without some files to drop them. A changed message is scrubbed again.
- No person, session or replay id is sent, so browser feedback isn't linked to a person or to a replay. It is linked to an issue only through the event id.

## Bring in feedback from other tools

Send feedback you already have, from support tickets, CRM notes, sales calls, app store reviews or cancellation forms, with `POST /api/v1/feedback`. It needs a key with `feedback:write` and an `Idempotency-Key` header.

```bash
curl -X POST https://apphelm.dev/api/v1/feedback \
  -H "Authorization: Bearer $APPHELM_API_KEY" -H "Idempotency-Key: support:ticket_123:v1" -H "Content-Type: application/json" \
  --data '{"productId":"prd_…","externalUserId":"customer_…","sourceType":"support","sourceId":"ticket_123",
    "text":"The import is finally fast.","occurredAt":"2026-11-01T10:00:00Z","permission":"attributed_internal"}'
```

Node.js:
```ts
await apphelm.ingestFeedback({
  productId: "prd_…", externalUserId: "customer_…", sourceType: "support",
  sourceId: "ticket_123", text: "The import is finally fast.",
  occurredAt: new Date().toISOString(), permission: "attributed_internal",
}, { idempotencyKey: "support:ticket_123:v1" });
```

| Field | Required | Values |
| --- | --- | --- |
| `productId` | yes | `prd_…` |
| `sourceType` | yes | `support`, `crm`, `call`, `review`, `cancellation`, `community` or `human` |
| `sourceId` | yes | Your id for it, up to 200 characters. One `sourceType` and `sourceId` pair is stored once |
| `text` | yes | Up to 20,000 characters |
| `occurredAt` | yes | An ISO 8601 time with an offset |
| `externalUserId` | no | Your id for the person. Links the feedback to their customer profile, when the workspace allows customer success profiling |
| `sentiment` | no | `positive`, `neutral`, `mixed` or `negative`; needs `sentimentConfidence` (0 to 1) |
| `permission` | no | `private_analysis` (default), `attributed_internal` or `quotable` |
| `metadata` | no | Up to 50 fields, each a string (up to 500 characters), number, boolean or null |
| `eventId` | no | An error event id (8 to 64 characters); the feedback then shows on that issue |

The whole body is at most 32 KB. Only Node has `ingestFeedback` and `listFeedback`; from other languages, call the API. The other SDKs' `captureFeedback` always sends `sourceType: "human"` and `private_analysis`.

AppHelm scrubs the text before storing it, as it does every feedback message: private keys, JWTs, API keys, bearer and basic credentials, `password=` style values, secrets in URLs, emails and long hex tokens are replaced. Anything else is kept as you send it, so remove what you don't want kept before sending.

`GET /api/v1/feedback` (with `feedback:read`) lists the newest feedback, 20 at a time by default (up to 100, with `cursor`), with a 300-character excerpt of each, never the full text. Feedback with `private_analysis` permission comes back without its text: `excerpt` is `null` and `excerptWithheld` is `"private_analysis"`. See the [API reference](https://apphelm.dev/docs/api) under Feedback.

### Permission

| Value | Meaning in AppHelm |
| --- | --- |
| `private_analysis` | Used for analysis only. The text is held back from customer summaries, roadmap quotes and everything the API and MCP return, and the person isn't notified when a roadmap item ships |
| `attributed_internal` | The text can be shown to your team with the customer it came from |
| `quotable` | You may quote it. AppHelm treats it as `attributed_internal` today |

Your team sees the text of every item in **Product fit & feedback**, whatever the permission. The API and MCP return it only for `attributed_internal` and `quotable`: wherever they would return a `private_analysis` customer's words, the field is `null` and a field beside it, named after it with `Withheld` (`excerptWithheld`, `textWithheld`, `summaryWithheld`), says `"private_analysis"`. That covers the feedback list, open-text answers in survey results, feedback in the customer thread and roadmap evidence packs. `private_analysis` is the default, and `captureFeedback` always sends it, so send `attributed_internal` with `ingestFeedback` or the API when you need to read the text back.

### Feedback from Sentry SDKs

A Sentry SDK pointed at AppHelm can send its user feedback as well: `feedback` and `user_report` items are stored like `captureFeedback`, linked to the issue by their event id, with any `replay_id` kept as metadata. Contact names and emails are dropped, and Sentry feedback attachments aren't stored. See [Migrate from Sentry](https://apphelm.dev/docs/migrate-sentry).

## Where feedback shows up

- **Product fit & feedback → Feedback** lists the newest 100 items with their source, time, permission, sentiment, themes and files. Sentiment is what the source sent; AppHelm doesn't guess it, and shows "Unclassified" otherwise.
- **Themes** group feedback by topic. Owners and admins with access to every product can create, rename, merge, split and assign themes there, and ask for suggestions, which are word counts over the latest 500 items for a person to review. There is no API for themes.
- **An issue's Feedback tab** shows up to the 50 newest items whose event id belongs to that issue, labelled "Report dialog", "Feedback API" (from the SDKs and the API) or "Sentry feedback". Feedback without an event id shows only in Product fit & feedback, and feedback whose error has aged out of the issue drops off the tab but stays in the list.
- Survey answers appear in the same list, with their own source.

Storing feedback doesn't count against any plan allowance. The collector's rate limits apply to the browser route.

## Reply to the person

AppHelm can't reply to feedback on its own. If you use YouSaid, its two-way threads connect to AppHelm: pass a YouSaid client's `sendSignal` to `showReportDialog` (or mount `<AppHelmFeedbackProvider>` in React), and the dialog offers "Let the team reply to me", which opens a thread with the event id. See the `@sansavision/apphelm/feedback` entry in the SDK's README.

## What feedback doesn't do

- React Native has no `captureFeedback`, dialog or button.
- Only the browser has a ready-made form, screenshots and files. Vue, Svelte and Angular have no feedback components; use `feedbackButton` or `showReportDialog` with the client.
- No name, email, rating or category fields, and no drawing on screenshots.
- No MCP tool or CLI command reads or sends feedback.
- No CSV export of the Feedback list.
- Feedback sent without an event id or `externalUserId` isn't linked to a person.

## Check it works

### Send one
Click your Feedback button, type a line and press **Send feedback** (or call `captureFeedback` from your server or app).

### Look in the browser's network tab
`/api/feedback/report` should answer `201`. A `202` means it was accepted but not stored (see the table below).

### Open Product fit & feedback
Open the **Feedback** tab. Your message is at the top. If you passed an event id, open that error's issue and check its **Feedback** tab too.

## Best practices

- **Pass the event id** whenever feedback is about an error, so it lands on the issue the engineer is reading.
- **Turn screenshots on** only where you need them, and check a test screenshot for anything masking missed.
- **Use your own ids as `sourceId`** when importing, such as the ticket number, so a re-run never stores anything twice.
- **Keep personal data out** of imported text; the API stores it as sent.
- **Set `permission` deliberately** for imported feedback, so customer summaries show only what you may show.

## Troubleshooting

| Symptom | Likely cause | What to do |
| --- | --- | --- |
| The dialog says thank you but nothing appears | The collector answered `202`: the product is archived, collection is paused, it's the demo product, or the request looked like a bot | Resume collection or use a live product; `captureFeedback` resolves to `null` in these cases |
| 401 `invalid_project_key` in the browser | The key isn't a project key (`ahl_pub_…`), or the page's origin isn't allowed | Use the project key, and add the origin in Settings → Keys |
| "Too many reports were sent just now" | 429 `rate_limited` | Wait a minute |
| "The files are too large to send" | 413 `attachments_too_large` | Keep each file under 5 MB, with at most one screenshot and two files |
| 422 `invalid_attachment` | A file's type isn't allowed, or its bytes don't match its type | Send PNG, JPEG, WebP, PDF or plain text |
| No screenshot option | `screenshot` isn't set, there's no replay consent (which needs analytics consent; Global Privacy Control turns both off), or the page is a blocked path | Set `screenshot: true`, ask for replay consent, or accept that sign-in, billing, checkout and admin pages are never captured |
| "Add a screenshot" fails in Safari | The browser won't let the page read the drawing back | Use **Capture a screen…** where it's offered |
| `captureFeedback` from a mobile or server SDK returns null or 403 `scope_denied` | The key lacks `feedback:write` | Add the scope to the key |
| 400 `idempotency_required` | The API call has no `Idempotency-Key` | Send one, 8 to 160 characters |
| 409 `idempotency_conflict` | The key was used in the last 24 hours with a different body | Use a new key for new feedback |
| 409 `feedback_source_conflict` | The same `sourceType` and `sourceId` was stored with different content | Give each item its own `sourceId`, or add a version to it |
| 422 `invalid_feedback` | A field is missing or out of range, `sentiment` came without `sentimentConfidence`, or the body is over 32 KB | Check the field table above |
| Feedback isn't on the issue | No event id was passed, the error itself was never sent (in the browser, errors need analytics consent), or the event has aged out of the issue | Pass the id `captureException` returned and check the error reached AppHelm; the feedback is still in Product fit & feedback |
