Skip to Content
Connect software

Sanity Studio plugin

Install sanity-plugin-insane-forms to read a Workspace's Inboxes, open Submissions and download Files inside Sanity Studio.

sanity-plugin-insane-forms adds an Inbox tool to Sanity Studio. People who work in Studio read the Submissions of the Sites you connect, open them and download their Files without leaving Studio. A Developer sets up the connection in the app first: see Connect Sanity Studio.

Requirements

  • Sanity Studio with sanity 6.24 or a later 6.x release.
  • react and react-dom 19.2 or a later 19.x release, and styled-components 6.1.15 or a later 6.x release. These are peer dependencies, so a Studio normally has them already.
  • A Studio connection for your Sanity project, created by a Developer in the app.

Install

npm i sanity-plugin-insane-forms

Add the plugin in sanity.config.ts:

import { defineConfig } from "sanity";
import { insaneForms } from "sanity-plugin-insane-forms";

export default defineConfig({
  // ...your project and dataset
  plugins: [insaneForms()],
});

The Studio now has a tool named Inbox, at the path /insane-forms under your Studio's base path.

Options

insaneForms(options?) takes one option.

OptionTypeDescription
apiUrlstringThe origin of the Insane Forms app, for example https://app.insaneforms.com. Set it only when your Workspace is not on the default origin. It must be an https origin with no path. http://localhost is accepted for local work.
plugins: [insaneForms({ apiUrl: "https://app.insaneforms.com" })];

Connect a Workspace

The plugin shows nothing until a Developer connects your Sanity project in the app. A connection lists the Sites to show and the Studio hostnames that may connect, for example my-studio.sanity.studio. Ask the Developer to add every hostname your Studio runs on.

The plugin reads your Sanity project ID and your Sanity sign-in from Studio. You configure neither. If no Workspace has connected the project, the Inbox says so and suggests that a Developer add a Studio connection. If a Workspace has connected it but not from your Studio's hostname, you see Cannot reach Insane Forms with a hint to ask a Developer to add the hostname.

Several Workspaces can connect the same Sanity project. Each one has its own connection and its own Sites. The Inbox tool lists them in a Workspace selector.

Read Inboxes in Studio

Open the Inbox tool. Three selectors across the top pick a Workspace, a Site and a Form. Below them, the list shows the Form's Submissions, 25 to a page. Each row shows a preview of the Submission's fields, when it was received, how many Files it has, and a New badge while it is unread. Select a Submission to read it next to the list. On a narrow screen the list and the Submission take turns.

Reading works in one of two ways, and the Inbox tool picks the right one for you:

  • As a Studio reader. If you are a member of the Sanity project and the connection allows reading without signing in, the plugin sends your Sanity sign-in to Insane Forms once. Insane Forms confirms with Sanity that you belong to the project and gives the plugin a session that lasts about 15 minutes, limited to the connection's Sites. You need no Insane Forms account.
  • Signed in to Insane Forms. See Sign in to manage Submissions.

If you are removed from the Sanity project, your access can last until the session ends, at most about 15 minutes.

Open a Submission

Selecting a Submission opens it and marks it read. The Submission shows the time it was received, each field with its name and value, and its Files. A Submission's content never changes after it arrives.

Download a File

A Submission's Files appear under the heading Files, each with its name and size. Select a File to download it. The plugin asks Insane Forms for a download link when you select the File. The link works for 60 seconds, for that one File, and Insane Forms checks your access again when the link opens. Files download as files and are never shown as a preview.

If a download fails, the File shows a short message, such as Too many requests. Try again in 30 seconds.

Sign in to manage Submissions

A Studio reader can read, but cannot change anything except opening a Submission, which marks it read. To move a Submission to Spam or Trash, sign in to Insane Forms from inside Studio.

  1. Select Sign in to manage Submissions at the end of the toolbar.
  2. Complete the sign-in in the window that opens. Use the Insane Forms account that is a member of the Workspace.
  3. The toolbar shows Signed in as <name> (<email>) and a Sign out button.

The sign-in has a time limit. Starting it and finishing it in the callback window each get 10 minutes, and a request in the flow that gets no answer in that time is cancelled. Start again from the toolbar. If Insane Forms later rejects your signed-in session, because it expired or access was removed, the Inbox tool signs you out and returns to reading mode, or asks you to sign in again when the connection does not allow reading without signing in.

After you sign in, the Inbox tool shows three tabs for each Form: Inbox, Spam and Trash. A menu named Actions on the open Submission offers:

Where the Submission isActions
InboxMark as read or Mark as unread, Move to Spam, Move to Trash
SpamRestore to Inbox, Move to Trash
TrashRestore to Inbox

Your role in the Workspace decides what you can do, and the connection's Sites limit where. A Developer or Owner can act on every Site of the connection. A Maintainer can act on the connection's Sites that they were given access to. If your role does not allow an action, the plugin shows Your role in this Workspace does not allow that. Signing in gives the plugin access to Submissions only. It never gives access to Sites, Forms or settings.

Some Studios are set up to sign in with cookies only, so they give the plugin no Sanity token. In that case the Inbox tool asks everyone to sign in to Insane Forms. A Developer can also switch off reading without signing in for a connection, and then everyone signs in.

What each person can do

PersonRead InboxesOpen and download FilesSpam, Trash and RestoreDelete for good, export, configure
Member of the Sanity project, reading without signing inYes, the Inbox onlyYesNoNo
Member of the Sanity project, signed in to Insane FormsInbox, Spam and Trash, as their role allowsYesYes, as their role allowsNo
Person outside the Sanity project, not signed inNoNoNoNo

Permanent deletion and export stay in the app. The plugin says so on the Spam and Trash tabs.

Opening a Submission as a Studio reader is recorded in the Workspace's Activity log under the reader's Sanity name and email, as is each start of a reader session.

Rate limits

Insane Forms limits how fast Studio can load. A reader's list and Submission requests are limited per minute, and download links are limited more tightly. When a limit applies, the plugin shows Too many requests with the time to wait. When Sanity asks Insane Forms to slow down, only the Sanity project that triggered it waits. Other projects keep working. See Limits.

Troubleshooting

Message in StudioWhat it means
Sign in to Insane FormsStudio did not pass a Sanity token to the plugin, so Insane Forms cannot confirm you belong to the project.
You cannot read this InboxYou are not a member of a connected Workspace's project, reading without signing in is off, or this Studio's hostname is not allowed. Ask a Developer.
Cannot reach Insane FormsThe browser could not complete the request. Check your connection, then ask a Developer whether the Studio's hostname is on the connection.
Your session expiredTry again to reconnect.
Insane Forms is unavailableA temporary failure. Try again in a moment.
Not availableThe Form or Submission was removed, or you no longer have access.

Use the client without the tool

The package also exports the client the tool uses, from sanity-plugin-insane-forms/client: createStudioClient for the Studio reader API and createStudioOAuthClient for signed-in access, with the types StudioConnection, StudioSite, SubmissionPage, SubmissionSummary, Submission and FileDownloadLink. Most Studios need only the plugin.

On this page