Publishing blog content consistently is one of those things that sounds simple until you're actually doing it. Between research, drafting, editing, and getting it into your CMS, a single post can eat up half a day. The Miniloop AI Blog Writer template cuts that down to minutes.
This guide walks you through exactly how to set it up and start publishing AI-written drafts directly to your Sanity project.
What the Template Does
The AI Blog Writer is a five-step automated workflow. When you give it a topic, it:
- Researches the subject and builds an outline
- Writes the full blog post based on that outline
- Generates a cover image to go with it
- Creates a draft document in your Sanity project
- Publishes the document when you're ready
Nothing goes live without your review. Every post lands in Sanity Studio as a draft first, so your team can edit, approve, or reject it before it hits your site.
Step 1: Clone the Template
Go to miniloop.ai/c/templates/blog-poster/setup and click Clone Template.
This creates a private copy of the agent in your Miniloop dashboard. The agent is yours to configure, run, and modify.
Step 2: Connect Your Sanity Project
The template needs to connect to your Sanity project to create and publish documents. You'll need three things:
- Project ID — found in your Sanity project settings
- Dataset — usually
production - API Token — needs write and publish permissions
Finding Your Project ID and Dataset
- Go to sanity.io/manage and open your project
- Your Project ID is shown at the top of the project overview page
- Your datasets are listed under the Datasets tab — copy the name of the one your site uses
Creating an API Token
- In your Sanity project, go to Settings and then API
- Click Add API token
- Give it a name like
Miniloop Blog Writer - Set permissions to Editor (this allows creating and publishing documents)
- Copy the token — you won't be able to see it again after closing the dialog
Adding the Connection in Miniloop
Inside your cloned agent, open the CMS connection settings and select Sanity. Paste in your Project ID, dataset name, and API token, then click Verify and Connect.
Once connected, you can configure which document type to use for posts and map fields like title, slug, body, and image to your schema.
Want to automate your workflows?
Miniloop connects your apps and runs tasks with AI. No code required.
Step 3: What to Say to Your Agent
Once connected, open your agent and give it a topic. Be specific. The more context you give, the better the output.
Here are some example prompts:
Write a blog post about the top benefits of headless CMS for marketing teams. Target keyword: headless CMS benefits.Write a 1500-word post comparing Sanity and Contentful for developer teams. Focus on schema flexibility and API access.Create a beginner guide to structured content. Explain what it is, why it matters, and how Sanity uses it.
You can also include tone instructions:
Write in a conversational tone, avoid jargon, and keep paragraphs short.This is for a technical audience. Go deep on implementation details.
After you send the prompt, the agent handles the rest. You can watch it work through each step in real time.
Step 4: Review in Sanity Studio
When the agent finishes, your post appears as a draft in Sanity Studio. Open it and give it a read.
The AI does a solid first draft, but you'll want to:
- Add any proprietary data, customer examples, or internal insights the AI doesn't have access to
- Adjust the intro if it feels generic
- Check that the keyword placement feels natural
- Confirm the slug and metadata look right
When you're happy with it, hit Publish in Studio. Or let the agent publish it directly if you've set that up.
Tips for Better Output
Give it a real angle. Instead of write about content marketing, try write about why most content marketing fails and what to do instead. A specific angle produces a more useful post.
Use brand voice guidelines. If your team has a style guide, paste key points into your agent settings. Things like preferred tone, words to avoid, and formatting preferences.
Review before publishing. The agent creates drafts. Treat them like you would a draft from a junior writer. Good foundation, needs a human pass.
Frequently Asked Questions
Do I need an OpenAI account to use this template? No. The AI capabilities are built into the Miniloop platform. You only need to connect your Sanity project.
Does this work with any Sanity schema? Yes. During setup, you map the agent's output to your specific field names. Common fields like title, slug, body, and image work out of the box. Custom fields can be mapped or given defaults.
Will posts go live automatically? Not by default. Every post is created as a draft in Sanity Studio. Your team reviews and publishes manually. You can configure the agent to publish automatically if you prefer.
What API token permissions do I need? Your token needs Editor-level permissions so it can create and publish documents. A Viewer or Read-only token won't work.
Can I run this on a schedule? Yes. Inside Miniloop, you can schedule the agent to run automatically on a cadence that fits your publishing calendar.
What if my schema uses custom block types? The agent creates standard Portable Text output by default. If your schema uses custom block types like callouts or code blocks, you can extend the configuration to support them.
Frequently Asked Questions
Do I need an OpenAI account to use this template?
No. The AI capabilities are built into the Miniloop platform. You only need to connect your Sanity project with your Project ID, dataset, and API token.
Does this work with any Sanity schema?
Yes. During setup you map the agent's output to your specific field names. Common fields like title, slug, body, and image work out of the box. Custom fields can be mapped or given defaults.
Will posts go live automatically?
Not by default. Every post is created as a draft in Sanity Studio. Your team reviews and publishes manually, though you can configure the agent to publish automatically.
What API token permissions do I need?
Your Sanity API token needs Editor-level permissions so it can create and publish documents. A Viewer or Read-only token will not work.
Can I run this on a schedule?
Yes. Inside Miniloop you can schedule the agent to run automatically on a cadence that fits your publishing calendar.
What if my schema uses custom block types?
The agent creates standard Portable Text output by default. If your schema uses custom block types like callouts or code blocks, you can extend the configuration to support them.



