HTTP Request node
Webhook node
+5

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

Published 2 days ago

Created by

amjid
Amjid Ali

Categories

Template description

Overview

This workflow template automates lead management and customer inquiry processing by integrating ERPNext, AI agents, and email notifications. It streamlines the process of capturing leads, analyzing inquiries, and generating actionable responses. The workflow uses ERPNext to capture inquiries, analyzes them with AI, and notifies the appropriate team or individual, all while maintaining a professional approach.


What This Template Does

  1. ERPNext Webhook Integration:

    • Captures leads and inquiries through ERPNext webhooks.
    • Triggers the workflow when a new lead is created.
  2. AI-Powered Inquiry Analysis:

    • Uses AI to extract key details from lead notes (e.g., customer name, organization, inquiry summary).
    • Classifies inquiries as valid or invalid based on relevance to products, services, or solutions.
  3. Contact Assignment:

    • Matches inquiries to the appropriate contact(s) using a Google Sheets database or ERPNext contact information.
    • Handles multiple contacts if required.
  4. Email Notifications:

    • Generates professional email notifications for valid inquiries.
    • Sends emails to the appropriate contact(s) with inquiry details and action steps.
  5. Invalid Lead Handling:

    • Identifies invalid inquiries (e.g., unrelated to products or services) and flags them for follow-up or dismissal.
  6. Custom Email Formatting:

    • Converts plain text into professionally formatted HTML emails.
    • Ensures that communication is clear, concise, and visually appealing.

How It Works

Step 1: Capture Lead Data

  • Webhook in ERPNext:

    • Create a webhook in ERPNext for the "Lead" DocType.
    • Set the trigger to on_insert to capture new leads in real-time.
  • Lead Details:

    • The workflow fetches lead details, including notes, contact information, and the source of the lead.

Step 2: Validate and Analyze Inquiry

  • AI Agent for Analysis:

    • An AI agent analyzes the lead notes to extract key details and classify the inquiry as valid or invalid.
    • The analysis includes checking the relevance of the inquiry to products, services, or solutions offered by the company.
  • Invalid Leads:

    • If the inquiry is invalid, the workflow flags it and stops further processing.

Step 3: Assign Contact(s)

  • Google Sheets Integration:

    • Uses a Google Sheets database to map products, services, or solutions to responsible contacts.
    • Ensures that inquiries are directed to the right person or team.
  • Multiple Contacts:

    • Handles cases where multiple contacts are responsible for a particular product or service.

Step 4: Generate and Send Email Notifications

  • AI-Generated Emails:

    • The workflow generates a professional email summarizing the inquiry.
    • Emails include details like customer name, organization, inquiry summary, and action steps.
  • Custom HTML Formatting:

    • Emails are converted to HTML for a polished and professional appearance.
  • Send Notifications:

    • Sends email notifications through Microsoft Outlook or another configured email client.
    • Optionally, notifies via WhatsApp or SMS for urgent inquiries.

Step 5: Post-Inquiry Actions

  • ERPNext Record Updates:
    • Updates the lead record in ERPNext with relevant details, including inquiry status and contact information.

Setup Instructions

Prerequisites

  1. ERPNext:
    • A configured ERPNext instance with lead data and a webhook for the "Lead" DocType.
  2. Google Sheets:
    • A sheet mapping products, services, or solutions to responsible contacts.
  3. AI Integration:
    • Credentials for OpenAI or other supported AI platforms.
  4. Email Client:
    • Credentials for Microsoft Outlook or another email client.

Step-by-Step Setup

  1. ERPNext Configuration:

    • Create a webhook for the "Lead" DocType in ERPNext.
    • Test the webhook with sample data to ensure proper integration.
  2. Workflow Import:

    • Import the workflow template into n8n.
    • Configure nodes with your API credentials for ERPNext, Google Sheets, and AI tools.
  3. Google Sheets Integration:

    • Prepare a Google Sheet with columns for product, service, or solution and the responsible contact(s).
    • Link the sheet to the workflow.
  4. AI Agent Configuration:

    • Customize the AI agent’s prompts to align with your business’s products and services.
    • Adjust criteria for valid and invalid inquiries as needed.
  5. Email Setup:

    • Configure the email client node with your email service credentials.
    • Customize the email template for your organization.
  6. Testing:

    • Run the workflow with sample leads to validate the entire process.
    • Check email notifications, contact assignments, and record updates in ERPNext.

Dos and Don’ts

