# Sanity Studio plugin

Shows pinprompt feedback on Sanity documents (a badge and a panel), and adds a Give feedback button to Presentation.

Source: https://pinprompt.veren-technology.com/docs/sanity-plugin

> Status: Experimental. See https://pinprompt.veren-technology.com/docs/what-works-today.md

Each document gets a badge ("2 in pinprompt") and a **pinprompt feedback** action listing the items linked to it, with links back. It only reads; nothing in Studio changes pinprompt.

An item shows on a document when someone linked it there (**Link** on the item's Sanity row) or pinprompt wrote a draft for it.

## Set up

1. In pinprompt: *Settings → Integrations → Sanity → Studio plugin → Set up*. Copy the key, shown once.
2. In the Studio project, install it from npm:

```bash
npm install sanity-plugin-pinprompt
```

```ts
// sanity.config.ts
import { pinpromptFeedback } from "sanity-plugin-pinprompt";

export default defineConfig({
  // …
  plugins: [pinpromptFeedback({ url: "https://<your pinprompt>", key: process.env.SANITY_STUDIO_PINPROMPT_KEY! })],
});
```

## Give feedback in Presentation

The same package adds a **Give feedback** button to Presentation's header, so clients pin feedback on the preview with nothing to install. It needs no Studio key, only your pinprompt's address:

```ts
import { presentationTool } from "sanity/presentation";
import { pinpromptPresentation } from "sanity-plugin-pinprompt";

presentationTool({ /* … */ components: { unstable_header: pinpromptPresentation({ url: "https://<your pinprompt>" }) } });
```

The site needs the review script and the Studio's address must be listed in the project: [Feedback in Sanity Presentation](https://pinprompt.veren-technology.com/docs/sanity-presentation.md).

> Built and tested against a stand-in Sanity API and a stand-in Studio. Try it on a test dataset before a client's Studio. The Sanity integration it belongs to is described in [Sanity](https://pinprompt.veren-technology.com/docs/reference/sanity.md).
