Hi,
I can successfully create a webhook:
curl -s -H "Authorization: Bearer $ACCESS_TOKEN" -H "Accept: application/json" "https://subdomain.erpnext.com/api/resource/Webhook" -H "Content-Type: application/json" -d '{"webhook_doctype": "Contact", "webhook_docevent": "on_change", "request_url": "http://example.com"}'
But when creating second webhook for the same docevent and doctype (and another request_url) error is returned:
curl -s -H "Authorization: Bearer $ACCESS_TOKEN" -H "Accept: application/json" "https://piortpiesync.erpnext.com/api/resource/Webhook" -H "Content-Type: application/json" -d '{"webhook_doctype": "Contact", "webhook_docevent": "on_change", "request_url": "http://other-example.com"}'
{"exc":"[\"Traceback (most recent call last):\\n File \\\"/home/frappe/benches/bench-2018-09-12/apps/frappe/frappe/app.py\\\", line 67, in application\\n response = frappe.api.handle()\\n File \\\"/home/frappe/benches/bench-2018-09-12/apps/frappe/frappe/api.py\\\", line 119, in handle\\n \\\"data\\\": frappe.get_doc(data).insert().as_dict()\\n File \\\"/home/frappe/benches/bench-2018-09-12/apps/frappe/frappe/model/document.py\\\", line 236, in insert\\n
raise e\\nDuplicateEntryError: (u'Webhook', u'Contact-on_change', IntegrityError(1062, u\\\"Duplicate entry 'Contact-on_change' for key 'PRIMARY'\\\"))\\n\"]"}
I also tried to provide another “name” but name is set automatically and can’t be set.
Is it intentional behavior? Imagine that I want to integrate with two external systems that require the same event on the same entity. It is not currently possible to integrate with them both.