Skip to main content

Use AI variables in lemlist

Unlock the Magic of AI Variables for Personalized Campaigns! ✨

Updated today

Learning Objective

By the end of this guide, you'll know how to set up AI Variables, configure AI settings for different use cases, generate personalized content at scale, and troubleshoot common issues. You'll be able to clean messy data, write tailored messages, and segment thousands of leads in seconds using AI-powered prompts.

Why This Matters

Raw lead data rarely arrives campaign-ready. Job titles have emojis, company names are inconsistent, and personalization fields need context-aware content. AI Variables automate this cleanup and personalization work that would otherwise take hours.

With AI Variables, you can:

  • Clean 1,000+ leads in under a minute instead of manual editing

  • Generate personalized intro lines that increase reply rates by 20-30%

  • Standardize inconsistent data (job titles, company names) for better segmentation

  • Write contextual messages based on lead information without copying and pasting

AI Variables turn messy, generic data into clean, personalized content that drives authentic conversations and higher engagement.

Prerequisites

Before you start, make sure you have:

  • An OpenAI API key connected (recommended) or lemlist credits available for AI generation. See the setup guide if you need help connecting your API key.

  • A campaign with leads imported that includes the custom variables you want to transform or clean

  • Basic understanding of custom variables and how they work in lemlist sequences

Core Lesson: Step-by-Step Workflow

Phase 1: Access AI Variables

Step 1: Navigate to your campaign's Leads page

Go to Campaigns, then select your campaign.

Screenshot

Next, open the Lead list tab.

Screenshot

This is where all your lead data lives and where you'll create and manage AI Variables.

Step 2: Create an AI column from your Leads table

In your Leads table, click + Add, then select Create AI column.

Screenshot

Phase 2: Create Your First AI Variable

Step 4: Choose your starting point (template or scratch)

From the AI variable templates window, choose a template from the left panel (recommended), or click Create from scratch to write your own prompt.

Screenshot

Step 5: Name your variable

If you chose a template, the variable name is set automatically (e.g., cleanedJobTitle) but you can edit it.

If you're creating from scratch, enter a descriptive name that explains what the variable contains.

Naming examples:

  • personalizedOpener for intro lines

  • industryCategory for segmentation

  • companyNameCleaned for standardized names

πŸ’‘ Tip: Use camelCase or underscores for multi-word variable names to keep them clean and readable.

Step 6: Configure AI settings

Set your AI preferences based on your use case:

AI Provider: Choose from:

  • OpenAI (GPT) – Best for general-purpose tasks, data cleaning, and structured output

  • Claude – Excels at nuanced writing and context understanding

  • Perplexity – Strong for research-based content

  • Google – Alternative option with competitive pricing

Temperature setting (0 to 1):

  • 0 to 0.3 – Focused, consistent, deterministic output (best for data cleaning, standardization, professional contexts)

  • 0.4 to 0.6 – Balanced creativity and consistency

  • 0.7 to 1.0 – Creative, varied output (best for writing personalized messages, casual tone, intro lines)

Credit source:

  • If you connected your API key, your API credits are used

  • If not connected, lemlist credits are charged at 1 credit per successful request

πŸ’‘ Strategy guide:

  • Cleaning job titles β†’ Temperature 0.2, OpenAI

  • Writing personalized openers β†’ Temperature 0.7, Claude

  • Categorizing industries β†’ Temperature 0.3, OpenAI

Screenshot

Phase 3: Write and Test Your Prompt

Step 7: Write your AI prompt

If you selected a template, review and customize the prompt to fit your needs.

If you're creating from scratch, write clear, specific instructions for what the AI should generate.

Good prompt structure:

  1. What to do: "Remove emojis and abbreviations from job titles"

  2. Format: "Output only the cleaned title, no extra text"

  3. Example: "Input: 'CEO πŸš€' β†’ Output: 'CEO'"

Example prompts:

Data cleaning:

Remove all emojis, special characters, and abbreviations from #{{jobTitle}}. Return only the standardized job title. Example: "VP of Mktg πŸš€" becomes "Vice President of Marketing"

Personalized opener:

Write a one-sentence personalized opener for an outreach email based on this information: #{{companyName}} in #{{industry}}. Keep it under 20 words, conversational tone, and mention their industry or company focus.