Dos:

  • Test Thoroughly: Test the workflow with various scenarios before deploying in production.
  • Secure Credentials: Keep API and email credentials secure to avoid unauthorized access.
  • Customize Prompts: Tailor AI prompts to match your business needs and language style.
  • Use Professional Email Templates: Ensure emails are clear and well-formatted.

Don’ts:

  • Skip Validation: Always validate inquiry data to avoid sending irrelevant notifications.
  • Overload the Workflow: Avoid adding unnecessary nodes that can slow down processing.
  • Ignore Errors: Monitor logs and address errors promptly for a smooth workflow.

Resources

Share Template

More Finance workflow templates

HTTP Request node
Google Drive node
Google Calendar node
+9

Actioning Your Meeting Next Steps using Transcripts and AI

This n8n workflow demonstrates how you can summarise and automate post-meeting actions from video transcripts fed into an AI Agent. Save time between meetings by allowing AI handle the chores of organising follow-up meetings and invites. How it works This workflow scans for the calendar for client or team meetings which were held online. * Attempts will be made to fetch any recorded transcripts which are then sent to the AI agent. The AI agent summarises and identifies if any follow-on meetings are required. If found, the Agent will use its Calendar Tool to to create the event for the time, date and place for the next meeting as well as add known attendees. Requirements Google Calendar and the ability to fetch Meeting Transcripts (There is a special OAuth permission for this action!) OpenAI account for access to the LLM. Customising the workflow This example only books follow-on meetings but could be extended to generate reports or send emails.
jimleuk
Jimleuk
Google Sheets node
HTTP Request node
Merge node
+10

Invoice data extraction with LlamaParse and OpenAI

This n8n workflow automates the process of parsing and extracting data from PDF invoices. With this workflow, accounts and finance people can realise huge time and cost savings in their busy schedules. Read the Blog: https://blog.n8n.io/how-to-extract-data-from-pdf-to-excel-spreadsheet-advance-parsing-with-n8n-io-and-llamaparse/ How it works This workflow will watch an email inbox for incoming invoices from suppliers It will download the attached PDFs and processing them through a third party service called LlamaParse. LlamaParse is specifically designed to handle and convert complex PDF data structures such as tables to markdown. Markdown is easily to process for LLM models and so the data extraction by our AI agent is more accurate and reliable. The workflow exports the extracted data from the AI agent to Google Sheets once the job complete. Requirements The criteria of the email trigger must be configured to capture emails with attachments. The gmail label "invoice synced" must be created before using this workflow. A LlamaIndex.ai account to use the LlamaParse service. An OpenAI account to use GPT for AI work. Google Sheets to save the output of the data extraction process although this can be replaced for whatever your needs. Customizing this workflow This workflow uses Gmail and Google Sheets but these can easily be swapped out for equivalent services such as Outlook and Excel. Not using Excel? Simple redirect the output of the AI agent to your accounting software of choice.
jimleuk
Jimleuk
HTTP Request node
+11

Build a Financial Documents Assistant using Qdrant and Mistral.ai

This n8n workflow demonstrates how to manage your Qdrant vector store when there is a need to keep it in sync with local files. It covers creating, updating and deleting vector store records ensuring our chatbot assistant is never outdated or misleading. Disclaimer This workflow depends on local files accessed through the local filesystem and so will only work on a self-hosted version of n8n at this time. It is possible to amend this workflow to work on n8n cloud by replacing the local file trigger and read file nodes. How it works A local directory where bank statements are downloaded to is monitored via a local file trigger. The trigger watches for the file create, file changed and file deleted events. When a file is created, its contents are uploaded to the vector store. When a file is updated, its previous records are replaced. When the file is deleted, the corresponding records are also removed from the vector store. A simple Question and Answer Chatbot is setup to answer any questions about the bank statements in the system. Requirements A self-hosted version of n8n. Some of the nodes used in this workflow only work with the local filesystem. Qdrant instance to store the records. Customising the workflow This workflow can also work with remote data. Try integrating accounting or CRM software to build a managed system for payroll, invoices and more. Want to go fully local? A version of this workflow is available which uses Ollama instead. You can download this template here: https://drive.google.com/file/d/189F1fNOiw6naNSlSwnyLVEm_Ho_IFfdM/view?usp=sharing
jimleuk
Jimleuk
Google Sheets node
Mindee node

Extract expenses from emails and add to Google Sheets

