For many Indian manufacturers, traders and suppliers, IndiaMART is where a large part of new enquiries arrive. The problem is what happens next. Leads sit in the IndiaMART Lead Manager, someone copies them into a sheet, and the quick first response that wins the order is lost. If your quotes, stock and invoices live in ERPNext, the natural fix is to bring the lead into ERPNext as soon as it is created.
This guide shows two ways to do it: the Push API for real-time capture and the Pull API on a schedule. It includes field mapping, sample code, duplicate handling and the limits IndiaMART publishes. It is written for ERPNext administrators and developers, and for sales heads who want to know what is possible. For the CRM side of ERPNext in general, see our post on how ERPNext improves CRM.
Before you start: according to IndiaMART, the lead APIs are an add-on service for paid sellers, they cannot be bought on their own, and they are offered in do-it-yourself mode, so IndiaMART's technical team does not help with integration. Confirm your plan with IndiaMART first.
Key takeaways
- Push is real time, pull is scheduled. The Push API posts each lead to your webhook URL as it arrives. The Pull API is a URL you call every 10 to 15 minutes.
- ERPNext needs a small endpoint. There is no built-in IndiaMART connector in standard ERPNext, so a custom app method or a connector receives the lead and creates a Lead.
- Use UNIQUE_QUERY_ID to avoid duplicates, and return HTTP 200 whenever you have safely stored or deliberately ignored a lead.
- IndiaMART publishes no signature for pushes, so protect your endpoint with a secret token in the URL, HTTPS and rate limiting.
Copying IndiaMART leads into Excel by hand?
Book a free 30-minute call. We will show an IndiaMART enquiry arriving in ERPNext as a Lead with the right owner and a follow-up task.
Show me IndiaMART in ERPNext → WhatsApp us: +91 8089051848
Or email info@nexeves.com
Push API or Pull API?
| Push API | Pull API | |
|---|---|---|
| How it works | IndiaMART sends each lead by HTTP POST to your webhook URL | You call IndiaMART with your CRM key and a time range |
| Speed | Real time | Only as fast as your schedule. IndiaMART suggests every 10 to 15 minutes, with 5 minutes as the minimum gap |
| History | Not available before activation | Last 365 days, in windows of up to 7 days |
| What you need | A public HTTPS endpoint on your ERPNext site | A scheduled job and a secret key |
| Failure behaviour | IndiaMART retries failed pushes, and deactivates the API if your endpoint does not accept leads for 48 hours continuously | You simply miss a window unless you overlap your time ranges |
Our recommendation is push for live leads, pull once for the back-fill of recent history and as a safety net if your server was down.
What an IndiaMART lead contains
From the IndiaMART documentation, each lead has these fields. Some are always present, others only when the buyer supplied them.
| IndiaMART field | Meaning | ERPNext Lead field |
|---|---|---|
| UNIQUE_QUERY_ID | Unique ID of the lead, to be used for duplicate checks | Custom field "IndiaMART Query ID" |
| QUERY_TYPE | W direct enquiry, B buy-lead, P phone call, BIZ catalog view, WA WhatsApp enquiry | Custom field "IndiaMART Query Type" |
| QUERY_TIME | When the lead was created | Creation, or a note |
| SENDER_NAME | Buyer name, defaults to "IndiaMART Buyer" | First Name |
| SENDER_COMPANY | Buyer company | Company Name |
| SENDER_EMAIL / SENDER_MOBILE | Primary email and mobile (at least one is always present) | Email Address / Mobile No |
| SENDER_CITY, STATE, COUNTRY_ISO | Location. The country is an ISO two-letter code | City, State, Country (looked up by code) |
| SUBJECT, QUERY_PRODUCT_NAME, QUERY_MESSAGE | What the buyer wants, including quantity and notes | A Note on the Lead |
Always-present fields per IndiaMART: UNIQUE_QUERY_ID, QUERY_TYPE, QUERY_TIME, SENDER_NAME, either SENDER_MOBILE or SENDER_EMAIL, and SENDER_COUNTRY_ISO. Call attempts that did not connect, replies and some repeat catalog views are not delivered by the API.
Step 1: Prepare ERPNext
- Create the lead source. In ERPNext v16 the Lead has a UTM Source field (create an "IndiaMART" record). In v15 and earlier it is the Source field linked to Lead Source.
- Add two custom fields on Lead: IndiaMART Query ID (Data, read-only, unique) and IndiaMART Query Type (Data).
- Create an Assignment Rule so new IndiaMART leads are assigned to salespeople by round robin or by territory.
- Plan the alert: a Notification on new Lead that emails the owner, or a WhatsApp message through your existing integration. Our ERPNext WhatsApp integration post covers that.
Be aware that ERPNext checks that a Lead's email address is unique. A second enquiry from the same buyer will be rejected unless your CRM Settings allow duplicate emails. Handle this deliberately: look for an existing Lead with the same email or mobile and add a note to it instead of creating another.
Step 2: Create the endpoint (Push API)
Standard ERPNext has no IndiaMART listener, so you add one. The simplest route is a whitelisted method in a small custom app. Frappe publishes it at /api/method/<module path> and, with allow_guest, it can be called without a login. The sketch below shows the logic. Treat it as a starting point and review it before production.
# myapp/indiamart.py (a small custom app, or any app on your site)
import hmac
import frappe
from frappe.rate_limiter import rate_limit
@frappe.whitelist(allow_guest=True, methods=["POST"])
@rate_limit(limit=1200, seconds=3600)
def receive_lead(token=None):
secret = frappe.conf.get("indiamart_push_token") # site_config.json
if not secret or not hmac.compare_digest(str(token or ""), str(secret)):
frappe.throw("Not permitted", frappe.PermissionError)
data = frappe.form_dict
row = data.get("RESPONSE") or {} # IndiaMART sends the lead in RESPONSE
qid = str(row.get("UNIQUE_QUERY_ID") or "")
if not qid:
return "ignored" # 200 so IndiaMART does not retry
if frappe.db.exists("Lead", {"custom_indiamart_query_id": qid}):
return "duplicate" # already stored: still return 200
country = frappe.db.get_value("Country", {"code": (row.get("SENDER_COUNTRY_ISO") or "").lower()})
lead = frappe.get_doc({
"doctype": "Lead",
"first_name": row.get("SENDER_NAME") or "IndiaMART Buyer",
"company_name": row.get("SENDER_COMPANY"),
"email_id": row.get("SENDER_EMAIL"),
"mobile_no": row.get("SENDER_MOBILE"),
"city": row.get("SENDER_CITY"),
"state": row.get("SENDER_STATE"),
"country": country,
"utm_source": "IndiaMART", # v15: "source" (Lead Source)
"custom_indiamart_query_id": qid,
"custom_indiamart_query_type": row.get("QUERY_TYPE"),
})
note = "\n".join(filter(None, [row.get("SUBJECT"), row.get("QUERY_PRODUCT_NAME"), row.get("QUERY_MESSAGE")]))
lead.append("notes", {"note": note})
lead.insert(ignore_permissions=True)
return "created"
Four design choices matter here:
- Token check. IndiaMART's documentation shows only a Content-Type header on pushes, with no signature or key, so anyone who finds your URL could post fake leads. Keep a long random token in the URL and in
site_config.json, and compare it in constant time. - Return codes. IndiaMART treats HTTP 200 as success and retries otherwise. Return 200 for stored, duplicate or ignorable leads, and a non-200 code only for a real fault you want retried.
- Rate limiting. The
rate_limitdecorator protects the open endpoint from floods. - Payload shape. The documentation shows the lead inside a RESPONSE object, with CODE and STATUS beside it. Log the first test payload from IndiaMART and confirm the shape before you rely on the mapping.
Step 3: Activate the Push API in IndiaMART
- Log in at seller.indiamart.com and open the Lead Manager.
- From the three-dot menu choose Import/Export Leads, then Push API.
- Select your CRM platform. If ERPNext is not listed, choose Other and enter a name and your webhook listener URL.
- Enter the URL, which must begin with https://. Confirm the OTP sent to your primary mobile number to activate.
- Use the test pop-up to send a sample lead, then check that a Lead appears in ERPNext.
IndiaMART's URL guidance suggests the form https://your-domain/indiamart/identifier. A Frappe method URL looks different, so test that IndiaMART accepts a URL with a query-string token. If it does not, ask your server administrator to add a rewrite so that a clean path such as /indiamart/your-token proxies to the Frappe method. The IndiaMART API hit logs, including the retry count for failed leads, are available in the Lead Manager and help you debug.
Check if your IndiaMART plan allows it
The lead API is an add-on for paid sellers. Send us your plan details and we will confirm the setup in a free call before you spend time on development.
Confirm my IndiaMART setup → WhatsApp us: +91 8089051848
Or email info@nexeves.com
Option: Pull API on a schedule
If you cannot expose a public endpoint, or you want the back-fill, use the Pull API. Generate a key in the Lead Manager under Import/Export Leads, then Pull API. IndiaMART publishes these rules, and your job must respect them:
- The endpoint is
https://mapi.indiamart.com/wservce/crm/crmListing/v2/with the parameters glusr_crm_key, start_time and end_time, in IST. - The time range can be at most 7 days, and only the last 365 days are available.
- Do not call more than once every 5 minutes. More than 5 calls in a minute blocks the key for 15 minutes.
- The key expires if it is unused for 7 days, and a new key replaces the old one.
- Data from before the key was generated becomes available after 24 hours.
- IndiaMART advises a rolling overlap, for example calling every 5 minutes with a start time 5 minutes before the previous end time, and removing the repeats with UNIQUE_QUERY_ID.
# hooks.py
scheduler_events = {"cron": {"*/10 * * * *": ["myapp.indiamart.pull_leads"]}}
# myapp/indiamart.py
import requests, frappe
from frappe.utils import now_datetime, add_to_date
def pull_leads():
key = frappe.conf.get("indiamart_pull_key")
end = now_datetime()
start = add_to_date(end, minutes=-15) # overlap the window, dedupe by UNIQUE_QUERY_ID
fmt = "%d-%m-%Y%H:%M:%S" # IST, as IndiaMART expects
r = requests.get("https://mapi.indiamart.com/wservce/crm/crmListing/v2/",
params={"glusr_crm_key": key, "start_time": start.strftime(fmt), "end_time": end.strftime(fmt)},
timeout=30)
body = r.json()
for row in body.get("RESPONSE", []):
create_lead_if_new(row) # same logic as the push receiver
Treat the CRM key like a password. IndiaMART warns that anyone with it can read your lead data, so keep it in site_config.json, not in code or chat. Keep the server clock synchronised with an NTP server, because the windows depend on accurate time.
Turn leads into follow-up, not just records
- Assignment: assign each lead to a salesperson immediately with an Assignment Rule.
- Alerts: send an email or WhatsApp alert with the product, quantity and buyer phone number.
- First-response target: add a ToDo or Event with a due time, and report on leads with no activity.
- Lead type handling: treat a call lead (P) differently from a catalog view (BIZ) when you set priority.
- Conversion: convert qualified leads into an Opportunity and Quotation, and report conversion by source. Our customer journey guide shows the full flow.
Common problems
| Problem | Cause and fix |
|---|---|
| Leads do not arrive | The URL is not public HTTPS, the token is wrong, or the endpoint returns a non-200 code. Use IndiaMART’s test pop-up and the API hit logs |
| Same buyer creates errors | ERPNext enforces unique Lead emails. Match on email or mobile first and add a note to the existing Lead |
| Push API switched off | Your endpoint did not accept leads for 48 hours continuously. Fix the fault, then reactivate and back-fill with the Pull API |
| Pull API returns 429 | You called too often. Keep at least 5 minutes between calls and never more than 5 per minute |
| Country not set | The ISO code does not match any Country record. Check the Country list has codes set |
| Fake or odd leads | The token leaked. Rotate the token in site config and in IndiaMART, and review recent leads |
How Nexeves helps
We build lead capture for IndiaMART, website forms, Meta and WhatsApp into ERPNext CRM, with assignment rules, alerts and conversion reports. If you prefer the Frappe CRM application, we can review that route with you too. See our ERPNext customisation and implementation services, and our guide to ERPNext API integrations for the technical background.
Frequently asked questions
Does ERPNext have a built-in IndiaMART integration?
Standard ERPNext has no IndiaMART connector. You build a small endpoint or scheduled job that reads leads from IndiaMART’s Push or Pull API and creates ERPNext Leads.
What is the difference between the Push API and the Pull API?
The Push API sends each lead to your webhook URL in real time. The Pull API is a URL you call on a schedule with a time range, and it also gives the last 365 days of history.
Do I need a paid IndiaMART plan?
According to IndiaMART, the lead APIs are an add-on for paid sellers and cannot be bought on their own. Confirm availability with IndiaMART before you plan the work.
How do I stop duplicate leads?
Store IndiaMART’s UNIQUE_QUERY_ID on each Lead and check it first. Also match on email or mobile, because ERPNext requires unique Lead emails by default.
What happens if my endpoint is down?
IndiaMART retries failed pushes, but it deactivates the Push API if your endpoint does not accept leads for 48 hours continuously. You can back-fill with the Pull API.
Can I get my old IndiaMART leads into ERPNext?
The Push API does not deliver history. Use the Pull API in windows of up to 7 days to fetch the last 365 days, and de-duplicate with UNIQUE_QUERY_ID.
Respond to every IndiaMART lead in minutes
Nexeves builds lead capture, assignment rules and follow-up reminders in ERPNext CRM for manufacturers, traders and exporters.
Book my free lead-capture demo → WhatsApp us: +91 8089051848
Or email info@nexeves.com
Nexeves serves India & the GCC: UAE (Dubai, Abu Dhabi), Saudi Arabia (Riyadh, Jeddah), Qatar (Doha), Kuwait, Bahrain and Oman (Muscat).
No comments yet. Login to start a new discussion Start a new discussion