Skip to content

Automate Sanity

In Sanity, documents of every schema type live in a dataset that developers query with GROQ. ClickRuntime runs those queries for you, counts what was published, keeps an eye on the dataset and reacts to webhooks when a document changes. Ask your AI assistant for the alert or report, confirm the steps it lays out, and it keeps running.

Try asking

Create a ClickRuntime automation: when a document of type post is published in my Sanity production dataset, post its title and type to #web-content in Slack.

Paste it into your assistant. It tells you what it will send or change before it runs live.

Build your own

Build any Sanity automation you can describe

The ideas above are ready-made starting points, not a fixed list. Describe what Sanity should do in your own words, with your conditions, other apps or an AI step, and your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

For example, ask your assistant

Every morning, find Sanity documents of type post that are missing a main image or have an empty excerpt, and send me the list.

When a document is published in Sanity, post its title and type to our #content Slack channel with a link to the studio.

Every week, export Sanity product documents to Google Sheets, have AI write missing descriptions, and create a Notion review page listing them for editors.

Beyond chat

Have Sanity work when you're not in the chat

Connecting Sanity to ChatGPT or Claude lets you ask about it while you chat. ClickRuntime handles the part that should happen on its own: checks on a schedule and actions on each new event, set up from the same chat and running after you close it.

Setup

Connect Sanity

Sanity connects with a robot token you add to your project, with a role you choose. You also need the project ID and the dataset name.

Sanity

Headless CMS

  1. Go to sanity.io/manage, pick your project and open the API settings.
  2. Under Tokens, choose Add new token, name it, and pick a role. Viewer is enough for reports and backups.
  3. Copy the token, which Sanity shows only once, and note your project ID and dataset name, such as production.
  4. In the ClickRuntime dashboard, save the token as a secret on Connections & secrets and include the project ID and dataset.

Good to know

Sanity limits that affect automations

  • Every request needs the project ID and dataset name as well as the token.
  • Robot tokens act with the role you assign. A Viewer token can read and export but not change documents.
  • Webhooks are created by a project admin. By default they ignore drafts, so alerts fire on published documents only.
  • Built-in emails are plain text, so a large dataset export needs another place to land than an attachment.
  • Give each tool its own token so you can revoke one without breaking the others. Organization robot tokens exist if you need access across projects.

FAQ

Questions about automating Sanity

What can ClickRuntime see in my Sanity project?
The dataset you name, with the role on your token. A Viewer token lets it run GROQ queries and export documents; it cannot edit anything.
How do publish alerts reach ClickRuntime?
Through a GROQ-powered webhook a project admin sets up. Sanity sends the projected fields on create, update or delete, and the alert is posted as soon as it arrives.
Will editors' drafts trigger alerts?
Not by default. Sanity webhooks skip drafts unless you change that, so only published documents are announced.
Can I back up my dataset by email?
The automation calls Sanity's export endpoint each week and emails you a summary. Because built-in email is plain text, a large export needs a separate place to be stored.
Is AI part of these automations?
No. Alerts, counts and exports run without it. Should you add summaries later, the AI that comes with every ClickRuntime plan covers it and you don't need an AI key.
Is this a Sanity connector for ChatGPT or Claude?
Not for chatting with Sanity data. A chat connector lets your assistant read and change Sanity while you're in the conversation. ClickRuntime is for the work that should happen without you: you set up an automation from the chat once, and it keeps running on a schedule or on each Sanity event.

Tell your assistant what Sanity should do

Free plan. No credit card.