Categorization:

Based on #{{companyName}}, determine the industry category. Choose from: SaaS, E-commerce, Finance, Healthcare, Marketing Agency, Other. Return only the category name.

πŸ’‘ Pro tip: Include examples in your prompt. AI performs better when it sees the expected input-output format.

Step 8: Generate AI variables

Once your prompt is ready, click Generate AI column, then choose:

  • Generate all rows: Runs AI on every lead, overwriting any existing data in that column

  • Generate empty rows only: Runs AI only on leads where the variable is currently empty, preserving existing data

πŸ’‘ When to use each:

  • All rows: When you've updated your prompt and want fresh results for everyone

  • Empty rows only: When adding new leads to an existing campaign with AI Variables already set up

Screenshot

The AI processes your leads based on your prompt. Depending on lead count and AI provider, this typically takes 10-60 seconds.

Phase 4: Review and Refine Results

Step 9: Check the generated output

Once generation completes, review the AI Variable column in your Leads table.

Check for:

  • Accuracy: Does the output match what you expected?

  • Consistency: Is the format uniform across leads?

  • Quality: Would this content work in your sequence?

Step 10: Regenerate if needed

If the output isn't quite right:

  1. Open your AI column settings again

  2. Adjust your prompt (make it more specific, add examples, change temperature)

  3. Click the " Generate AI column again

You can iterate as many times as needed to get the right output.

πŸ’‘ Refinement tip: If the output is too generic, lower the temperature and add more specific instructions. If it's too robotic, raise the temperature slightly.

Phase 5: Use AI Variables in Your Sequence

Step 11: Insert the variable into your email

