DEV Community

Cover image for Build personalized email campaigns per customer
Rishi Raj Jain
Rishi Raj Jain

Posted on

Build personalized email campaigns per customer

This guide walks through a workflow I used recently i.e. connect Orshot to Cursor, turn a reference image into a parameterized template, render a unique hero image per customer, and send it through your email provider. You stay in the editor for design and exploration and production sends use the API the same way any other integration would.

By the end of this guide, you will have a studio template with named parameters (customer_name, headline, hero_image, and so on), a render call that returns a hosted image URL per row of customer data, and a small script that combines that URL with an email send.

Prerequisites

  • An Orshot account
  • A Cursor setup
  • Whatever you already use for transactional email (Resend, AutoSend, etc.). A CSV or database of customers is enough for the last step.

What I was actually trying to do

Before the steps, it helps to be explicit about the loop, because each section maps to one part of it.

You start with a reference image (a newsletter you liked, a competitor layout, a crop from a mood board). In Cursor you ask the agent to build something similar in Orshot and to mark which layers should change per recipient. Those marks become API parameters. For each customer you pass different values into the same template, get back an image URL, and embed that URL in the email body.

Getting the MCP connected

I love being in Cursor all day and so I set up Orshot's MCP server to avoid interacting with the console manually for updation, deletion and other functions. These are the steps I followed:

  • Sign in at orshot.com.
  • Go to Generate → Agents & MCP → Cursor → Install in Cursor. That adds the Orshot MCP server to Cursor’s configuration.
  • In Cursor, click "Connect" the MCP server when prompted, then complete authorization in the Orshot dashboard in the browser tab that opens.

  • Verify the install: open Cursor’s MCP settings and confirm tools are listed, including orshot_create_template_design, orshot_generate_image, orshot_batch_render, and orshot_get_studio_template_modifications, etc.

Turning a reference image into a template

You do not need to open Orshot Studio first. The flow below is what worked for me - reference in chat, create a simple layout, refine, then parameterize.

Step 1. Bring the reference into Cursor

Paste or attach your inspiration image in the chat. In the same message, describe the layout and the output size. Email heroes are often around 600px wide so pick a width and height you will keep for the whole campaign to avoid re-rendering at multiple sizes later.

The prompt that works for me always:

Here is a reference for an email hero. Build an Orshot template in the same spirit. Canvas 600×400. Keep the first version simple — background, headline, image area, CTA only.

Step 2. Let the agent create, refine and parameterize

The agent will typically call orshot_create_template_design for a first pass, then orshot_update_template_design for spacing, type, and polish. Asking for a perfect layout in a single call often produces a muddier result than create-then-refine so treat the second pass as a normal step.

Here's a prompt that worked for me:

Mark headline, hero_image, customer_name, and cta_label as parameters. List all modification keys for this template and give me the template ID.

Once you are through with the changes, look at the parameters summarized by Cursor to ensure that it's the way you want them to be for your template.

Step 3. Render a test image

Here'a a prompt that allows me to render my template for custom values:

Render template [ID] with customer_name "Alex", headline "Hi, Alex", hero_image [public URL], cta_label "View account". Return a PNG URL.

Open the URL in a browser. If the layout is wrong, iterate in chat (orshot_patch_template_elements for small text or style tweaks, or another orshot_update_template_design for bigger changes). The template also appears in Orshot Studio if you want to adjust pixels by hand.

Once the template exists, the rest is mostly data

After the design is stable, each send is the same operation with different modifications. Keys must match the parameterId values from the previous section.

For dozens or hundreds of customers, loop in your own code against the REST API instead of pushing everything through chat. Keep the same modifications object per row and add a queue, retries, and logging as you would for any outbound job.

Step 1. Prepare customer data

Each row needs at least an email address and the values for your template parameters (name, plan, image URL, etc.). A CSV, database export, or CRM webhook all work as long as you can map columns to modification keys.

Step 2. Render, then send

The pattern is always to render → image URL → HTML body → send. Example with the Node SDK (swap in your email client):

import { Orshot } from "orshot";

const orshot = new Orshot(process.env.ORSHOT_API_KEY);

const TEMPLATE_ID = 12345;

type Customer = {
  email: string;
  name: string;
  plan: string;
  heroUrl: string;
};

async function sendPersonalizedHero(customer: Customer) {
  const { url: imageUrl } = await orshot.renderFromTemplate({
    templateId: TEMPLATE_ID,
    modifications: {
      customer_name: customer.name,
      headline: `${customer.name}, your ${customer.plan} summary`,
      hero_image: customer.heroUrl,
      cta_label: "View dashboard",
    },
    responseType: "url",
    responseFormat: "png"
  });

  await emailProvider.send({
    to: customer.email,
    subject: `Your ${customer.plan} update`,
    html: `
      <p>Hi ${customer.name},</p>
      <img src="${imageUrl}" width="600" alt="" style="display:block;max-width:100%;" />
      <p><a href="https://app.example.com">Open your account</a></p>
    `,
  });
}
Enter fullscreen mode Exit fullscreen mode

Step 3. Verify end to end

Run one real row, pull name and plan from your spreadsheet, render, send to your own inbox, and confirm the image loads in Gmail (or whatever client your audience uses).

What I would change if I did it again

These are not requirements, but they would have saved me time on a second run.

I would decide which fields are dynamic before the layout is final, so parameter names never diverge from what I expect. I would pick canvas dimensions once and avoid re-rendering at multiple scales unless a second channel really needs it.

For work where brand fidelity is non-negotiable, you will still want a designer in the loop!

Ending Thoughts

What helped me most was dropping the repetitive export step of settling the layout, marking what should change (name, headline, image, CTA), and after that you only pass in different values and paste the URL into the message, same structure every time without opening a design file for each person. You do not need to be a designer for that part either, you can describe what you want in plain language and work from a screenshot you like, the agent and MCP handle the layout work well enough for onboarding emails, renewals, and other campaigns where “good enough and consistent” beats hand-polishing every asset.

Top comments (0)