AI-Driven Lead Management and Inquiry Automation with ERPNext & n8n

Filter the Lead I have done only for theose which are open and where the source is Website. You can remove this if you want to have all leads.

Workflow Structure (16 nodes)
100%
Webhook
Webhook
If
Source Website and Status Open
Set
Lead Body
Http Request
Get Lead Data from ERPNext
If
Inquiry has Notes
Langchain.lm Chat Open Ai
OpenAI Chat Model
Langchain.agent
Customer Lead AI Agent
Google Sheets Tool
Abbriviations
Google Docs Tool
Company Profile
Google Docs Tool
Company Policies
Google Sheets Tool
Company Contact Database
If
Inquiry is Valid?
Code
Fields for Outlook
Set
Email Body Text Generated by AI
Code
Email Body for Outlook
Microsoft Outlook
Microsoft Outlook
Node Types:
default
action
transform
logic
code
http
trigger
Requires credentials

Prerequisites

Required Credentials (5)

Erp Next

Used by: Get Lead Data from ERPNext

Docs

Google Docs

Used by: Company Profile, Company Policies

Docs

Google Sheets

Used by: Abbriviations, Company Contact Database

Docs

Microsoft Outlook

Used by: Microsoft Outlook

Docs

OpenAI

Used by: OpenAI Chat Model

Docs

Multiple services required

This workflow needs 5 different credentials. Make sure you have accounts for all services before importing.

Complexity

Advanced

Expert level. Custom code, complex logic, many integrations.

Setup time: ~1 hour
Score: 90/100
Custom Code
Conditional Logic
5 Integrations

When to Use This Workflow

AI-Powered Content Creation

Automate content generation, summarization, or analysis using AI capabilities.

Save hours of manual work while maintaining quality and consistency.

Automated Reporting

Automatically collect and organize data into spreadsheets for analysis.

Spend less time on data entry and more time on insights.

Real-time Response

React instantly when events happen - new orders, form submissions, or API calls.

Zero delay between trigger and action for time-sensitive workflows.

