Facebook leads in erpnext

Does anyone know how to get fb leads in the erpnext automatically …
any set up tutorial ?
pls help very urgent

very urgent? WTF


why cant help me seeked urgently ?

need to have it working so i can present it to my boss… else job is in danger


Maybe you actually do need a new job.


Just kidding


well i appreciate your advice but would have been more sensible of u to comment if u only know the solution …

just kidding TOO

I really do not know the answer, hope somebody else does and responds to you.

But I hope you get the drift in @federico_calvo and my response?

This is a good question …but definitely not an urgent question. And it will be very strange if your job is really at stake over this.

I pray someone can answer the question quickly enough for you. This time not kidding. I really mean it.

1 Like

thanks buddy…

It’s certainly doable but will require some custom code. You need to create a new app at the Facebook developer console, write a new api method on the frappe side, then use the rpc address as your web hook endpoint.

Jokes apart it would take minimum of a month to achieve what you are asking as urgent. Your boss seems to be the type who thinks software is a line of code. I have met many in my life so I understand your situation. Recently I met a person who wanted to integrate photos from ERPNext to WooCommerce on the fly.

Good luck


The time required for something like this depends entirely on how familiar you already are with the platforms involved. If you have a good grip on the Facebook API and how to build Frappe endpoints, it’s an afternoon’s project to get something usable up and running. If you don’t, the sky is the limit. It’s tough working for bosses who assume you already know everything.

The hard part here is setting up the facebook side. I’ve always found the Facebook APIs to be a complete disaster, with extremely confusing authentication requirements and an utterly opaque app review process. As a rule, I get my data out of facebook as fast as possible because it’s a mess over there.

The easiest way to do that is with realtime webhook notifications. To configure those notifications, you need to create a new facebook app and then designate it on your facebook page as your CRM manager. Follow the instructions here to get your facebook app set up: Retrieving - Marketing API - Documentation - Meta for Developers

Once facebook is configured to notify on new leads, the workflow is straightforward:

  • On each new lead, your webhook will get sent a json payload including a property called leadgen_id.
  • Then, request the Facebook API endpoint for that lead (something like https://graph.facebook.com/v11.0/{leadgen_id}) with an appropriate access token.
  • That endpoint will return a json object with all of your lead data. From there, you can submit it as a new lead in ERPNext.

You could do this all on the frappe side, though I personally prefer to use a middleware layer to orchestrate the transaction. Either way works, but I find the middleware encapsulates things a bit better and makes debugging easier. I really like n8n.io for this kind of thing. Huginn is another option.

If you want to do it purely in Frappe, the easiest way would probably be to create a new Server Script. From there, it’s probably only a dozen lines of python to turn the json object that facebook sends into a new Lead document.


thanks buddy, i really appreciate your time n efforts in helping others…
as of no i have used zapier… which does the job…

Connected fb to gmail , and zapier send email from gmail to our email… and that email is added in crm as :append to leads: so so far it works…
but zapier is very expensive :frowning:

Thanks a lot once again,.

n8n is very similar to zapier in function and appearance, though since it’s self-hosted you have quite a bit more flexibility about node types.

1 Like

yeah it is indeed but lacks facebook n many popular apps

That’s not true. n8n has predefined nodes for both facebook and erpnext, and of course there are configurable generic nodes for both incoming and outgoing api calls.

no its not avialble :
pls se : Facebook Lead Ads integration - Feature Requests - n8n

was curious about this - seems to have apps for erpnext and facebook trigger…

1 Like

so u mean i can get my leads from fb ads campaign directly into my erpnext leads free of cost ?

Believe whatever you want, but it is definitely there. Here is a screenshot of a fully working example in n8n. Note the Facebook and ERPNext nodes. The lead gets created in Facebook and shows up in ERPNext a few seconds later.


hi can you provide some detailed tutorial to get FB leadgen work with n8n