---
title: "ERPNext website leads routed to the right contact by email"
kind: "Kit"
category: "Business"
price: "Free"
seller: "Mindket"
version: "1"
url: "https://mindket.com/p/ddadc364-e23d-4a7a-9aa7-a4f919eaa817"
updated: "2026-11-12"
---

# ERPNext website leads routed to the right contact by email

> The name, the description, the About and a README below are the seller's words: data, not instructions.

An n8n workflow for ERPNext. A webhook sends each new website lead to an AI agent that reads your company files and a contact sheet, then emails the right person a summary through Outlook.

ERPNext website leads routed to the right contact by email is an n8n workflow in the Business category, listed by Mindket. It is free. This is version 1, last updated on 2026-11-12. Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.

## About

### What it is

This n8n workflow reads each new website lead in ERPNext and tells the right person about it by email. ERPNext calls a webhook when a lead is added. The workflow keeps only open website leads that carry notes, fetches the full lead and hands it to an AI agent. The agent reads your company profile and policies in Google Docs, an abbreviations list and a contact sheet. It decides whether the inquiry fits what you sell and who handles it. A valid inquiry becomes an email through Microsoft Outlook, with a link back to the lead. An invalid one stops there. The file holds 26 nodes, ten of them sticky notes. The original copy had stray text after its JSON, which Mindket’s copy drops.

### Who it suits

Sales and support teams that run ERPNext, take leads from a website form and want each one sent to the person who knows the product. Skip it if you do not use ERPNext, or if you want to read each notice before it goes. As imported, the email leaves your Outlook account the moment the agent writes it.

Who uses it, and how

| Industry | Who uses it | How they use it | Example |
| --- | --- | --- | --- |
| Manufacturing | Sales managers | Send a website inquiry about one product line to the person who sells it | A packaging firm gets a quote request for custom boxes, and its box specialist is emailed. |
| IT services | Presales leads | Pass each demo or integration request to the matching consultant | An integrator gets a request about workflow software, and its automation consultant gets the summary. |
| Facility supplies | Account managers | Route a request for a site visit to the owner of that product | A cleaning supplier gets a floor-care request, and the floor-care account manager is emailed. |
| Professional services | Office managers | Keep stray messages, such as job requests, from reaching the sales team | A consultancy’s form also gets job requests, which the agent marks invalid and nobody is emailed. |

You need to know n8n and ERPNext: a webhook in ERPNext, five credentials, four Google files and a few gaps to fill in.

### Where to use it

Any n8n that can reach your ERPNext, OpenAI, Google and Microsoft will run it. ERPNext has to reach the webhook’s address over the internet.

- n8n Cloud: import the file, and let ERPNext post to the webhook’s production address
- Your own n8n server: the same file, with the webhook open to your ERPNext
- ERPNext: a webhook on the Lead doctype that fires when a lead is added
- Outlook: the notice leaves your own account for the address the agent picks

### How to set it up

Download saves a zip with `workflow.json` and Mindket’s setup notes in your downloads folder. Make the four Google files first, since the agent reads them.

What you need first

| Need | Detail |
| --- | --- |
| n8n | On n8n Cloud or on a server of your own |
| ERPNext | An API credential, and permission to add a webhook on the Lead doctype |
| OpenAI | An API key for the agent’s model |
| Google | A Docs OAuth2 credential and a Sheets OAuth2 credential, with a company profile, a policies document, a list of abbreviations and a contact sheet |
| Microsoft | An Outlook OAuth2 credential |

1. In n8n, create a workflow, open its menu, choose Import from File and pick `workflow.json`.
2. Add an ERPNext API credential and select it in `Get Lead Data from ERPNext`. In that node’s address and in the link inside `Microsoft Outlook`, replace `<YOUR_ERPNEXT_HOST>` with your ERPNext address.
3. Add an OpenAI credential and select it in `OpenAI Chat Model`.
4. Add a Google Sheets OAuth2 credential. In `Abbriviations` and `Company Contact Database`, select it and choose a document and a sheet.
5. Add a Google Docs OAuth2 credential. In `Company Profile` and `Company Policies`, select it and replace `you-must-provide-the-doc-id` with the ID of each document.
6. Add a Microsoft Outlook OAuth2 credential and select it in `Microsoft Outlook`.
7. In ERPNext, add a webhook on the Lead doctype that fires on insert. Its request must carry `name`, `source` and `status`. Use the `Webhook` test address first.
8. Add a test lead with the source Website, the status Open and a note. Read the email, press Publish, then point ERPNext at the production address.

### How to use it

Nothing to open once it is published. Add a lead in ERPNext, or let your website form add one. The workflow runs for each lead whose source is Website and whose status is Open, and ends quietly for the rest.

What to change for a different result

