Guide/Integrate the feedback widget

Integrate the feedback widget

Add the Shyvo feedback button to your app with the CLI, a script tag, or the React component.

The widget is a small Feedback button. It mounts in its own shadow root (no iframe, no dependency, no style leaks) and sends messages to your Shyvo project, where you triage them into issues.

It needs two public values:

  • Project key (shyvo_pk_…): it can only create feedback for this project, and only from the origins you allow. It is safe to ship in the browser.
  • Endpoint: the Shyvo feedback endpoint for the environment.

Never put an agent token (shy_…) in your app. Only the public project key goes there.

From your app's repository:

npx shyvo login
npx shyvo link my-app
npx shyvo widget install --origin https://app.example.com --origin http://localhost:3000

It enables the project's collector, allows the origins, detects your framework and:

  • React frameworks (Next.js, TanStack Start, React Router, Vite): writes a shyvo-feedback.tsx component exporting <ShyvoFeedbackWidget /> and appends two public env values (<PREFIX>SHYVO_PROJECT_KEY, <PREFIX>SHYVO_ENDPOINT).
  • Other frameworks: prints a <script> tag to paste.

Useful flags: --dry-run, --no-env (print the env values instead of writing them), --mode npm|script, --json.

It never runs npm install and never edits your layout. Mount the component once, at the root:

FrameworkWhere
Next.jsapp/layout.tsx (or pages/_app.tsx), just before </body>
TanStack Startsrc/routes/__root.tsx, inside <body> next to <Scripts />
React Routerapp/root.tsx, inside <body> next to <Scripts />
Vite + Reactsrc/App.tsx (or main.tsx), top level
Astrobase layout, script tag before </body>
SvelteKitsrc/app.html, script tag before </body>
Nuxt / Vueapp.head.script / index.html

Prefer letting your agent do it? With the Shyvo skills installed, ask it: "add the Shyvo feedback widget to my app".

Option 2: script tag

Works with any site. It exposes window.shyvo.

<script
  src="https://shyvo.app/widget.js"
  data-project="shyvo_pk_…"
  data-endpoint="https://<your-endpoint>"
  async
></script>

Option 3: React component

import { ShyvoFeedback, shyvo } from "@shyvo/feedback/react";

export function App() {
  return (
    <>
      {/* your app */}
      <ShyvoFeedback
        project="shyvo_pk_…"
        endpoint="https://<your-endpoint>"
        metadataConsent="ask"
        context={() => ({ page: "billing", appVersion: "2.4.0" })}
        theme={{ accent: "#C7F20A", accentText: "#0B0B0B", colorScheme: "auto" }}
      />
    </>
  );
}

// Open it from anywhere, e.g. a "Report a bug" menu item:
shyvo.feedback.open({ category: "bug" });

Without React:

import { shyvo } from "@shyvo/feedback";

shyvo.init({ project: "shyvo_pk_…", endpoint: "https://<your-endpoint>" });
shyvo.feedback.open();

Options

OptionDefaultNotes
metadataConsent"ask"ask: unchecked checkbox; granted: you already have consent; never: message only.
context{}page, appVersion, userId, anonymousId. An object or a function.
themeShyvo lookcolorScheme, accent, accentText, background, text, mutedText, border, radius, fontFamily, zIndex.
labelsEnglishEvery visible string, including category names. Use it to translate the widget.
triggerbottom-right pill{ position: "bottom-left" }, or false to open it only with shyvo.feedback.open().
onSubmittedCalled with { duplicate }.
onErrorCalled with { kind, message }: invalid, unavailable, rate_limited, network, server.

Categories: bug, feature_request, suggestion, question, other. Messages are limited to 4,000 characters.

Privacy

  • Without consent, a feedback carries only its category and message.
  • With consent, it adds an allowlist: timestamp, page URL without query or hash, browser, OS, and your context fields. The project's collector policy decides what is kept.
  • Requests use credentials: "omit": your app's cookies never leave the page.
  • Retries reuse the same submission id, so a feedback is never stored twice.

Test it

  1. Start your app locally and check that the Feedback button appears.
  2. Send a test message.
  3. Run npx shyvo feedback list --state new (or open the project inbox) to see it, then dismiss it.

Go to production

Add the two public env values on your host (Vercel, Cloudflare, Netlify…) and make sure your production URL is an allowed origin:

npx shyvo widget setup --origin https://app.example.com

If feedback is refused with an origin error, the origin is missing from this list.