CMS integrations

Sanity

GrowGanic writes each finished article into your Sanity dataset as a published document.

A primary destination. Your article lives here and the canonical URL points at it, so this is the site Google credits. About 3 minutes.

#What connecting does

Every article GrowGanic finishes is written into your dataset as a document and published, ready for your front end to query.

Sanity is headless, so there is no public URL to hand back: where an article appears is your front end's business. GrowGanic shows a link into your Studio rather than inventing an address on your site.

Documents are written without needing a Studio schema in place. Sanity accepts them either way, and the data sits in the dataset until something queries it.

#Before you start

  • A Sanity project. If you have none, create one at manage.sanity.io; a production dataset is created for you automatically.
  • An API token with the Editor role. A Viewer token can read and will be refused at connect time with a sentence saying so.

#Connect

Set it up

  1. Open sanity.io/manage. No project yet? Click New, then Project, name it, and confirm. A production dataset is created automatically.
  2. Open your project, click API in the left sidebar, then Tokens in the submenu.
  3. Click Add API token. Name it (e.g. GrowGanic), select the Editor role (read + write), then click Save.
  4. Copy the sk... token immediately (it is shown once). Your Project ID is at the top of the project page (8 lowercase characters, e.g. klzor3nb).

What you paste

FieldRequiredWhere to find it
Project IDYesThe top of your project page on manage.sanity.io. Eight lowercase characters, for example klzor3nb.
Editor tokenYesYour project on manage.sanity.io, then API, then Tokens, then Add API token with the Editor role. It starts with sk and is shown once.
DatasetOptionalDefaults to production. Change it only if your articles belong in another dataset.
Document typeOptionalDefaults to post. Change it to match your schema.

If it will not connect

  • We write articles to the default `production` dataset as documents of _type: "post" with a string bodyHtml field. Sanity accepts these without a Studio schema; the data lives in the dataset until a frontend queries it.
  • A Studio schema with different field names? Point us at yours under Advanced settings.

#Permissions we ask for

Every permission below is used by a call GrowGanic actually makes. We ask for nothing we do not use.

PermissionUsed forWhy
Editor roleQuerying the dataset and mutating documentsSanity issues role-based tokens rather than per-scope keys. Editor is the narrowest role that can write; Viewer is refused at connect time.

GrowGanic queries and writes documents of the one type you name, in the one dataset you name. It does not touch your project members, your other datasets, your Studio deployment or your billing.

#What we write

FieldWhat goes in it
titleThe article title.
bodyHtmlThe article body as HTML, in a string field.
slugThe article slug.
featuredImageUrlThe hero image address, as a string.

Fields your setup does not have are skipped rather than guessed at, and the article publishes with the ones it does have.

The hero image

The hero is written as a URL string into your featuredImageUrl field and served from our CDN. It is not uploaded as a Sanity image asset, because assets in a Sanity project are modelled by you and we will not create asset records in a model we did not design.

If you would rather host it yourself, read the URL off the document and pull it into your own pipeline. The address is stable.

#Publishing behaviour

Documents are created with a deterministic id derived from the article, so a retry after a lost response updates the same document rather than creating a second one.

The connect test does a real write: it sends a mutation deleting a document id that cannot exist. Sanity accepts that with an Editor token and refuses it with a read-only one, and there is no other way to tell the two apart without creating something in your dataset.

Draft mode is not offered for Sanity. On a headless project, "it is in your drafts" is not a promise we can stand behind: whether a drafts-prefixed document appears anywhere depends on your front end, not on us.

If this destination is ever unreachable, the article is not held. It publishes to your GrowGanic blog and moves here on its own once the connection is healthy again. GrowGanic never holds a finished article back waiting for you.

#Disconnect

Disconnecting stops writing to Sanity. Documents already in your dataset stay exactly as they are and stay yours.

You can also revoke the token on manage.sanity.io. GrowGanic finds out on the next call, switches the connection off and emails you. The token you pasted is kept, so that once the problem is fixed clicking Test puts the connection back with nothing re-entered. Disconnect if you want it gone from our database.

Open Integrations in GrowGanic, find this destination and click Disconnect. The stored credential is deleted from our database in the same step, not marked inactive. Articles already published stay exactly where they are, and they are yours.

#Troubleshooting

What you seeWhyFix
Invalid Sanity token.The token was refused outright, usually a partial paste or a token from another project.Create a fresh Editor token on the right project and paste the whole sk value.
This Sanity token is read-only.The token has the Viewer role.Open sanity.io/manage, your project, API tokens, and create one with Editor or Deploy Studio permissions.
Sanity dataset not found in project.The dataset name does not exist on this project.Check the Dataset field. Most projects use production; some use development.
Sanity accepted the request but returned no results.The document type does not match anything your schema knows about.Set the Document type field to the type your articles use, or leave it at post.

Still stuck? Email [email protected] and tell us the sentence you are seeing. Or read the other destinations.