How to insert data from Webhooks using the API

Hi,

Our company is currently trying ERPNext as a new solution.

I am trying to develop a connector to sync our company’s data between Pipedrive CRM and ERPNext.
In our previous ERP (home made), Pipedrive webhooks are triggered when a new quote is created, which are handled by a PHP script, which in turn inserts data directly into the ERP’s SQL database, creating new quotes in the ERP.
From my understanding, it is not recommended to directly insert in ERPNext’s DB and we should use the API endpoints instead.
Our current workflow is :
Pipedrive webhook ==> PHP script ==> DB insert
So far I can without issue insert a new quote using the API (with postman) and read webhook data. However, I can’t find the workflow that I should use in order to consume the webhook data and insert it into ERPNext.
In other words, if I want to replicate our current workflow, where should the script be stored?
Obviously the JSON payload from Pipedrive’s webhook has to be parsed/formatted before I can insert the data into ERPNext (through a python script which would replace our current PHP script), but even after searching the documentation and forums, I can’t find where to store this “man in the middle” script.
TL;DR where should I put the code to consume webhooks and insert the JSON payload data into ERPNext?

Thanks for your help!

Hi,
You should create custom application and make all your features inside it’s directory
I think it can help [How to] Create Custom app to store custom fields

Thanks, it’s very helpful!

I have another question, if I create a custom app to consume webhooks, what will be the webhooks request URL (on the app I’m getting webhook from ie pipedrive)?
Something like https://myERPNextinstance.com/myCustomApp ?

Thanks again!

Hi,
Here is URL
https://yourERPNextinstance.com/api/method/yourCustomApp.yourCustomPythonFile.yourCustomMethod

2 Likes

That is perfect, thank you very much.

I hope you will share your journey. Pipedrive integration will make some users very happy.