Contact

How to Send The Right Content to Every Lead Using AI and Marketo

April 21, 2026

Traditional nurture campaigns pose a fundamental challenge to marketers.

They send the same email to every person in a segment, regardless of:

  • Where that person actually is in their buying journey
  • What content they’ve already consumed
  • What topics they care about most

While you can improve content relevance with good segmentation and branching logic, even the most sophisticated Marketo nurture programs are making educated guesses at scale. You’re grouping people into buckets and hoping the content resonates.

But what if you didn’t have to guess at all?

At Revenue Pulse, we’ve been building what we call “AI Nurture” (or “AI Next Best Offer”) for our clients. 

It’s a workflow where Marketo triggers an AI-powered process that reads each lead’s demographic and behavioral data, then picks the single best piece of content to send them. From there, it writes a personalized subject line and email body and returns everything to Marketo, ready to send.

The result is true one-to-one email nurturing. Every lead gets a unique email, crafted specifically for them.

In this article, we’ll walk you through the full architecture of this workflow and explain how each piece works. We’ll also be including code snippets you can reference when building your own version.

Let’s jump right in!

Why Traditional Nurtures Fall Short

If you’ve spent any time in Marketo, you’ve probably built an engagement program with multiple streams. You set up cadences, add content, and maybe even use transition rules to move people between streams based on score or behavior.

It works, but there are some real challenges we wanted to tackle. Here are the 3 big ones:

Everyone in a stream gets the same email. A VP of Marketing and a junior coordinator in the same stream will receive identical content, even though their pain points and decision-making authority are completely different.

Content selection is static. You decided the order of emails weeks or months ago. The nurture doesn’t adapt to real-time signals; it just follows the sequence you built.

Scaling personalization is painful. To get more targeted, you need more streams, more segmentations, more content variants. It quickly becomes unmanageable. We’ve seen instances with dozens of streams that still don’t feel personal to the recipient.

AI Nurture solves all of these problems by making content selection dynamic and individual, not static and segment-based.

The Full Architecture

Here’s how the entire flow works at a high level:

  1. Marketo fires a webhook to an iPaaS workflow (we typically use n8n, but Workato, Zapier, or any other iPaaS will work).

  2. The workflow pulls the lead’s data from Marketo, including demographics (title, industry, company size) and behavioral activity (emails opened, pages visited, forms filled, content downloaded).

  3. A content selection model receives this data along with a RAG knowledge base containing your full content library. The model picks the single best piece of content for that specific lead.

  4. A subject line model writes a personalized subject line, using your top and worst-performing email subject lines from the past month as reference material.

  5. An email body model writes personalized HTML email copy, also trained on your recent email performance data.

  6. The workflow writes the results back to Marketo into custom fields: AI Email Subject, AI Email Body (HTML), and AI Email Body Text.

  7. Marketo sends the email, using Velocity scripting to render the HTML content from those fields.

Let’s break down each step.

Step 1: The Webhook Trigger

In Marketo, you set up a Smart Campaign that fires a webhook when a lead qualifies for the nurture. The webhook sends the lead’s ID (or email) to your iPaaS workflow.

Your webhook URL might look something like:

				
					https://your-n8n-instance.com/webhook/ai-nurture?leadId={{lead.Id}}
				
			

On the iPaaS side, this triggers the workflow. The first node receives the lead ID and kicks off the data retrieval process.

Step 2: Pull Lead Data from Marketo

The workflow calls the Marketo REST API to get two things: the lead’s demographic profile and their activity history.

For demographics, you’d call the Get Lead by ID endpoint:

				
					GET 
/rest/v1/lead/{leadId}.json?fields=email,firstName,lastName,title,company,industry,numberOfEmployees,leadScore
				
			

For behavioral activity, you’d call the Get Lead Activities endpoint with the relevant activity type IDs (email opens, web page visits, form fills, and so on):

				
					GET 
/rest/v1/activities.json?leadId={leadId}&activityTypeIds=1,6,7,11,12&sinceDatetime=2025-01-01T00:00:00Z
				
			