This workflow will check a mailbox for new emails and if the Subject contains Expenses or Reciept it will send the attachment to Mindee for processing then it will update a Google sheet with the values. To use this node you will need to set the Email Read node to use your mailboxes credentials and configure the Mindee and Google Sheets nodes to use your credentials.
jon-n8n
Jonathan
Webhook node
Respond to Webhook node
OpenAI node

Analyze tradingview.com charts with Chrome extension, N8N and OpenAI

This flow is supported by a Chrome plugin created with Cursor AI. The idea was to create a Chrome plugin and a backend service in N8N to do chart analytics with OpenAI. It's a good sample on how to submit a screenshot from the browser to N8N. Who is it for? N8N developers who want to learn about using a Chrome plugin, an N8N webhook and OpenAI. What opportunity does it present? This sample opens up a whole range of N8N connected Chrome extensions that can analyze screenshots by using OpenAI. What this workflow does? The workflow contains: a webhook trigger an OpenAI node with GPT-4O-MINI and Analyze Image selected a response node to send back the Text that was created after analysing the screenshot. All this is needed to talk to the Chrome extension which is created with Cursor AI. The idea is to visit the tradingview.com crypto charts, click the Chrome plugin and get back analytics about the shown chart in understandable language. This is driven by the N8N flow. With the new image analytics capabilities of OpenAI this opens up a world of opportunities. Requirements/setup OpenAI API key Cursor AI installed The Chrome extension. Download The N8N JSON code. Download How to customize it to your needs? Both the Chrome extension and N8N flow can be adapted to use on other websites. You can consider: analyzing a financial screen and ask questions about the data shown analyzing other charts extending the N8N workflow with other AI nodes With AI and image analytics the sky is the limit and in some cases it saves you from creating complex API integrations. Download Chrome extension
thingsio
Hans Blaauw
HTTP Request node
Google Drive node
+7

Transcribing Bank Statements To Markdown Using Gemini Vision AI

This n8n workflow demonstrates an approach to parsing bank statement PDFs with multimodal LLMs as an alternative to traditional OCR. This allows for much more accurate data extraction from the document especially when it comes to tables and complex layouts. Multimodal Parsing is better than traditiona OCR because: It reduces complexity and overhead by avoiding the need to preprocess the document into text format such as markdown before passing to the LLM. It handles non-standard PDF formats which may produce garbled output via traditional OCR text conversion. It's orders of magnitude cheaper than premium OCR models that still require post-processing cleanup and formatting. LLMs can format to any schema or language you desire! How it works You can use the example bank statement created specifically for this workflow here: https://drive.google.com/file/d/1wS9U7MQDthj57CvEcqG_Llkr-ek6RqGA/view?usp=sharing A PDF bank statement is imported via Google Drive. For this demo, I've created a mock bank statement which includes complex table layouts of 5 columns. Typically, OCR will be unable to align the columns correctly and mistake some deposits for withdrawals. Because multimodal LLMs do not accept PDFs directly, well have to convert the PDF to a series of images. We can achieve this by using a tool such as Stirling PDF. Stirling PDF is self-hostable which is handy for sensitive data such as bank statements. Stirling PDF will return our PDF as a series of JPGs (one for each page) in a zipped file. We can use n8n's decompress node to extract the images and ensure they are ordered by using the Sort node. Next, we'll resize each page using the Edit Image node to ensure the right balance between resolution limits and processing speed. Each resized page image is then passed into the Basic LLM node which will use our multimodal LLM of choice - Gemini 1.5 Pro. In the LLM node's options, we'll add a "user message" of type binary (data) which is how we add our image data as an input. Our prompt will instruct the multimodal LLM to transcribe each page to markdown. Note, you do not need to do this - you can just ask for data points to extract directly! Our goal for this template is to demonstrate the LLMs ability to accurately read the page. Finally, with our markdown version of all pages, we can pass this to another LLM node to extract required data such as deposit line items. Requirements Google Gemini API for Multimodal LLM. Google Drive access for document storage. Stirling PDF instance for PDF to Image conversion Customising the workflow At time of writing, Gemini 1.5 Pro is the most accurate in text document parsing with a relatively low cost. If you are not using Google Gemini however you can switch to other multimodal LLMs such as OpenAI GPT or Antrophic Claude. If you don't need the markdown, simply asking what to extract directly in the LLM's prompt is also acceptable and would save a few extra steps. Not parsing any bank statements any time soon? This template also works for Invoices, inventory lists, contracts, legal documents etc.
jimleuk
Jimleuk

More AI workflow templates

OpenAI Chat Model node
SerpApi (Google Search) node

AI agent chat

