Automate Lead Responses with Lemlist, HubSpot & n8n Workflow

This n8n workflow automates email reply categorization from Lemlist leads, updating HubSpot CRM and notifying teams via Slack. It solves the time-consuming manual follow-up of leads and categorizes responses for faster sales actions.
lemlistTrigger
openAi
merge
+5
Learn how to Build this Workflow with AI:
Workflow Identifier: 1454
NODES in Use: lemlistTrigger, openAi, merge, switch, lemlist, httpRequest, hubspot, slack

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

Visit through Desktop for Best experience

1. Opening Problem Statement

Meet Lucas, a busy sales manager who handles hundreds of email leads coming through Lemlist campaigns every day. Manually sifting through each replied email to determine the lead’s interest, updating their HubSpot CRM records, and informing his sales team wastes hours daily. Often, leads who express interest fall through the cracks, or out-of-office replies delay timely follow-ups. This confusion leads to lost deals, missed opportunities, and a stressed-out sales team struggling to keep up.

Lucas estimates spending at least 3 hours per day processing these replies manually, causing delays and errors that cost potential revenue. He knows there has to be a better way to automate this tedious process while maintaining personalized follow-ups and accurate CRM updates.

2. What This Automation Does

When this n8n workflow runs, it intelligently categorizes incoming email replies from Lemlist leads using OpenAI, then takes the correct next steps in HubSpot CRM and notifies the sales team on Slack accordingly. Specifically, it:

  • Catches Lemlist email replies through a webhook trigger.
  • Uses OpenAI to classify responses into categories like “Interested,” “Out of Office,” “Unsubscribe,” or “Other.”
  • Unsubscribes leads in Lemlist automatically if they choose to opt-out.
  • Marks leads as “Interested” in Lemlist and creates a new deal in HubSpot CRM.
  • Adds follow-up tasks within HubSpot for out-of-office replies.
  • Sends customized Slack notifications about the lead’s status to the sales team.

This automation saves Lucas hours every day, eliminates manual entry errors, prioritizes the hottest leads instantly, and ensures no opportunity slips through the cracks.

3. Prerequisites ⚙️

  • n8n account with access to create workflows 🔌
  • Lemlist account with API access and an active campaign 🔑
  • HubSpot account with OAuth2 API credentials 🔑
  • Slack workspace with OAuth2 API credentials 🔑
  • OpenAI API key to categorize email texts 🔑

4. Step-by-Step Guide

Step 1: Set Up the Lemlist Lead Replied Trigger

Navigate to your n8n editor, click + New Workflow. Add the node Lemlist Trigger (type: n8n-nodes-base.lemlistTrigger), select event emailsReplied and set isFirst to true. This triggers the workflow whenever a lead replies to your campaign email.

You should see n8n displaying Webhook URL generated—note this URL to configure in your Lemlist campaign settings.

Common mistake: Forgetting to add this webhook URL in Lemlist leads to no data triggering the workflow.

Step 2: Add OpenAI Node to Categorize Replies

Add an OpenAI node (n8n-nodes-base.openAi) connected from Lemlist Trigger. Use the following prompt template:

=The following is a list of emails and the categories they fall into:
Categories=["interested", "Out of office", "unsubscribe", "other"]

Interested is when the reply is positive.

{{$json["text"].replaceAll(/^s+|s+$/g, '').replace(/(rn|n|r)/gm, "")}}
Category:

This instructs OpenAI to read the email reply content and classify it. Choose temperature 0 and max tokens 6 for precise results.

Expected result: Outputs category as a string, e.g., “Interested” or “Out of office.”

Common mistake: Using overly broad prompts can confuse classification.

Step 3: Merge Data for Processing

Add a Merge node (n8n-nodes-base.merge) which combines the original data from the trigger with the OpenAI classification output. Configure it to combine by position and prefer input 1 in case of conflicts.

Outcome: Single data-set including the email reply and its categorized label.

Step 4: Add Switch Node for Conditional Logic Based on Reply

Insert a Switch node (n8n-nodes-base.switch). Configure rules as follows on property text (trimmed string):

  • If value is “Unsubscribe,” output to branch 0.
  • If value is “Interested,” output to branch 1.
  • If value is “Out of Office,” output to branch 2.
  • Else fallback to branch 3.

This splits execution path according to the lead’s reply category.

Step 5: Handle Unsubscribe Leads in Lemlist

On branch 0 from the Switch, connect to Lemlist – Unsubscribe node (n8n-nodes-base.lemlist), configured for unsubscribe operation on lead email and campaign ID from JSON data.

Outcome: The lead is unsubscribed from your campaign immediately upon reply.

Common mistake: Not passing correct campaign ID leads to unsubscribe failure.