The workflow then compiles this into a structured payload. Here’s an example of what that compiled data might look like:

				
					{
  "lead": {
    "firstName": "Sarah",
    "lastName": "Chen",
    "title": "Director of Marketing",
    "company": "TechCorp",
    "industry": "Software",
    "numberOfEmployees": 500,
    "leadScore": 47
  },
  "recentActivity": [
    {
      "type": "Visit Web Page",
      "detail": "/blog/ai-agents-for-marketers",
      "date": "2025-04-02"
    },
    {
      "type": "Fill Out Form",
      "detail": "2026 Planning Checklist Download",
      "date": "2025-03-28"
    },
    {
      "type": "Open Email",
      "detail": "March Newsletter - Budget Season Tips",
      "date": "2025-03-15"
    }
  ],
  "contentHistory": [
    "2026 Planning Checklist",
    "March Newsletter"
  ]
}

				
			

The contentHistory array is critical. It tells the AI what this person has already received, so it won’t recommend the same content twice.

Step 3: The Content Selection Model (RAG)

This is the core of the system. You send the lead’s compiled data to an LLM that has access to a RAG (Retrieval-Augmented Generation) knowledge base containing your content library.

Building the Content Library

Your content library is a structured document (or set of documents) that describes every piece of content your company wants to promote. Each entry should include:

  • Title: The name of the content piece
  • Type: eBook, webinar recording, blog post, case study, etc.
  • Summary: A 2-3 sentence description of what it covers
  • Key Takeaways: The main points someone will learn
  • Target Audience: Who this content is best suited for (by role, seniority, industry, buying stage)
  • URL/Link: Where the content lives
  • Tags: Topics covered (e.g., “budgeting”, “AI”, “data quality”, “attribution”)

Here’s an example of what one entry might look like:

				
					{
  "title": "Where Does AI Fit Into Your 2026 Budget?",
  "type": "Blog Post",
  "summary": "A guide for marketing leaders on how to budget for AI initiatives in 2026, covering use case identification, cost estimation, and building a business case for leadership.",
  "keyTakeaways": [
    "How to identify high-impact AI use cases",
    "Understanding the real costs beyond subscription fees",
    "Choosing between point solutions and custom implementations"
  ],
  "targetAudience": {
    "roles": ["VP Marketing", "Director Marketing Ops", "CMO"],
    "buyingStage": ["Awareness", "Consideration"],
    "industries": ["SaaS", "Technology", "B2B"]
  },
  "url": "https://yoursite.com/blog/ai-2026-budget",
  "tags": ["AI", "budgeting", "planning", "leadership"]
}


				
			

Your full library might have 50 to 200+ entries. The RAG system indexes this content so the model can search and retrieve relevant options quickly.

The Content Selection Prompt

The system prompt for your content selection model might look something like this:

				
					You are a content recommendation engine for a B2B marketing team.

You will receive:
1. A lead's demographic profile (title, company, industry, company size, lead score)
2. Their recent behavioral activity (pages visited, forms filled, emails opened)
3. A list of content they have already received

Your job is to select the single best piece of content from the content library
to send this person next.

Consider:
- Their role and seniority (match content to their level of decision-making authority)
- Their recent behavior (what topics are they actively researching?)
- Their buying stage based on lead score and activity recency
- What they have NOT yet received (never recommend content they already consumed)
- The logical next step in their journey (if they downloaded a beginner guide,
  suggest something more advanced on the same topic)

Return ONLY a JSON object with this structure:
{
  "selectedContent": {
    "title": "...",
    "url": "...",
    "reason": "A brief explanation of why this content was chosen"
  }
}

				
			

The model receives this system prompt along with the lead data and the content library (via RAG), then returns its pick.

Step 4: The Subject Line Writer

Once you know what content to promote, you need a compelling subject line. This is where the second model comes in.

What makes this model special is its knowledge base: you feed it your organization’s top-performing and worst-performing email subject lines from the past 30 days (or whatever timeframe makes sense). You can pull this data from Marketo’s Email Performance Report or via the API.

