Set Up User Feedback

Learn more about collecting user feedback when an event occurs. Sentry pairs the feedback with the original event, giving you additional insight into issues.

The user feedback API allows you to collect user feedback while utilizing your own UI. You can use the same programming language you have in your app to send user feedback. In this case, the SDK creates the HTTP request so you don't have to deal with posting data via HTTP.

Sentry pairs the feedback with the original event, giving you additional insight into issues. Sentry needs the eventId to be able to associate the user feedback to the corresponding event. For example, to get the eventId, you can use beforeSendor the return value of the method capturing an event.

Copied
import * as Sentry from "@sentry/react-native";
import { SendFeedbackParams } from "@sentry/react-native";

const sentryId = Sentry.captureMessage("My Message");
// OR: const sentryId = Sentry.lastEventId();

const userFeedback: SendFeedbackParams = {
  name: "John Doe",
  email: "john@doe.com",
  message: "Hello World!",
  associatedEventId: eventId, // Optional
};

Sentry.captureFeedback(userFeedback);

You can also attach further data to the feedback event by passing a hint as a second argument. This is similar to other capture methods:

Copied
Sentry.captureFeedback(
  { message: "I really like your App, thanks!" },
  {
    captureContext: {
      tags: { key: "value" },
    },
    attachments: [
      {
        filename: "hello.txt",
        data: "Hello, World!",
      },
    ],
  },
);
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").