Consume Webhook in ERP Next

Our product uses AI to automatically extract critical invoice data to streamline AP processes. We’re looking to have ERP Next consume our webhook event, which would then trigger downstream AP processes in ERP next.

Does ERP Next have this ability? Is there any documentation available that someone could share? If our product also wanted to consume supplier information through an API from a vendor master list or line item data from a purchase order, is this available via API?

ERPNext webhook will post doc_events from ERPNext.
Check webhook doctype. This can be used to publish data from ERPNext to given POST request url.
Note that only doc_events are published as webhooks. Any changes that happen due to direct SQL queries won’t be published by webhook

If you need to catch webhook from external app you need to add whitelisted function and use that as endpoint. Example /api/method/path.to.function or /api/method/path.to.function/random_string

random_string is recommended to secure webhook if no payload signature is sent in header to verify webhook

Got it @revant_one, very much appreciated. This would be to catch a webhook from our application (external).

Any chance you can point me to some documentation on using the whitelisted function?

Option 1 (no signature header from external app):

Check how python function custom is added here:

It results in endpoint like
http://site.name.com/api/method/frappe.integrations.oauth2_logins.custom/<provider>

instead of provider you store random_string

Option 2 (signature header available in external app):

Check how whitelisted functions call verify_request() here:

1 Like

Hi revant,

I am trying yo publish ERPNext doctype (Note doctype) event (after_sumit) webhook to the Google Apps script that is deployed as webhook. Despite the status of webhook is enabled



Webhook Report and Webohook Request Log doesn’t show that it is enabled

Any suggestions that I could enable and consume the Webhook in an external app

Tests that I’ve done

  • Created new note

Deployement

  • Frappe Cloud

Make sure the default worker is running and processing the background jobs. Webhooks are triggered using frappe.enqueue()