The knowledge base might look like this:

				
					{
  "topPerformers": [
    {
      "subjectLine": "Your 2026 plan is missing this",
      "openRate": 34.2
    },
    {
      "subjectLine": "We analyzed 500 campaigns. Here's what worked.",
      "openRate": 31.8
    },
    {
      "subjectLine": "Quick question about your Marketo setup",
      "openRate": 29.5
    }
  ],
  "worstPerformers": [
    {
      "subjectLine": "Monthly Newsletter - March 2025 Edition",
      "openRate": 8.1
    },
    {
      "subjectLine": "New Resources Available Now",
      "openRate": 9.4
    },
    {
      "subjectLine": "Don't Miss Out on These Insights!",
      "openRate": 10.2
    }
  ]
}

				
			

The system prompt for this model:

				
					You are an email subject line writer for a B2B marketing team.

You will receive:
1. The content piece being promoted (title, summary, key takeaways)
2. The recipient's profile (name, title, company, industry)
3. Examples of top-performing and worst-performing subject lines from
   this organization

Write a single subject line that:
- Reflects the patterns of the top-performing examples
- Avoids the patterns of the worst-performing examples
- Is personalized to the recipient's role and situation
- Creates curiosity without being clickbait
- Is under 60 characters

Return ONLY the subject line text. No quotes, no explanation.

				
			

Step 5: The Email Body Writer

The third model writes the actual email body. It uses the same performance knowledge base as the subject line writer, but this time it’s looking at full email copy patterns rather than just subject lines.

This model returns HTML, which is important because Marketo will render it inside your email template.

The system prompt:

				
					You are an email copywriter for a B2B marketing team.

You will receive:
1. The content piece being promoted (title, summary, key takeaways, URL)
2. The recipient's profile (name, title, company, industry)
3. Examples of top-performing and worst-performing emails from this organization

Write a short, personalized email body that:
- Addresses the recipient by first name
- Connects the content to a challenge relevant to their role/industry
- Includes a clear call-to-action linking to the content
- Matches the tone and patterns of top-performing emails
- Avoids the patterns found in worst-performing emails
- Is concise (under 150 words)

Return TWO versions:

1. An HTML version wrapped in a <div> tag with inline styles for formatting.
   Use only simple HTML: <p>, <a>, <strong>, <br>. Do not include <html>,
   <head>, or <body> tags. The HTML will be inserted into an existing
   email template.

2. A plain text version with no HTML tags.

Return as a JSON object:
{
  "htmlBody": "<div>...</div>",
  "textBody": "..."
}

				
			

Step 6: Write Results Back to Marketo

Once all three models have returned their results, the workflow writes the data back to Marketo using the Update Lead endpoint:

				
					POST /rest/v1/leads.json

{
  "input": [
    {
      "id": 12345,
      "aiEmailSubject": "Your 2026 plan is missing this piece",
      "aiEmailBodyHtml": "<div><p>Hi Sarah,</p><p>Planning season is here, and most marketing leaders we talk to are trying to figure out exactly where AI fits into next year's budget...</p><p><a href='https://yoursite.com/blog/ai-2026-budget'>Check out our latest guide</a> — it covers the real costs, the best use cases to start with, and how to build a case your CFO will approve.</p><p>Worth a read before your next planning meeting.</p></div>",
      "aiEmailBodyText": "Hi Sarah,\n\nPlanning season is here, and most marketing leaders we talk to are trying to figure out exactly where AI fits into next year's budget.\n\nCheck out our latest guide — it covers the real costs, the best use cases to start with, and how to build a case your CFO will approve.\n\nhttps://yoursite.com/blog/ai-2026-budget\n\nWorth a read before your next planning meeting."
    }
  ]
}

				
			

You’ll need three custom fields in Marketo to hold this data:

  • aiEmailSubject (String)
  • aiEmailBodyHtml (Text, large enough to hold HTML content)
  • aiEmailBodyText (Text)

These fields get overwritten every time the workflow runs for a given lead, so you always have the freshest AI-generated content ready to send.

Step 7: Rendering with Velocity Scripting

Here’s where it all comes together inside Marketo.

Your email template contains Velocity script blocks that pull the AI-generated content from the lead’s fields and render them.

For the subject line, you simply use the token:

				
					${lead.aiEmailSubject}
				
			

For the HTML email body, you need Velocity scripting to safely render the HTML. In your email template, you’d add something like:

				
					#set($aiBody = $lead.aiEmailBodyHtml)
