Shopify Lead Email Processor for HubSpot CRM - n8n Workflow

Automate Shopify lead processing using this advanced n8n workflow. It monitors Gmail, extracts lead data via regex parsing, and automatically creates or updates HubSpot Contacts and Deals.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

E-commerce businesses running Shopify.
Sales teams needing immediate, structured lead data in HubSpot.
Marketing operations professionals looking for highly efficient n8n templates.
Users of the n8n platform seeking advanced email parsing solutions.

Overview

Manually transcribing lead information from incoming emails into a CRM is time-consuming and prone to error. This sophisticated n8n workflow solves that problem by providing a hands-off automation solution. It utilizes a powerful n8n node setup, including custom JavaScript code, to reliably extract structured data (name, email, phone, product interest) from unstructured email bodies, specifically tailored for Shopify lead notifications.

By leveraging this specific n8n workflow, organizations ensure that every potential lead captured via Shopify is instantly synchronized with HubSpot, accelerating follow-up times and improving data integrity. This process ensures your sales pipeline is always current without manual intervention, making this one of the most valuable n8n templates for sales and e-commerce.

How it Works

This automation follows a precise, multi-step flow starting with a dedicated n8n trigger:


  1. Trigger Event: The n8n workflow begins with the Gmail Trigger n8n node, which polls your Gmail account every minute for new messages.

  2. Retrieve Full Message: The core Gmail n8n node then fetches the complete content and metadata of the detected email.

  3. Sender Extraction: A Function n8n node extracts the sender's email address, preparing the data for the next filtering step.

  4. Filtering: An If n8n node acts as a crucial filter, ensuring that only emails originating from the specified Shopify address ([email protected]) proceed down the main path. This saves processing resources.

  5. Data Parsing (Code n8n node): If the email is from Shopify, a custom Code n8n node executes complex JavaScript with regular expressions (regex). This code meticulously scans the raw email text to extract specific fields: name, email, city, phone, body, product title, and product URL.

  6. Data Normalization: A Set n8n node (named 'Edit Fields') cleans and structures the parsed data, mapping the extracted values into predictable fields for HubSpot integration.

  7. HubSpot Contact Action: The first HubSpot n8n node uses the extracted email address to create a new contact or update an existing one, setting properties like Name, City, and Phone.

  8. HubSpot Deal Creation: Finally, a second HubSpot n8n node creates a new Deal in the specified pipeline stage (YOURSTAGEID), linking it automatically to the contact created in the previous step. The deal description includes details parsed from the original email body and product title, ensuring a complete record for the sales team. This completes the essential actions of this powerful n8n workflow.

Installation Guide

To deploy this useful n8n workflow, follow these steps:


  1. Import: Download the provided JSON file and import it directly into your n8n instance.

  2. Credentials Setup:

Gmail Trigger and Gmail Node: Set up or select your Gmail account credentials. Ensure the account has permission to read the relevant mailbox.
HubSpot Nodes: Provide an App Token for your HubSpot connection. This is required for both the 'Create or update a contact' and 'Create a deal' n8n node actions.

  1. Customization:

Filtering: If your leads come from a different system, update the 'If Sender is Shopify' n8n node condition to match your source email address.
Parsing: Review the JavaScript in the 'Code' n8n node. If your email layout from Shopify (or another source) differs, you must adjust the regular expressions to accurately capture the lead fields.
* HubSpot Deal: Update the stage parameter in the 'Create a deal' n8n node to match a valid ID in your HubSpot Deal Pipeline. You must also verify the custom property mapping.

Node Details

Gmail Trigger n8n node (Poll): Starts the n8n workflow when a new email is detected, acting as the primary n8n trigger.
Gmail n8n node (Get a message): Fetches the full raw content of the email based on the ID provided by the n8n trigger.
Function n8n node (Extract From Email): Extracts the sender's email address using simple JavaScript for filtering.
If n8n node (If Sender is Shopify): Directs the flow only if the email matches the specific Shopify sender address.
Code n8n node (Parser): The most complex n8n node in the flow. It uses advanced Regex patterns (e.g., Name:\s(.?)\sEmail:) to scrape specific data points (Name, Email, Phone, Product Title) from the email body.
Set n8n node (Edit Fields): Normalizes and maps the parsed data into clean, defined variables before sending it to the CRM.
HubSpot n8n node (Create or update a contact): Utilizes the extracted lead email to find or create a contact, associating all relevant demographic data.


  • HubSpot n8n node (Create a deal): Creates a new Deal, linking it to the Contact ID (vid) output from the previous HubSpot n8n node, and populating the deal description using the parsed product information.

Related n8n Workflows

Free

Nodes: 8 Nodes
Updated: December 26 2025
View all
Created by

Automation & Digital Transformation Consultant with 7+ years of experience helping businesses streamline workflows, integrate APIs, and unlock efficiency through n8n. I specialize in building custom automations for Sales, Marketing, HR, Finance, and Supply Chain—saving teams countless hours and driving measurable results. Explore my templates to supercharge your processes or reach out for tailored automation solutions.

Featured*