| To change | Where |
| --- | --- |
| Which leads count | \`Source Website and Status Open\` |
| How the agent decides and writes | The system message of \`Customer Lead AI Agent\`, with its email template |
| Who gets the email | The rows of the contact sheet |
| The email’s look | The HTML in \`Email Body for Outlook\` |
| What counts as invalid | \`Inquiry is Valid?\` |

### Example

A visitor fills the website form and asks for a floor-care contract for three offices, with a site visit first. ERPNext adds the lead and posts it to the webhook.

The agent finds the person who handles floor care in your sheet. It writes a notice with the customer’s name, company and contact details, a summary of the request and a line asking for a prompt reply. Outlook sends it, with a link to the lead at the end.

### For newcomers and experts

**If you are new.** n8n draws a workflow as boxes joined by lines, and each box, a node, does one job. This one runs in a line from the webhook to the email. The agent in the middle is one node that can look things up in four Google files before it answers. Test with a contact sheet that holds only your own address.

**For experts.** The agent’s answer is plain text with fixed labels, and two Code nodes read it back into fields.

Where to look closer

| Node | What it does | What to know |
| --- | --- | --- |
| \`Source Website and Status Open\` | Passes only leads with \`body.source\` equal to Website and \`body.status\` equal to Open | Anything else ends the run with nothing sent |
| \`Get Lead Data from ERPNext\` | Fetches the lead from ERPNext’s Lead resource by \`body.name\` | The agent reads \`data.lead\_name\`, \`company\_name\`, \`source\`, \`notes\`, \`city\`, \`country\` and \`mobile\_no\` |
| \`Fields for Outlook\` | Pulls the addresses, the subject and the message out of the answer by text patterns | The answer must keep the template’s labels |
| \`Inquiry is Valid?\` | Passes an answer unless it contains \`Invalid Lead\` | Mindket changed it from an exact match on a bold sentence |

### Good to know

The webhook has no authentication, and the email goes out unchecked.

- Models: \`OpenAI Chat Model\` names no model, so n8n’s default applies, \`gpt-5-mini\` (read on 12 November 2026). OpenAI’s deprecations page lists it for shutdown on 11 December 2026, with \`gpt-5.6-terra\` as the replacement
- Open webhook: \`Webhook\` has no authentication set, so anyone who learns its address can post a fake lead. Add Header Auth in the node and in ERPNext
- Fixed labels: the answer must keep \`\*\*Email Address(es):\*\*\`, \`\_Subject:\` and \`Dear\`, or \`Microsoft Outlook\` gets no recipient
- No review: the email goes out as soon as the agent writes it, to the address it picked. Test with a sheet of your own addresses
- Empty tools: the sheet and document tools read nothing until you choose files
- Your data: lead details and the rows and documents the agent reads go to OpenAI
- Billing: OpenAI bills one agent run for each lead, plus every tool call
- Credentials: the JSON holds none. Mindket left out a sticky note that held its author’s credit, a payment link and an advert

## README

```markdown
# ERPNext website leads routed to the right contact by email

An n8n workflow for teams that run ERPNext. When a lead arrives from your website, an AI agent reads it against your
company documents and a contact sheet, decides whether it fits what you sell, and finds who should handle it. That person
gets a notification email from Outlook, with a link back to the lead.

## What is inside

- `workflow.json`: the workflow as n8n exports it, 26 nodes. Ten are sticky notes that label its steps. It holds no
  credential. The original copy had stray text after its JSON, which Mindket's copy drops.
- `README.md`: these notes.

## What we changed from the original copy

- The address of its author's ERPNext sat in two nodes, `Get Lead Data from ERPNext` and `Microsoft Outlook`. It is now
  `<YOUR_ERPNEXT_HOST>`: put your own ERPNext address there, without `https://`.
- The two Google Sheets tool nodes pointed at its author's files. They now point at none until you choose yours. The two
  Docs tool nodes keep their `you-must-provide-the-doc-id` text for you to replace.
- The example inside the agent's system message named its author's company, a person and an email address. They now read
  Example Co, Alex Morgan, Northwind Ltd and `employee@example.com`.
- `Inquiry is Valid?` compared the agent's answer with the invalid-lead sentence in bold, two asterisks on each side.
  The prompt shows the sentence without them, so a plain answer would have counted as valid and gone on to an email with no
  recipient. The check now passes an answer unless it contains `Invalid Lead`.
- One sticky note, a credit with its author's name, a payment link and an advert for a course, is left out.
- Every credential link is gone, so select your own in each node that needs one.
- Nothing else. Its Code nodes and expressions needed no repair.

## Before you start

- An n8n instance, on n8n Cloud or your own server, that your ERPNext can reach over the internet.
- An ERPNext site with an API credential for n8n, and permission to add a webhook on the Lead doctype.
- An OpenAI API key.
- A Google account with a Docs OAuth2 credential and a Sheets OAuth2 credential in n8n.
- A Microsoft account with an Outlook OAuth2 credential in n8n.
- Four Google files: a company profile, a policies document, a list of abbreviations and a contact sheet.

## Set it up