#if($aiBody && $aiBody != "")
  $aiBody
#else
  <!-- Fallback content in case the AI fields are empty -->
  <p>We've got some great resources we think you'll find valuable.
  <a href="https://yoursite.com/resources">Check them out here</a>.</p>
#end

				
			

This script checks if the AI body field has content. If it does, it renders the HTML directly. If the field is empty for some reason (maybe the workflow failed or the lead was added to the campaign before the AI could process them), it falls back to a generic message.

For the text version of the email (used by email clients that don’t render HTML), you’d use:

				
					#set($aiTextBody = $lead.aiEmailBodyText)
#if($aiTextBody && $aiTextBody != "")
  $aiTextBody
#else
  We've got some great resources we think you'll find valuable.
  Visit https://yoursite.com/resources to explore.
#end


				
			

Important note on the HTML version: Because the AI returns HTML stored in a Marketo field, and Velocity renders it within your email template, you want to make sure the AI is only generating simple, inline-styled HTML. No external CSS, no JavaScript, no complex structures. Simple <p>, <a>, <strong>, and <br> tags with inline styles are your safest bet. Most email clients are picky about what they’ll render, so keeping it simple is both a technical and deliverability best practice.

What This Looks Like in Practice

Let’s walk through a quick example (We’re using a completely made-up person and company as a placeholder for this).

Lead: Sarah Chen, Director of Marketing at TechCorp (500-employee software company). Lead score: 47. Recently visited a blog post about AI agents, downloaded a 2026 planning checklist, and opened last month’s newsletter about budgeting.

What traditional nurture would do: Send Sarah the next email in Stream B, which is the same case study that every other lead in that stream also receives.

What AI Nurture does:

  1. Pulls Sarah’s full profile and activity history

  2. Recognizes she’s mid-funnel (decent lead score, active engagement), interested in AI and planning topics, and hasn’t yet seen the “Where Does AI Fit Into Your 2026 Budget?” article

  3. Selects that article as the best next piece of content

  4. Writes a subject line modeled after the organization’s best-performing emails: “Your 2026 plan is missing this piece”

  5. Writes a personalized email body that connects the content to her role as a marketing director during planning season

  6. Returns everything to Marketo, where the email is sent within minutes

Sarah gets an email that feels like someone on your team wrote it specifically for her. Because, in a way, something did.

A Few Things to Keep in Mind

Start with a solid content library. The AI is only as good as the options you give it. If your content library has 10 blog posts and nothing else, the recommendations will get repetitive fast. Aim for a diverse library that covers different topics, formats, buying stages, and audience segments.

Update your performance data regularly. The subject line and body writer models learn from your recent email performance. If you’re feeding them data from six months ago, they’re optimizing for patterns that may no longer work. We recommend refreshing this data monthly.

Build in fallbacks. Things will occasionally fail. An API times out, a model returns unexpected output, a field doesn’t get populated. Your Velocity scripts should always have fallback content, and your Smart Campaign should include a “wait” step to give the workflow time to complete before the email sends.

Test and iterate. Run A/B tests comparing AI Nurture emails against your traditional nurture campaigns. Track open rates, click rates, and most importantly, progression through the funnel. In our experience, the AI-generated emails consistently outperform static nurture content because they’re relevant to each recipient.

Watch your API usage. Each lead that goes through this workflow makes multiple API calls to both Marketo and your LLM provider. Be mindful of rate limits on both sides, and consider batching if you’re processing large volumes. Most iPaaS solutions let you add delays or queue management to stay within limits.

Wrapping Up

AI Nurture isn’t a futuristic concept. It’s something you can build and run today with tools that already exist: Marketo, an iPaaS like n8n or Workato, and any major LLM with RAG capabilities.

The shift it represents is significant. Instead of building nurture programs that treat segments as monoliths, you’re creating a system that treats every lead as an individual. It knows what they’ve done, understands where they are in their journey, picks the right content, and writes the email in a style that’s proven to work for your audience.

It’s one-to-one marketing at scale, and it’s not as far out of reach as you might think!

If you’re interested in building something like this for your organization, or if you want to see how Otto (our AI teammate for MOPs) handles nurture workflows, we’d love to chat. 

Reach out to us here to book some time with our team.