# Install the feedback widget in your app

Canonical: https://feeblo.com/install Markdown mirror of: https://feeblo.com/install

The Feeblo widget opens your feedback board in an overlay, so users submit without leaving the page. React, Next.js, Vue, and plain HTML all use the same organization ID and the same trigger attribute.

Try it: https://app.feeblo.com

## Before you start

- **A feeblo organization.** Create one at https://app.feeblo.com. The widget submits posts into that organization.
- **Your organization ID.** Open Settings → Widget → Installation and copy the ID. Every snippet takes it as the first argument of `Feeblo.init`, or as the `organizationId` prop.
- **A board and a trigger.** Posts land on a board. Point the widget at one with `defaultBoard`, and open it from any element that carries `data-feeblo-feedback`.

## Install and mount

Run these steps once. After that, the widget is part of the page and opens from any trigger you add.

1. **Install the SDK.** Install the package that matches your stack. React and Next.js use both packages: the React package depends on the core SDK and re-exports its API.

   ```bash
   # Vanilla JS, Vue, and plain HTML
   npm install @feeblo/sdk

   # React and Next.js
   npm install @feeblo/sdk @feeblo/sdk-react
   ```

2. **Initialize the widget with your organization ID.** Call `Feeblo.init` once per page. The call returns a handle you can chain and keep.

   ```ts
   import { Feeblo } from "@feeblo/sdk";

   const widget = Feeblo.init("org_123", {
     placement: "bottom-right",
     mode: "feedback",
   });
   ```

   ```tsx
   import { FeebloProvider } from "@feeblo/sdk-react";

   <FeebloProvider organizationId="org_123" placement="bottom-right">
     <App />
   </FeebloProvider>;
   ```

3. **Pick the widget mode.** The `feedback` mode opens the submit form and is the default. The `updates` mode opens a card-based product updates panel. The `hub` mode puts both behind one launcher, and the order of `modules` decides which one opens first.

   ```ts
   // Pick one mode
   Feeblo.init("org_123", { mode: "feedback" });

   Feeblo.init("org_123", { mode: "updates" });

   const hub = Feeblo.init("org_123", {
     mode: "hub",
     modules: ["feedback", "updates"],
   });

   hub.openModule("updates");
   ```

4. **Point the widget at a board.** Set `defaultBoard` to the board the feedback form opens on. Board selection applies while the feedback module is the active one, so a hub that starts on updates ignores it.

   ```ts
   Feeblo.init("org_123", { defaultBoard: "roadmap" });
   ```

   ```html
   <button data-feeblo-feedback data-feeblo-board="bugs">Report a bug</button>
   ```

5. **Add a trigger.** Give a button the `data-feeblo-feedback` attribute. The widget opens when a user clicks it. The SDK rescans the page every second, so a button rendered later binds shortly after it mounts. Pair a second `data-feeblo` attribute with the trigger to record context on the post.

   ```html
   <button type="button" data-feeblo-feedback data-feeblo-board="roadmap">
     Give feedback
   </button>
   ```

   ```ts
   const widget = Feeblo.init("org_123");

   widget.open();
   ```

6. **Identify the user.** Send the signed-in user so the post reaches your team with a name and an email attached. Only `id` is required.

   ```ts
   Feeblo.identify({
     id: "u_1",
     email: "ada@example.com",
     name: "Ada Lovelace",
   });
   ```

   ```tsx
   <FeebloProvider organizationId="org_123" user={currentUser}>
     <App />
   </FeebloProvider>
   ```

7. **Listen for a submission.** Subscribe when you want your own code to react. The event carries the board, the title, and any metadata you set on the trigger.

   ```ts
   const off = Feeblo.on("feedbackSubmitted", (event) => {
     console.log(event.detail.data);
   });

   off(); // stop listening
   ```

8. **Confirm the widget loaded.** Turn on `debug` for the first run. The SDK logs a version banner with your org ID and base URL, then every trigger binding and event.

   ```ts
   const widget = Feeblo.init("org_123", {
     placement: "bottom-right",
     debug: true,
   });
   ```

## What you should see

