Webhook with full doc as json

I’m working with ERPNext on frappe.cloud

I have a webhook for Task (on_change).
It’s working for individual, named fields:


However, I want the whole doc object in the body, but this is not working

I have tried:

  "doc": "{{doc}}"

… but I can’t get the whole object out.

I have also tried

Sorry to bump this up.

I came across this problem as well but I finally found the solution!

All you have to do is add |tojson|safe to the variable {{doc}} like this {{doc|tojson|safe}}

The reason is because the WebHook controller calls the “frappe.render_template” function which returns a doctype object instead of JSON


The string filter worked for me. The JSON response body is:

"doc": "{{ doc | string }}"    
1 Like