Step 6: Handle Interested Leads to Mark and Create Deal

From branch 1, connect to two nodes in parallel:

  • Lemlist Mark as Interested – An HTTP Request node (n8n-nodes-base.httpRequest) calling Lemlist’s API to mark the lead email as interested in the campaign.
  • HubSpot – Get contact ID – Retrieve contact details by lead email.

Then, connect HubSpot Get contact ID node to HubSpot – Create Deal node (n8n-nodes-base.hubspot) which creates a new deal associated with that contact. Lastly, connect the created deal to a Slack notification node (n8n-nodes-base.slack) informing your team with a link to the deal.

Expected outcome: Hot leads are marked, deals created instantly, and teams notified.

Common mistake: Forgetting to authenticate HubSpot OAuth2 properly causes failures.

Step 7: Handle Out of Office Leads with Follow-up Tasks

From branch 2, connect to HubSpot – Get contact ID1 node (same HubSpot contact retrieval), which then triggers follow up task node (n8n-nodes-base.hubspot) to create a task in HubSpot engagement to remind you to follow up once available.

Outcome: Out of office messages automatically schedule a follow-up task—no lead falls off your radar.

Step 8: Send Generic Slack Notifications for Other Replies

The fallback branch 3 leads to Slack1 node (n8n-nodes-base.slack), which sends a Slack message about other types of replies, with links to Lemlist campaign reports.

5. Customizations ✏️

  • Change Campaign or Team: In Lemlist – Unsubscribe or HTTP Request nodes, update campaignId or teamId to target different campaigns.
  • Adjust AI Categories: Modify the OpenAI prompt to add more categories or refine classification.
  • Add More Slack Channels: Duplicate Slack nodes and configure for different sales teams or notification priorities.
  • Customize HubSpot Engagements: Change the task details or deal stages in HubSpot nodes to match your sales pipeline.
  • Extend with CRM Updates: Add other HubSpot nodes to update contact properties based on replies.

6. Troubleshooting 🔧

  • Problem: “Workflow not triggered by Lemlist replies”
    Cause: Webhook URL not set in Lemlist campaign settings.
    Solution: Copy webhook URL from Lemlist Trigger node and paste it in Lemlist’s webhook settings precisely.
  • Problem: “OpenAI classification returns wrong categories”
    Cause: Prompt wording too ambiguous.
    Solution: Simplify the prompt and add clear examples as in the provided workflow.
  • Problem: “HubSpot nodes fail authentication”
    Cause: OAuth2 credentials expired or insufficient scopes.
    Solution: Reauthorize OAuth2 or check permission scopes in HubSpot developer portal.
  • Problem: “Lead unsubscribe fails”
    Cause: Incorrect campaign ID passed.
    Solution: Verify campaign ID in Lemlist unsubscribe node configuration.

7. Pre-Production Checklist ✅

  • Verify Lemlist webhook is active and receiving reply events.
  • Test OpenAI node with sample email replies to confirm accurate categorization.
  • Ensure HubSpot OAuth2 credentials are valid and have necessary permissions.
  • Verify Slack notification posts successfully in desired channel.
  • Test unsubscribe functionality with a test lead in Lemlist campaign.
  • Conduct end-to-end test from lead reply to Slack notification confirming deal creation or task scheduling.

8. Deployment Guide

Once tested, activate your workflow in n8n by toggling the active switch in the top right. Monitor the first few lead replies through the Executions tab to ensure smooth operations.

Enable error notifications in n8n to catch any failures early, and review logs regularly. This workflow scales well for medium sales teams and can be extended or adapted to other CRMs or messaging platforms.

9. FAQs

  • Can I use Pipedrive or Salesforce instead of HubSpot? Yes, but you will need to replace HubSpot nodes with respective CRM API nodes and adapt authentication.
  • Does this consume a lot of OpenAI credits? Each email classification uses minimal tokens—cost is low, but monitor your API usage.
  • Is my data safe while using hubspot and Lemlist APIs? Yes, OAuth2 authentication and standard API security practices apply.
  • Can this handle thousands of leads daily? n8n workflows can scale with proper resource allocation and webhook throughput.

10. Conclusion

By following this guide, you have automated your entire lead reply handling pipeline — from catching Lemlist replies, using AI to categorize them, updating HubSpot CRM, and notifying your sales team on Slack.

This saves several hours daily, reduces human error, and ensures every lead gets a timely, appropriate response. You can now focus your energy on closing deals rather than managing data.

Next, consider adding automated follow-ups for “Interested” leads, integration with Google Sheets for reporting, or enriching leads with data from LinkedIn.

You’ve just boosted your sales productivity dramatically. Great job! 🎉

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation in n8n (Beginner Guide)

A complete beginner guide to building an AI-powered SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free