This workflow employs OpenAI's language models and SerpAPI to create a responsive, intelligent conversational agent. It comes equipped with manual chat triggers and memory buffer capabilities to ensure seamless interactions. To use this template, you need to be on n8n version 1.50.0 or later.
n8n-team
n8n Team
HTTP Request node
Merge node
+7

Scrape and summarize webpages with AI

This workflow integrates both web scraping and NLP functionalities. It uses HTML parsing to extract links, HTTP requests to fetch essay content, and AI-based summarization using GPT-4o. It's an excellent example of an end-to-end automated task that is not only efficient but also provides real value by summarizing valuable content. Note that to use this template, you need to be on n8n version 1.50.0 or later.
n8n-team
n8n Team
HTTP Request node
Markdown node
+5

AI agent that can scrape webpages

⚙️🛠️🚀🤖🦾 This template is a PoC of a ReAct AI Agent capable of fetching random pages (not only Wikipedia or Google search results). On the top part there's a manual chat node connected to a LangChain ReAct Agent. The agent has access to a workflow tool for getting page content. The page content extraction starts with converting query parameters into a JSON object. There are 3 pre-defined parameters: url** – an address of the page to fetch method** = full / simplified maxlimit** - maximum length for the final page. For longer pages an error message is returned back to the agent Page content fetching is a multistep process: An HTTP Request mode tries to get the page content. If the page content was successfuly retrieved, a series of post-processing begin: Extract HTML BODY; content Remove all unnecessary tags to recude the page size Further eliminate external URLs and IMG scr values (based on the method query parameter) Remaining HTML is converted to Markdown, thus recuding the page lengh even more while preserving the basic page structure The remaining content is sent back to an Agent if it's not too long (maxlimit = 70000 by default, see CONFIG node). NB: You can isolate the HTTP Request part into a separate workflow. Check the Workflow Tool description, it guides the agent to provide a query string with several parameters instead of a JSON object. Please reach out to Eduard is you need further assistance with you n8n workflows and automations! Note that to use this template, you need to be on n8n version 1.19.4 or later.
eduard
Eduard
Merge node
Telegram node
Telegram Trigger node
+2

Telegram AI Chatbot

The workflow starts by listening for messages from Telegram users. The message is then processed, and based on its content, different actions are taken. If it's a regular chat message, the workflow generates a response using the OpenAI API and sends it back to the user. If it's a command to create an image, the workflow generates an image using the OpenAI API and sends the image to the user. If the command is unsupported, an error message is sent. Throughout the workflow, there are additional nodes for displaying notes and simulating typing actions.
eduard
Eduard
HTTP Request node
WhatsApp Business Cloud node
+10

Building Your First WhatsApp Chatbot

This n8n template builds a simple WhatsApp chabot acting as a Sales Agent. The Agent is backed by a product catalog vector store to better answer user's questions. This template is intended to help introduce n8n users interested in building with WhatsApp. How it works This template is in 2 parts: creating the product catalog vector store and building the WhatsApp AI chatbot. A product brochure is imported via HTTP request node and its text contents extracted. The text contents are then uploaded to the in-memory vector store to build a knowledgebase for the chatbot. A WhatsApp trigger is used to capture messages from customers where non-text messages are filtered out. The customer's message is sent to the AI Agent which queries the product catalogue using the vector store tool. The Agent's response is sent back to the user via the WhatsApp node. How to use Once you've setup and configured your WhatsApp account and credentials First, populate the vector store by clicking the "Test Workflow" button. Next, activate the workflow to enable the WhatsApp chatbot. Message your designated WhatsApp number and you should receive a message from the AI sales agent. Tweak datasource and behaviour as required. Requirements WhatsApp Business Account OpenAI for LLM Customising this workflow Upgrade the vector store to Qdrant for persistance and production use-cases. Handle different WhatsApp message types for a more rich and engaging experience for customers.
jimleuk
Jimleuk
Google Drive node
Binary Input Loader node
Embeddings OpenAI node
OpenAI Chat Model node
+5

Ask questions about a PDF using AI

The workflow first populates a Pinecone index with vectors from a Bitcoin whitepaper. Then, it waits for a manual chat message. When received, the chat message is turned into a vector and compared to the vectors in Pinecone. The most similar vectors are retrieved and passed to OpenAI for generating a chat response. Note that to use this template, you need to be on n8n version 1.19.4 or later.
davidn8n
David Roberts

Implement complex processes faster with n8n

red icon yellow icon red icon yellow icon