Personalized Sales Emails with n8n and Google Gemini AI

This workflow automates creating personalized sales emails by analyzing a customer’s past email correspondence with AI. It solves the problem of generic outreach emails by building a customer persona from email history and generating tailored sales messages using Google Gemini models.
manualTrigger
lmChatGoogleGemini
gmail
+6
Workflow Identifier: 1218
NODES in Use: manualTrigger, set, lmChatGoogleGemini, informationExtractor, gmail, stickyNote, hubspot, splitInBatches, noOp
Automate sales emails with n8n and Google Gemini

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What This Workflow Does

This workflow pulls contacts who are decision-makers from HubSpot CRM.
It fetches recent email conversations from Gmail for each contact.
Then it uses Google Gemini AI to learn about each contact’s communication style and pain points.
Finally, it creates a personalized sales email draft in Gmail tailored to each contact.
The goal is to save time and write better emails that match the contact’s personality.


Who Should Use This Workflow

Salespeople who send many outreach emails can use this.
It helps those wanting personal emails without spending hours researching.

The user needs an account on HubSpot, Gmail, and Google Cloud with API access.
Also, some basic knowledge of n8n workflow automation helps.


Tools and Services Used


Beginner Step-by-Step: How to Use This Workflow in Production

Download and Import

  1. Download the workflow file from the Download button on this page.
  2. Open the n8n editor where you want to run the automation.
  3. Use the “Import from File” option to upload the downloaded workflow.

Configure Credentials and Settings

  1. Add or update the HubSpot API Key in the Get Contacts node.
  2. Update Gmail OAuth2 credentials in both the Get All Customer’s Correspondence and Create Draft Email For Review nodes.
  3. Make sure Google Gemini API Key is set in the Google Gemini Chat Model nodes.
  4. Review any filters like email addresses, HubSpot list IDs, or limits to match your data.

Test and Activate

  1. Run the workflow manually by pressing “Execute Workflow” on the trigger node.
  2. Observe output at each step to confirm it finds contacts, fetches emails, and generates drafts.
  3. When satisfied, activate the workflow to run on a schedule or trigger as needed.

Using self-host n8n is possible for better control over your automation.


Workflow Input → Processing → Output

Inputs

Processing Steps

  • The workflow loops through each contact one-by-one.
  • For each contact, it gets recent emails for context.
  • Google Gemini AI analyzes emails to build a persona profile like communication style and motivations.
  • A second AI call creates a tailored sales email draft using the persona and sales product info.
  • The draft email is created in Gmail for review and sending.

Output

  • One custom draft email per contact saved inside Gmail.
  • The draft uses the right tone and highlights product benefits matching the contact’s style.

Edge Cases or Failures and How to Fix

  • Authentication Errors: Occur if Gmail or HubSpot API keys expire or are invalid.
    Fix by re-adding OAuth credentials in n8n.
  • No Contacts Found: Happens if HubSpot filters are misconfigured or no contacts match.
    Check filter settings and HubSpot list contents.
  • No Emails Retrieved: Can be caused by wrong email filters or missing Gmail permissions.
    Test queries directly in Gmail to confirm syntax.
  • Incomplete AI Persona Data: May result from API rate limits or prompt issues.
    Review Google Cloud quota and prompts used with Gemini API.

Customization Ideas

  • Change product details in the variables node to reflect current offerings.
  • Adjust the number of emails fetched per contact in the Gmail node.
  • Modify the email creation node to send directly without review by switching from draft creation to sending.
  • Edit persona attributes extracted by AI to better fit your sales approach.
  • Replace HubSpot contact node with other CRM connectors supported by n8n.

Summary of Benefits

✓ Saves many hours by automating email personalization.
✓ Creates emails that reflect how each person prefers to communicate.
✓ Lets sales reps review emails before sending.
✓ Works in batch mode for many contacts.


Example AI Prompt Used in Google Gemini Chat Model Node

This prompt asks AI to understand persona from email texts:

Analyze these email conversations between the sales rep and the client.
Extract client personality traits such as communication style, decision-making behavior, pain points, and motivations.
Deliver the result as JSON with fields: communication_preferences, decision_making_style, pain_points, professional_goals_motivations.

Use the output to guide the sales email generation.


Example Prompt for Generating Sales Email

This AI prompt tells Gemini to draft the email:

Act as a sales rep writing a closing email.
Use this customer persona to match tone and content.
Include product benefits related to the customer pain points.
Format the email in HTML.

This ensures emails feel personal and professional.


Automate sales emails with n8n and Google Gemini

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

Yes, the workflow supports other CRMs like Salesforce or Pipedrive by changing the contact retrieval node and mapping fields.
API usage depends on contact volume and prompt size, so monitor usage and optimize prompts to control costs.
Common causes are incorrect Gmail filter syntax or the contact not having matching emails in the inbox.
Data stays within secure authenticated connections, but users should handle sensitive data carefully when sending to third-party AI APIs.
Author
Written By
Ritu Sanjali

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.