ChatGPT integration with Sanity v3 and UX improvements?

3 replies
Last updated: Feb 11, 2023
has anyone figure out how to incorporate chatgpt with sanity v3? i found myself using notion AI now to draft then port over to my sanity v2 at the moment.
Was thinking migrating v3 would be worth it if theres a UX upgrade (not just tech upgrade with minimal ux impact). 2 bigs hesitant now is this and integrated newsletter (ala ghost)
AI Update

Yes! Sanity v3 has some great AI capabilities that should address your needs. Here's what's available:

AI Integration in Sanity v3

Sanity now has AI Assist, which is their official AI assistant plugin that's much more sophisticated than simple ChatGPT integration. It's available on Growth plans and above, and it's specifically designed for structured content rather than just text generation.

Key features that beat copying from Notion:

  • Works directly in Studio with a sparkle ✨ icon on your documents
  • Schema-aware - understands your content structure, not just freeform text
  • Create reusable "instructions" (shareable across your team) for common tasks like:
    • Content translation across multiple languages
    • Summarizing, extending, or optimizing text
    • Generating metadata and tags
    • Creating alt text for images
    • Even generating images for image fields

Beyond AI Assist, there's also Agent Actions which is more developer-focused - it lets you programmatically use AI to generate or transform documents via API. This is powerful for automation workflows.

Other v3 UX Improvements

While AI is a big draw, v3 has had numerous UX improvements since launch. The plugin ecosystem is mature, the performance is better, and you get access to newer features like Content Releases (for atomic publishing of multiple changes) and the newer Canvas tool for free-form AI-assisted writing.

Newsletter Integration

This is trickier - Sanity doesn't have a built-in Ghost-style newsletter system. You'd need to integrate with third-party services like Mailchimp, Klaviyo, or similar via custom development. You could use Sanity Functions (serverless compute) to trigger newsletter sends when you publish content, but it won't be as seamless as Ghost's integrated approach.

If integrated newsletters are critical to your workflow, you might want to weigh whether the AI capabilities are worth the trade-off of needing to build/maintain that integration yourself.

Bottom line: If AI-assisted content creation is important to you, v3 with AI Assist is definitely a UX upgrade worth considering. The newsletter situation requires more custom work though.

Show original thread
3 replies
Incorporate in what respect?
I ran some tests a few days ago with a database my client has for image tagging to use the Ada model to get embedding scores, so that we could store the matrices and use pg_vector to recommend related topics by tag.

But as I was doing it, it occurred to me that when we add products into Sanity we might be able to fetch the embeddings in a similar way on publish / save using
Document Actions and then wherever I needed to send that info do could compute it.
We're doing some things with the Cloudinary API directly, for example, and Cloudinary's npm package does not want to be used at all client-side, so I had to make an API route in our app to run the stuff, and have our Studio go fetch things from that app.

I'm sure there are more clever ways to go about it, but for right now we get a lot of mileage out of basic custom input components -- we're still in v2 but there are a lots of
guides to help you wade past the boilerplate . And one nice thing about v3 is that you really only have to focus on the aspects of fields and inputs that you actually want to change so you don't have to bring all of that in just to adjust one or two things, or set up a small additional function to load info in.
It's always been a composable environment, but now it's leaner and easier to achieve those customizations.

What did you have in mind, specifically?
first of thanks for the detailed reply
user S
!!
so ill probably mock it up and share it in few days (im a full time designer, hobbyist coder) hence quite limited in technical skill to implement.

one idea is to have grammarly like ux that helps when needed (secondary in terms of ux hierarchy).

another idea which is probably more viable im imagining an input for chatgpt to help outline or draft that either used directly in the content or feeds a body/description input field.

I hope these makes sense
No problem!
As it happens, the same library you can use on your site or in your apps to pull down and use Sanity content can be run within the studio itself. Also, the portable text editor's content can be accessed in such a way as to flatten down to pure, raw text.

I could see a reasonably straightforward mechanism where someone enters a prompt into one field and you convert the response back into a portable text format to inject it into the page.

On a lark I just wrote a line of HTML to ChatGPT and asked it to convert it to Portable Text format so while tools exist to do that there's a chance you even get the response pre-formatted to only have to set it for that field.

Another exciting prospect is to pull from multiple parts of your studio to arrive at a conclusion.

For example, you could pull in every field on a current product page, hit a button, and send that along with a message that essentially says, "Write some exciting content to summarize this product based on these details" and get something that's highly likely to be reasonable right out of the gate.

I find it personally astounding what context it can arrive at from inference.

I just bought new eyeglasses and they wanted me to sign up for an account on their website to track my order coming in for pickup. in the logged in area, it had a bunch of numbers and initials I didn't understand that it said was my prescription information. I copied the list of seven lines of info, pasted it into the AI bot, and it told me that my sight wasn't actually all that bad (true) and that my right eye had an astigatism (a word I never mentioned, and also true).

I am no Sanity expert (official support staff have a different badge; I volunteer some time here to lend a helping hand) but I do have a decent amount of experience at this point and I have actively interacted with the APIs of some of these AI tools. After you've got a mockup going, and clear actionable idea of what you'd like to see, follow up here and I will do my level best to guide you through creating something useful to that end!

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?