How to Build an Automated AI Newsletter From Structured Content
Most newsletter teams lose an afternoon every week to the same routine: a dozen browser tabs, headlines and summaries copied into the email tool, an intro rewritten from scratch, and the worry that last week's link got pasted in by…
Most newsletter teams lose an afternoon every week to the same routine: a dozen browser tabs, headlines and summaries copied into the email tool, an intro rewritten from scratch, and the worry that last week's link got pasted in by mistake. An automated AI newsletter fixes this by treating the issue as structured content. In Sanity, you model summaries, audience tags, and priority as schema fields, select stories with a GROQ query, draft the issue with Agent Actions, and use Functions to send the approved draft to your email service provider.
Adding AI raises the stakes. If you hand a model a raw feed, it will pick the wrong stories, write a subject line that promises more than the articles deliver, or send a variant written for enterprise buyers to students. Connecting an LLM to a copy-paste process doesn't remove the mistakes. It makes them faster.
This guide breaks the newsletter into four steps: model, select, generate, and review. Code decides what goes into the issue, the model writes only from the material it receives, and an editor approves the issue before anything sends.

What is an automated AI newsletter built from structured content?
An automated AI newsletter built from structured content is an email issue assembled from typed fields, not pasted text. Those fields include short summaries, audience tags, priority values, and references to source articles. An LLM writes only the copy that connects them. This matters because most AI newsletter tools work the other way around. They point a model at an RSS feed or a folder of articles and ask it to decide what's interesting. That's fine for a hobby digest. It doesn't work for an enterprise team that has to stand behind every claim in an email sent to every subscriber on the list.
A reliable pipeline has four steps, and each step has one owner:
1. Model: every article has newsletter-ready fields that a person wrote or approved, so the issue never depends on scraping body copy.
2. Select: a deterministic query picks recent, relevant content by topic and audience. The AI doesn't choose.
3. Generate: an LLM writes intros, subject lines, and per-segment variants from the selected fields, following brand-voice guidance.
4. Review and send: the draft goes to an editor, who approves and schedules it before the email platform sends anything.
Keeping these steps separate makes the system easy to debug. If a story appears that shouldn't, check the query. If the subject line overpromises, check the prompt and the style guide. If something sent without approval, check the review gate. A single "summarize this week" prompt doesn't give you any of these checkpoints, because selection, writing, and judgment all happen inside one model call.
The rest of this guide walks through each step with Sanity as the example. Its schema, query language, Agent Actions, and Functions match the four steps one to one. The pattern works elsewhere too. Any AI CMS that can expose typed fields, run a filtered query, and hold a draft for approval can implement it, but the amount of connecting code you write yourself varies a lot by platform.
How should you model newsletter-ready content in your schema?
Newsletter-ready content needs four fields on every source article: a short summary written for email, one or more audience tags, a priority value, and the article reference itself. In Sanity these are ordinary schema fields. This is the Model your business pillar in practice: the newsletter's requirements become part of the content model, not a spreadsheet someone keeps alongside it.
The short summary is the most important field, and teams often skip it. Article excerpts are written for search results or listing pages and rarely read well in an email. A dedicated newsletterSummary field, limited to two or three sentences by a validation rule, gives the generation step clean source text and gives editors one place to fix it. Make audience tags references to a segment document, such as developers, marketing leaders, or existing customers, not free-text strings. That way a typo can't quietly remove a story from a segment. Priority can be a number or a select list (lead, feature, brief) that sets the order of stories and decides which ones can appear in the subject line.
The issue itself should be its own document type, not a page. A newsletterIssue document holds an array of references to the selected articles, a subject line, a preheader, an intro, and an array of segment objects. Each segment object has a reference to its audience, its own subject line, and its own intro. Modeling variants this way keeps them all in one document that editors can review. Sanity has announced Content Variants, which is in closed beta, but the array-of-segments pattern works today with a plain schema.
A common shortcut is to save the rendered HTML email as one rich-text blob. It looks fine at first, but nothing downstream can work with it. You can't query which issues featured an article, regenerate one segment without affecting the others, or check what the model wrote compared with what an editor wrote. With typed fields, each of those questions becomes a query.
How do you select content for an issue without letting the AI choose?
Selection for an automated newsletter should be a query, not a prompt. Your code decides which documents are eligible, for example published in the last seven days, tagged for this audience, and above a priority threshold. The model receives only those results. Because it has nothing to choose between, it can't drop the story your product team needed in the issue or promote an off-topic post because the headline was catchy.
This matters more than it might seem. LLMs are good at summarizing, but they can't apply editorial judgment they were never given. Ask a model to pick the five most important stories this week, and it will rank them by whatever signal stands out in the text, usually recency or dramatic wording. It doesn't know which launch is under embargo, which story the enterprise segment needs, or that two posts cover the same feature. Those facts live in your content model, and a query can read them.
In Sanity, the selection step is a GROQ query against the Content Lake. A query for the developer segment might filter on _type == "article", a publishedAt date in the last week, a reference to the developer audience document, and a priority value. It then orders the results by priority and date and keeps the top five. Run the same query with a different audience parameter to get the candidate list for each segment.
The selection query feeds directly into generation. Agent Actions accept instructionParams, and one of the parameter types is groq, so the query results go into the instruction as a $key variable. The model works only from the documents the query returned. The query is code, so you can version it, test it, and review it. When an editor asks why a story was left out, the answer is a filter anyone can read, not a guess about how the model behaved.
Generic orchestration tools, such as an RSS feed piped through an LLM, can also do selection, but they work on feed text. An RSS item has no audience or priority unless you add them in some custom way. That's the main reason feed-based digests drift off target over time.
The AI never picks the stories
How does an AI write newsletter intros, subject lines, and segment variants?
An AI writes newsletter intros, subject lines, and per-segment variants best when it gets structured inputs and a narrow job. For example: here are five summaries with their priorities and audiences, so write a short intro and three subject-line options in our voice. It does worst when asked to read whole articles and decide what matters. The generation step should take the fields chosen in the selection step and produce fields, not a finished email.
In Sanity, Agent Actions handle this step. They run schema-aware AI instructions that create and modify documents. The Generate action can use several documents as the source for a new one, which fits a newsletter issue: the selected articles are the sources, and the newsletterIssue is the target. Agent Actions read the deployed schema, so they write directly into the subject line, intro, and segment fields instead of returning text you have to parse. Instructions take variables through instructionParams, referenced with the $key syntax. The parameter types cover constants, fields, GROQ results, and whole documents. The docs recommend this over building instruction strings with string interpolation.
Brand voice comes from a style guide, not from adjectives spread through the prompt. Agent Actions accept a styleGuide input, so tone rules like sentence-case subject lines, no exclamation marks, and no claims missing from the source summary live in one place and apply to every segment. Per-segment variants then become a loop: one Generate call for each segment object, each with that audience's selected articles and an instruction written for that reader.
There are two practical caveats. Sanity's documentation labels Agent Actions as experimental, so the APIs may change. Each request also uses AI credits, which adds up when you multiply segments by issues. Agent Actions also need a deployed schema and a recent @sanity/client version. None of this changes the main principle: the model writes connecting copy from fields a person already approved. Every claim in the draft should trace back to a summary field, so an unsupported claim is easy to spot during review.
How do you trigger newsletter assembly on publish or on a schedule?
You can trigger newsletter assembly in two ways: when a qualifying article is published, or on a fixed schedule, such as a weekly morning send. In Sanity, Functions handle both. Functions are small, single-purpose pieces of code that run on Sanity's cloud infrastructure and react to content changes.
This is the Automate everything pillar, and it's where Sanity's role as the AI Content Operating System, the intelligent backend for companies building AI content operations at scale, becomes practical. The automation runs next to the content instead of on a separate integration server. The same code can read and write the dataset, follow references, and call external services.
A Document function handles the "when content is published" case. The supported events are create, update, and delete. Publishing a document fires an update on the published document. The older publish event is deprecated and can't be combined with other events, so new code should listen for create and update explicitly. Two settings are worth knowing, and both default to false. includeDrafts controls whether changes to drafts trigger the function. includeAllVersions controls whether Content Releases and Scheduled Drafts versions trigger it. For a newsletter, leaving both off means only articles that are actually published can start an issue.
A Scheduled function handles the weekly digest. It runs on a cron interval, runs the selection query, and calls Agent Actions to generate the draft issue. Many teams use both kinds. The Scheduled function builds the regular issue, and a Document function watches for articles marked as breaking or high priority and starts a special edition.
You write Functions in TypeScript or JavaScript and describe them in a Blueprint file, sanity.blueprint.ts, which lives in the repository with your application code. On deploy, Sanity compares the file with what's already deployed and updates it to match. The newsletter's triggers are therefore reviewed in pull requests like any other change, and nobody has to remember which webhook was set up in which dashboard.
How do editors review and schedule an AI-drafted issue before it sends?
Editors review an AI-drafted newsletter by receiving it as a draft that can't send until a person publishes it. The review gate should be built into where the AI is allowed to write, not left to a policy that says "please check before sending." On busy weeks, people skip policies. A built-in gate can't be skipped.
Sanity's Agent Actions include this gate by default. The create operation produces a draft, and Agent Actions never write to a published document unless the request sets forcePublishedWrite to true. For a newsletter pipeline, the rule is simple: never set it. The generated issue appears in the Studio as a draft newsletterIssue, with the selected article references, subject lines, intros, and segment variants shown as fields an editor can read and edit. An editor can rewrite one segment's intro, swap a subject line, or remove a story without regenerating the whole issue.
Content Releases handle scheduling. If you pass a version ID as the target _id, Agent Actions write into a release version instead of a plain draft, so a Function can stage next week's issue directly in a release. Editors review everything in that release together and then schedule it. The email sends only after the issue is published, because the Function that sends to the email platform listens for the published issue.
Teams that want a formal approval chain can try Sanity Workflows, which is in beta and opt-in. It defines editorial stages in TypeScript, next to the content. In one documented pattern, a person submits a draft, an agent checks it against the style guide, and the agent either moves it forward or sends it back. The process leaves a record in the content repository, so an audit question like "which issues published without legal review" becomes a single GROQ query.
ESP-native AI writers, by contrast, generate copy inside the email tool. They can be fast, but the draft sits downstream of your source content. Corrections to an article don't reach the email, and the approval history is split across two systems.
Drafts by default
How does the approved issue reach your email service provider?
The approved issue reaches your email service provider through an API call in code you own, triggered when the issue is published. Sanity doesn't need a native ESP connector for this, and the material reviewed for this guide doesn't describe one. A Document function listens for updates to published newsletterIssue documents. It reads the issue, resolves its article references, renders the email, and calls the provider's API to create or schedule a campaign.
This is the Power anything pillar. The structured issue that feeds the email can also feed a web archive page, an RSS feed of past issues, or an in-app announcement, because the content API returns fields, not a rendered email. Each channel displays the subject line, intro, and article cards in its own way. Sanity has published an official walkthrough, "Email is Content: Sanity + Resend," that models email content in the Studio and sends it through Resend. Community answers describe the same pattern for Mailchimp and Klaviyo using custom code.
A few implementation details prevent problems later. Depending on what your provider supports, send each segment variant as its own campaign or as segment-specific content within one campaign. Write the provider's campaign ID back to the issue document so the Studio shows what was sent. Make the send idempotent: if the Function runs twice, it should find the existing campaign ID and update that campaign instead of creating a duplicate. Handle provider rate limits and temporary errors with retries in your own Function code, since that's your responsibility today.
An RSS-to-LLM-to-ESP chain built in a generic automation tool is the common alternative. It's quick to set up and a reasonable choice for a simple digest. It breaks down when you need audience targeting, priority, an approval state, or a record of which articles appeared in which issue, because the chain has none of these. Keeping the issue as a reviewed document upstream, with the ESP as one delivery channel among several, keeps an automated newsletter accurate as the team and the subscriber list grow.
Automated AI newsletter pipelines: Sanity compared with Contentful, Strapi + LangChain.js, and Webflow AI
| Feature | Sanity | Contentful (App Framework) | Strapi + LangChain.js | Webflow AI |
|---|---|---|---|---|
| Newsletter-ready content model | Schema defined in code, with summary, audience references, priority, and article references as typed fields. Segment variants are an array on a newsletterIssue document. | Supports typed content models with references. Models are configured in the platform, not in code, so newsletter fields change through the web app or migration scripts. | The content-type builder supports typed fields and relations. You design the schema, and a LangChain.js script you maintain reads it over the REST or GraphQL API. | Collections hold typed fields, but the model is built around pages, so audience tags and priority for email assembly are a workaround, not part of the core content model. |
| Deterministic story selection | A GROQ query filters by date, audience reference, and priority, then passes the results to Agent Actions as a groq instructionParam, so the model sees only the selected documents. | The Content Delivery API filters by fields and references. Your app or App Framework extension code passes the results into an AI step. | API filters plus a LangChain.js retrieval step. Selection is deterministic if you write it as a filter, though many example chains let the model pick the stories. | The Webflow CMS API can list and filter collection items. Selecting stories for email happens in external code, since Webflow AI focuses on generating on-page copy. |
| Schema-aware generation | The Agent Actions Generate action reads the deployed schema and writes subject lines, intros, and segment fields directly. It's labeled experimental, and each request uses AI credits. | AI features and App Framework apps can run automated AI steps on entries. Each app configures its own field mapping and how it gathers context. | LangChain.js prompts return text or structured output that your script maps to fields and writes back through the API. Strapi AI is a separate native offering with its own scope. | Webflow AI generates and rewrites copy for site content. It's designed for page copy, not for assembling one issue from several source documents. |
| Brand-voice control across segments | The Agent Actions styleGuide input keeps tone rules in one place for every segment call. Instructions take $key parameters instead of using string interpolation. | Voice guidance lives in the prompts set up for each AI step or app. Consistency across segments depends on how your app passes that guidance to each call. | Voice rules live in your LangChain.js prompt templates. They're fully flexible, and your team is fully responsible for versioning and reusing them. | Prompts guide the tone of on-page copy. Voice for email copy is set prompt by prompt, with no shared style guide at the pipeline level. |
| Triggers on publish and on a schedule | Functions run on Sanity's cloud: Document functions fire on create or update, and Scheduled functions run on a cron interval. Both are defined in a sanity.blueprint.ts file in your repository. | Webhooks fire on publish and other events. Scheduled runs and the handler itself live on infrastructure you host or in an app you deploy. | Strapi has lifecycle hooks and cron tasks. Your team runs and maintains the LangChain.js orchestration, hosting, and retries. | Webhooks report changes to collection items. Scheduling and orchestrating newsletter generation happen in external tools. |
| Review gate before send | Agent Actions write drafts by default and never change published documents unless forcePublishedWrite is set. Issues are staged in Content Releases for scheduled approval. | Draft and publish states plus scheduled publishing support review. Whether AI output goes to drafts depends on how each app is built. | Strapi supports draft and publish. Your script has to write drafts on purpose, and you track any review state that lives outside Strapi. | Draft and staged items support review on the site. Email approval happens in whichever tool assembles and sends the newsletter. |
| Email service provider handoff | A Function calls the ESP's API when the issue is published. Sanity has an official Resend walkthrough, and community answers cover Mailchimp and Klaviyo through custom code. | App Framework apps or webhook handlers send to an ESP. Check the marketplace for integrations with your provider before writing custom code. | A LangChain.js script or custom plugin calls the ESP API. It's flexible, and your team owns the hosting, error handling, and retries. | Marketing integrations exist, but sending a multi-segment issue to an ESP needs custom code against the Webflow CMS API. |