- **A launcher in the corner.** With `placement` set, a launcher button sits 20px from the bottom corner you picked. Without `placement`, no launcher mounts.
- **An overlay, not a redirect.** Clicking a trigger opens the widget over the page. The page behind it stays where it was.
- **A post on the board.** Submit a post and it lands on the board with the identity you sent.
- **Events on window.** Five events fire as `CustomEvent`s with namespace `feeblo`: `widgetReady`, `widgetOpened`, `widgetClosed`, `identityChanged`, and `feedbackSubmitted`.

## Options you will reach for

Set these in the init call or as provider props. The same names work as `data-feeblo` attributes on the script tag.

| Option         | Values                                                |
| -------------- | ----------------------------------------------------- |
| `mode`         | `"feedback"` (default), `"updates"`, `"hub"`          |
| `placement`    | `"bottom-left"` or `"bottom-right"`, unset by default |
| `theme`        | string, forwarded to the widget iframe                |
| `defaultBoard` | board the feedback module opens on                    |
| `locale`       | BCP 47 tag, `en` by default                           |
| `debug`        | boolean, logs to the console                          |

## Errors you might hit

Every SDK failure carries a stable code. Log the error object to see it.

- `INVALID_ORG`: `Feeblo.init` ran without an organization ID. Copy it again from Settings → Widget → Installation.
- `INVALID_CONFIG`: the mode or placement is unknown, `modules` is set outside hub mode, or the module list is empty or repeated.
- `INVALID_IDENTITY`: `identify` ran without an `id`.
- No launcher: `placement` is unset. Add it, or open the widget from a trigger or `widget.open()`.

## If nothing opens

Check these four things in order. Each one accounts for a widget that loads but never appears.

- The element carries `data-feeblo-feedback` and is still in the DOM when you click it.
- The SDK loaded: DevTools Network shows one request for the SDK bundle or script.
- The `placement` option is set, or you call `widget.open()` from your own handler.
- The organization ID belongs to the workspace whose boards you are checking.

With `debug` on, the SDK prints a banner with the version, your org ID, and the base URL it resolved. A mismatch there explains most empty widgets.

- `[feeblo]`: one banner per init, with version, org ID, and base URL.
- `[feeblo:config]`: the iframe source the SDK built from your options.
- `[feeblo:event]`: events as they fire, starting with `widgetReady`.

The banner version comes from the installed package. Read the same value in your own code with `Feeblo.version`.

## After it works

Three upgrades turn a working widget into one your team can trust: a verified identity, context on every post, and a notification when a post arrives.

- **Send a signed identity.** Sign a JWT on your server with your organization secret and pass it as `token`. Feeblo verifies it and attaches the post to a real contact. https://docs.feeblo.com/developers/widget-sso
- **Record context on the post.** Add `data-feeblo-page` or `data-feeblo-plan` to a trigger. The widget stores those values as metadata and the `feedbackSubmitted` event returns them. https://docs.feeblo.com/developers/triggers-and-events
- **Hear about posts on your server.** Widget events live in the browser. Subscribe to `feedback.post.created` and `feedback.post.status_changed` webhooks to notify a channel or sync a tracker. https://docs.feeblo.com/developers/webhooks

## Pick your framework

- **React.** Mount `FeebloProvider`, open the widget with `useFeeblo`, and track submissions with `useFeebloEvent`. https://feeblo.com/install/react
- **Next.js.** Put the provider in a client component, keep it in the root layout, and pass the user from the server. https://feeblo.com/install/nextjs
- **Vue.** Use the core SDK inside a component, initialize in `onMounted`, and destroy on unmount. https://feeblo.com/install/vue
- **HTML.** Load the SDK from a script tag, set options as data attributes, and skip the build step. https://feeblo.com/install/html

## SDK docs

- Quickstart: https://docs.feeblo.com/developers/quickstart
- Every widget option: https://docs.feeblo.com/developers/configuration
- Triggers and events: https://docs.feeblo.com/developers/triggers-and-events
- Identify users: https://docs.feeblo.com/developers/identity
- Widget SSO: https://docs.feeblo.com/developers/widget-sso
