n8n

How to Automate Email to HubSpot Lead Capture?

Turn inbound emails into clean CRM records. Sales teams get contacts created and each message logged as an engagement in the CRM, without typing. Great for handling contact requests and demo emails.

An email inbox watched by IMAP receives a new message. An AI model reads the email and pulls key details like name, email, phone, company, and location into a structured JSON. The flow checks HubSpot for a matching contact by email. If found, it maps the HubSpot contact id and records the email as an engagement. If not found, it creates the contact first, then adds the engagement with the original subject and body. The setup uses an OpenAI chat model with a defined output schema to keep fields consistent.

You will need access to an IMAP email inbox, a HubSpot account with OAuth, and an OpenAI API key. Expect faster lead intake, fewer typos, and complete timelines in HubSpot. Good fits include inbound sales requests, replies to outreach, and leads sent by third party forms that forward email. After connecting credentials, test by sending a sample email and check that the contact and engagement appear in HubSpot.

What are the key features?

  • IMAP email listener captures new messages as they arrive
  • OpenAI chat model extracts names, emails, phones, and company details
  • Structured output parser enforces a consistent JSON schema
  • HubSpot contact search prevents duplicates using email matching
  • Conditional path creates a new contact if none is found
  • Email engagement is created with the original subject and body
  • Field mapping step passes the HubSpot contact id to link the engagement
  • Works with HTML or plain text emails using a safe fallback

What are the benefits?

  • Reduce manual data entry from 20 minutes to 2 minutes per lead
  • Automate up to 90% of CRM logging for inbound emails
  • Improve contact data accuracy by 40% with structured AI parsing
  • Handle 5 times more lead emails without adding headcount
  • Connect email and HubSpot so every message is tracked in one place

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with HubSpot, OpenAI and IMAP Email. See the Tools Required section above for links to create accounts with these services.
  3. Open the IMAP Email node named When an email is received. In the credentials dropdown, click Create new credential and follow the on screen instructions. Provide server, port, encryption, username, and app password if required. Choose the inbox folder you want to watch.
  4. Double click the OpenAI Chat Model node. In the credentials dropdown, click Create new credential, paste your OpenAI API key from the OpenAI account API page, and save. Keep the model as gpt 4o mini or select another model you prefer.
  5. Review the Parse the mail with AI node. Keep the system message and prompt, or adjust the prompt to match your lead fields. Make sure the email content variables include both HTML and plain text.
  6. Open the Set the output Json node. Confirm the example schema includes contact fields you want like first name, last name, email, phone, company, and location. Adjust field names to match your CRM naming style if needed.
  7. Open each HubSpot node. In the credentials dropdown, click Create new credential and complete HubSpot OAuth. Grant CRM scopes so contact search, create, and engagement create all work.
  8. In the Search for the contact via email node, confirm the filter uses the AI parsed email field. Keep the email property name set to email.
  9. Check the contact exists decision node. The true path should set the contact id field and then create the engagement. The false path should create the contact first, then create the engagement.
  10. Open the Creates an email engagement node. Confirm the subject and body map from the email trigger. Verify the associations field uses the HubSpot contact id so the engagement links to the right record.
  11. Run a test: send a sample lead email to the watched inbox. In n8n, execute once or activate the workflow. Confirm that a contact appears in HubSpot and that the email is logged as an engagement. If fields are empty, refine the AI prompt or update the output schema.
  12. Troubleshoot common issues: if IMAP does not connect, check server, port, and app password. If HubSpot fails, reauthorize OAuth scopes. If the AI output is missing fields, add examples to the schema and reduce ambiguous wording in the prompt.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

HubSpot

Sign up

Free: $0 / mo; API access included (private app or OAuth). Limits on Free: 250,000 API calls/day and 100 requests per 10 seconds per private app.

IMAP Email

Sign up

OpenAI

Sign up

Pay-as-you-go: GPT-5 at $1.25 per 1M input tokens and $10 per 1M output tokens

Credits:
Thomas at thomas@pollup.net

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.