Go to Sequence and open the email step where you want to use your AI Variable. Then click Add personalization and select the AI Variable you want to insert (for example, Clean job title / #{{cleanJobTitle}}) from the personalization picker.

Screenshot

The AI-generated content will automatically populate for each lead when the email is sent.

Step 12: Enable auto-generation for new leads (optional)

To automatically generate AI Variables for newly imported leads:

Go to AI Variables settings β†’ Enable Auto-generate for new leads

This ensures any leads added after initial generation get AI Variables populated automatically without manual regeneration.

πŸ’‘ Time-saver: Enable this if you're continuously importing leads to your campaign over time.

Practical Application / Real-Life Example

SaaS Company Scenario: Cleaning and Personalizing at Scale

A B2B SaaS company targeting sales leaders had 2,500 leads with messy job title data:

  • "VP of Sales πŸš€"

  • "Head of Rev Ops (RevOps)"

  • "CRO | Chief Revenue Officer"

  • "Sales Dir."

Their workflow:

Step 1: Created an AI Variable cleanedJobTitle with this prompt:

Remove emojis, special characters, abbreviations, and parenthetical text from #{{jobTitle}}. Expand abbreviations to full titles. Return only the clean title. Examples: "VP of Sales πŸš€" β†’ "Vice President of Sales", "Sales Dir." β†’ "Sales Director"

Step 2: Set the temperature to 0.2 (focused output) and choose OpenAI

Step 3: Generated for all 2,500 leads in 45 seconds

Step 4: Created a second AI Variable personalizedOpener with this prompt:

Write a one-sentence opener for a cold email to a #{{cleanedJobTitle}} at #{{companyName}}. Refer to their role's main challenge. Keep it under 15 words and conversational. Example: "Most VPs of Sales struggle to keep reps productive during onboarding."

Step 5: Set temperature to 0.7 (creative output) and choose Claude

Step 6: Generated personalized openers for all leads

Results:

  • Data cleanup: 100% of job titles standardized in under 1 minute (vs. 8+ hours of manual work)

  • Personalization: 2,500 unique intro lines generated in 2 minutes

  • Campaign performance: 23% reply rate (vs. 9% baseline with generic messaging)

  • Time saved: ~10 hours of manual work automated

Key takeaway: AI Variables transformed unusable, messy data into clean, personalized content that drove 2.5x higher engagement, all in under 5 minutes of setup time.

When a Template Relies on a Missing Variable

If you choose a template that requires a custom variable and that variable doesn't exist in your lead data, a yellow banner appears.

The banner shows which variable is missing (e.g., "This template requires #{{companyIndustry}} but it's not found in your leads").

Fix:

  • Add the missing variable by importing a CSV with that column

  • Or manually create the variable in your Leads page

  • Once added, regenerate the AI Variable

The AI cannot generate output until all required input variables exist.

Troubleshooting & Pitfalls

Issue: The AI variable column is empty after generation

Root cause: The prompt may be unclear, the required input data is missing, or the AI couldn't interpret the instructions

Fix:

  • Check that the custom variable your prompt references (e.g., #{{jobTitle}}) exists and contains data

  • Make your prompt more specific with examples of expected output

  • Lower the temperature to 0.2-0.3 for more consistent results

  • Test on 5-10 leads first to verify before generating for all

Issue: The AI output doesn't match what I expected

Root cause: Prompt lacks specificity, temperature is too high/low, or examples are missing

Fix:

  • Rewrite your prompt with explicit instructions and 2-3 input β†’ output examples

  • Adjust temperature:

    • Too generic/robotic? Raise temperature to 0.6-0.8

    • Too random/inconsistent? Lower temperature to 0.2-0.4

  • Specify the exact format you want: "Return only the category name, no punctuation or extra text"

Issue: Yellow banner says a variable is missing

Root cause: The template you selected requires a custom variable that isn't in your lead data

Fix:

  • Check which variable is missing in the banner message

  • Add that variable by:

    • Importing a CSV that includes that column

    • Manually creating it in the Leads page and filling in data

  • Once the variable exists with data, regenerate the AI Variable

Issue: I'm being charged credits even though I connected my API key

Root cause: API key may not be connected correctly, or the credit source setting is set to lemlist credits

Fix:

  • Go to Settings β†’ Integrations β†’ OpenAI and verify your API key is connected

  • In AI Variables settings, confirm Credit source is set to "Use my API key"

  • Disconnect and reconnect your API key if the issue persists

  • Check your OpenAI account to verify the API key is active and has available credits

Issue: AI generation is taking too long or timing out

Root cause: Large lead list (1,000+), complex prompt, or API provider is experiencing delays

Fix:

  • Generate in smaller batches (500 leads at a time) instead of all at once

  • Simplify your prompt. Complex instructions take longer to process

  • Try a different AI provider (switch from Claude to OpenAI, for example)

  • Wait a few minutes and try again if the provider is experiencing high traffic

Optimization Tips

To maximize AI Variables' effectiveness:

Start with templates, then customize: Templates give you proven prompt structures. Once you understand how they work, adapt them to your specific needs or create from scratch.

Use temperature strategically:

  • Data cleaning and categorization: 0.2-0.3 (focused, consistent)

  • Writing subject lines or openers: 0.6-0.8 (creative, varied)

  • Professional formal content: 0.3-0.5 (balanced)

Test small before scaling: Generate AI Variables for 50-100 leads first. Review the output, refine your prompt, then generate for all leads once you're satisfied.

Include examples in your prompts: AI performs significantly better when you show input β†’ output examples. Include 2-3 examples in your prompt for best results.

Chain AI Variables: Create one AI Variable to clean data, then create a second AI Variable that uses the first one as input. Example: Clean job titles first, then write personalized openers based on cleaned titles.

Monitor credit usage: If using lemlist credits, check your usage in Settings β†’ Billing. Consider connecting your own API key if you're generating variables frequently. It's typically more cost-effective at scale.

Regenerate after data updates: If you enrich leads with new information (new custom variables, updated company data), regenerate AI Variables to incorporate the fresh data.

Enable auto-generation: For campaigns where you continuously add leads, enable auto-generation so new leads get AI Variables populated automatically without manual work.

Use specific AI providers for specific tasks:

  • OpenAI (GPT): Data cleaning, categorization, structured output

  • Claude: Writing personalized messages, nuanced content, and longer text

  • Perplexity: Research-based content, factual information

  • Google: Cost-effective alternative for general tasks

What You Cannot Do with AI Variables

AI Variables work only on custom variables that you create. They cannot be applied to default lemlist variables such as:

  • First Name

  • Last Name

  • Email

  • Company Name

  • LinkedIn URL

  • Phone

These default fields are system-managed and cannot be modified or generated using AI Variables.

Related Articles

Did this answer your question?