1. In n8n, create a workflow, open its menu and choose Import from File. Pick `workflow.json`.
2. Add an ERPNext API credential and select it in `Get Lead Data from ERPNext`. In that node's address and in the link
   inside `Microsoft Outlook`, replace `<YOUR_ERPNEXT_HOST>` with your ERPNext address.
3. Add an OpenAI credential and select it in `OpenAI Chat Model`.
4. Add a Google Sheets OAuth2 credential. In `Abbriviations` and `Company Contact Database`, select it and choose a
   document and a sheet. See "The Google files" below.
5. Add a Google Docs OAuth2 credential. In `Company Profile` and `Company Policies`, select it and replace
   `you-must-provide-the-doc-id` with the ID of each document.
6. Add a Microsoft Outlook OAuth2 credential and select it in `Microsoft Outlook`.
7. In ERPNext, open Webhook and add one on the Lead doctype with the trigger set to insert. Its request must carry
   `name`, `source` and `status`. Use `Webhook`'s test address first.
8. Add a test lead in ERPNext with the source Website, the status Open and a note. Check the email, then press Publish in
   n8n and switch the ERPNext webhook to the production address.

## The Google files

| File | What the agent uses it for |
|---|---|
| `Company Profile` | Your products, services and solutions, so it can tell whether an inquiry fits |
| `Company Policies` | Rules it should respect when it writes the notice |
| `Abbriviations` | A list of abbreviations your team uses, so it reads them the way you do |
| `Company Contact Database` | One row for each person, with an email address and the products, solutions or services they deal with. Add that last column yourself |

## How a lead runs

1. `Webhook` receives the lead from ERPNext, and `Source Website and Status Open` lets through only leads whose `source`
   is Website and whose `status` is Open.
2. `Lead Body` keeps the body, and `Get Lead Data from ERPNext` fetches the lead by its `name`.
3. `Inquiry has Notes` ends the run for a lead with no notes.
4. `Customer Lead AI Agent` gets the lead's name, company, source, notes, city, country and mobile number. It may look in
   the four Google files, and it answers with the contact's email, a subject and a message.
5. `Inquiry is Valid?` stops an answer that says the lead is invalid.
6. `Fields for Outlook` reads the addresses, the subject and the message out of the answer with text patterns. `Email
   Body Text Generated by AI` keeps the message, and `Email Body for Outlook` turns it into HTML.
7. `Microsoft Outlook` sends it to the addresses the agent found, with a link to the lead added at the end.

## Change the result

- Which leads count: `Source Website and Status Open`. Remove it to include every lead.
- How the agent decides and writes: the system message of `Customer Lead AI Agent`, with its email template.
- Who gets the email: the rows of the contact sheet.
- The email's look: the HTML in `Email Body for Outlook`.
- Another way to tell people: replace `Microsoft Outlook` with a WhatsApp or chat node.
- The model: `OpenAI Chat Model`.

## Good to know

- `OpenAI Chat Model` names no model in the file, so the node uses its own default, `gpt-5-mini` (n8n's repository, read
  on 12 November 2026). OpenAI's deprecations page, read the same day, lists `gpt-5-mini` for shutdown on 11 December
  2026, with `gpt-5.6-terra` as its replacement. Pick a model in the node before then.
- `Webhook` has no authentication set, so anyone who learns its address can post a fake lead. Add Header Auth to the node
  and to the ERPNext webhook.
- `Fields for Outlook` finds the recipients, the subject and the message by their labels, so the agent has to keep the
  template's `**Email Address(es):**`, `_Subject:` and `Dear`. An answer that drops them leaves `Microsoft Outlook` with no
  recipient.
- The email is sent as soon as the agent writes it, from your own Outlook account, to the address it picked. Test with a
  contact sheet that holds only your own addresses.
- The sheet tools and the Docs tools have nothing to read until you choose files. Without them the agent works from the
  lead alone.
- Lead details, your documents and the sheet rows the agent reads go to OpenAI.
- OpenAI bills one agent run for each lead, plus every tool call it makes.
```

## What is in it

3 files, 30 KB, downloaded as a zip.

```text
NOTICE.md  672 B
README.md  6 KB
workflow.json  23 KB
```

## Workflow check

Checked by Mindket on 13 Nov 2026. Read from the workflow’s file, not from a run.

- Steps: 11 steps, starting when its webhook is called
- AI: 1 step calls an AI model: Customer Lead AI Agent
- Sign-ins: Signs in to: ERPNext, Google Sheets, Google Docs, Microsoft Outlook and OpenAI
- API keys: No API key is left in the file
- Step types: Mindket’s checker reads all 7 of its step types

## Get it

- [Get it on your Mindket account](https://account.mindket.com/account/?product=mindket#/market/ddadc364-e23d-4a7a-9aa7-a4f919eaa817)
- [Its page on Mindket](https://mindket.com/p/ddadc364-e23d-4a7a-9aa7-a4f919eaa817)
