ERPNext webhook

hi,
how to get the ERPNext webhook response?

I want to save value of json response for specific key into docktype itself

thanks

Hi,
You can use the function called frappe.request to make the HTTP request and retrieve the JSON response.
Example for the POST request:

frappe.request({
  method: "POST",
  url: "https://webhook-url.com",
  headers: {
    "Content-Type": "application/json"
  },
  data: {
    // Request payload
  },
  callback: function(response) {
    if (response && response.message) {
      var json_response = JSON.parse(response.message);
      frappe.model.set_value("DocType", "DocName", "specific_field", json_response.specific_key);
    }
  }
});

Hope this will help you out.

Thank you.

hi

actually I followed this link:

https://frappeframework.com/docs/v14/user/en/guides/integration/webhooks

is it possible to manage webhook respond from above link?

thanks

Yes, It will help you.

https://frappeframework.com/docs/v14/user/en/guides/integration/webhooks

how to get webhook response from above link?

Hi,
here’s a sample webhook response:

{
    "event_type": "order.created",
    "event_time": "2022-04-01T10:00:00Z",
    "data": {
        "order_id": "12345",
        "customer_id": "67890",
        "total_amount": 100.00,
        "currency": "USD"
    }
}

This is a sample response for an order.created event. It includes the event type, event time, and data related to the event. In this case, the data includes the order_id, customer_id, total_amount, and currency.

Hope this will help you out.

Thank you.

thank you