workflow.json
{
  "meta": {
    "instanceId": "e4f78845dfed9ddcfba1945ae00d12e9a7d76eab052afd19299228ce02349d86"
  },
  "nodes": [
    {
      "id": "23291d25-3e1a-4b0d-9b1d-d066e8c04a1f",
      "name": "Customer Lead AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -640,
        460
      ],
      "parameters": {
        "text": "=**System Prompt:**\n\nYou are an AI assistant designed to process new leads and generate appropriate responses. Your role includes analyzing lead notes, categorizing them, and generating an email from the system to inform the relevant contact about the inquiry. Do not send the email as if it is directly from the customer; instead, draft it as a notification from the system summarizing the inquiry.\n\n### **Process Flow**\n\n1. **Analyzing Lead Notes:**\n - Extract key details such as the customer name, organization, contact information, and their specific request. \n - Determine if the inquiry relates to products, services, or solutions offered by the company.\n\n2. **Finding the Appropriate Contact(s):**\n - Search the contact database to find the responsible person(s) for the relevant product, service, or solution. \n - If one person is responsible, provide their email. \n - If multiple people are responsible, list all emails separated by commas.\n\n3. **Generating an Email Notification:**\n - Draft a professional email as a notification from the system.\n - Summarize the customer’s inquiry.\n - Include all relevant details to assist the recipient in addressing the inquiry.\n\n4. **Handling Invalid Leads:**\n - If the inquiry is unrelated to products, services, or solutions (e.g., job inquiries or general product inquiries), classify it as invalid and return: \n `\"Invalid Lead - Not related to products, services, or solutions.\"`\n\n### **Output Requirements**\n\n1. **For Relevant Leads:**\n - **Email Address(es):** Provide the appropriate email(s). \n - **Email Message Body:** Generate an email notification from the system summarizing the inquiry.\n\n2. **For Invalid Leads:**\n - Return: `\"Invalid Lead - Not related to products, services, or solutions.\"`\n\n\n### **Email Template for Relevant Leads**\n\n**Email Address(es):** [Relevant Email IDs]\n\n**Email Message Body:**\n\n_Subject: New Inquiry from Customer Regarding [Product/Service/Solution]_ \n\nDear [Recipient(s)], \n\nWe have received a new inquiry from a customer through our system. Below are the details: \n\n**Customer Name:** [Customer Name] \n**Organization:** [Organization Name] \n**Contact Information:** [Contact Details] \n\n**Inquiry Summary:** \n[Summarized description of the customer's request, e.g., “The customer is seeking to upgrade their restroom facilities with touchless soap dispensers and tissue holders installed behind mirrors. They have requested a site visit to assess the location and provide a proposal.”] \n\n**Action Required:** \nPlease prioritize this inquiry and reach out to the customer promptly to address their requirements. \n\nThank you, \n[Your System Name] \n\n\n### **Example Output**\n\n**Input Lead Notes:**\n*\"Dear Syncbricks, We are looking to Develop Workflow Automation Soluition for our company, can you let us know the details what do you offer in tems of this.\"*\n\n**Output:**\n\n- **Email Address(es):** employee@syncbricks.com\n\n- **Email Message Body:** \n\n_Subject: Workflow Automation Platform Integration_ \n\nDear -Emploiyee Name (s) --, \n\nWe have received a new inquiry from a customer through our system. Below are the details: \n\n**Customer Name:** Amjid Ali \n**Organization:** Syncbricks LLC\n**Contact Information:** 123456789 \n\n**Inquiry Summary:** \nThe customer is asking for workflow automation for their company \n\n**Action Required:** \nPlease prioritize this inquiry and reach out to the customer promptly to address their requirements. \n\nThank you, \nSyncbricks LLC\n\n---\nHere are the Lead Details\nLead Name : {{ $json.data.lead_name }}\nCompany : {{ $json.data.company_name }}\nSource : {{ $json.data.source }}\nNotes : {{ $json.data.notes }}\nCity : {{ $json.data.city }}\nCountry : {{ $json.data.country }}\nMobile : {{ $json.data.mobile_no }}",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
...

Workflow Details

Nodes
27
Trigger
Webhook
Source
awesome
Added
Dec 4, 2025

Need Help?

Check out the official n8n documentation for detailed guides.

Related Workflows

🔍🛠️Perplexity Researcher to HTML Web Page

Create Article from Perplexity Research

Lmchatopenai
Outputparserstructured
Webhook
Telegram
47 nodesWebhook
Curated

AI Agent to chat with you Search Console Data, using OpenAI and Postgres

Webhook - ChatInput This webhook serves as the endpoint for receiving ChatInput data. Ensure that you include: - chatInp...

Memorypostgreschat
Lmchatopenai
Webhook
Toolworkflow
30 nodesWebhook
Curated

Voice RAG Chatbot with ElevenLabs and OpenAI

STEP 4 RAG System Click on "test workflow" on n8n and "Test AI agent" on ElevenLabs. If everything is configured correc...

Agent
Toolvectorstore
Vectorstoreqdrant
Embeddingsopenai
23 nodesWebhook
Curated

AI-Powered Candidate Shortlisting Automation for ERPNext

Get Apprropraite Data These Nodes are to extract only the Required Data from the Webhook Node

Erpnext
Lmchatgooglegemini
Http-request
Webhook
39 nodesWebhook
Curated

Create a Branded AI-Powered Website Chatbot

Ensure these referance this workflow, replace placeholders

Memorybufferwindow
Lmchatopenai
Toolhttprequest
Executeworkflow
24 nodesWebhook
Curated

AI-powered WooCommerce Support-Agent

Find WooCommerce User-ID User-ID is required to query past orders

Memorybufferwindow
Executeworkflow
Woocommerce
Http-request
40 nodesEvent
Curated