# Custom webhook params documentation for \`Create Destination\` api

**URL:** <https://forum.opensearch.org/t/custom-webhook-params-documentation-for-create-destination-api/538>\
**Category:** Alerting\
**Created:** [April 27, 2019, 12:55am UTC](https://forum.opensearch.org/t/custom-webhook-params-documentation-for-create-destination-api/538 "2019-04-27T00:55:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![shah](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/shah/32/150_2.png) [@shah](https://forum.opensearch.org/u/shah)\
**Post date:** [April 27, 2019, 12:55am UTC](https://forum.opensearch.org/t/custom-webhook-params-documentation-for-create-destination-api/538/1 "2019-04-27T00:55:16Z")

</div>

For custom webhooks, you must specify more information: parameters, authentication, and headers.

Currently the [create destination api docs](https://opendistro.github.io/for-elasticsearch-docs/docs/alerting/api/#create-destination) only provide examples for `slack`.

What are the params we need to pass in to the api call to create custom webhooks?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![vamshin](https://avatars.discourse-cdn.com/v4/letter/v/c5a1d2/32.png) [@vamshin](https://forum.opensearch.org/u/vamshin)\
**Post date:** [April 27, 2019, 6:57pm UTC](https://forum.opensearch.org/t/custom-webhook-params-documentation-for-create-destination-api/538/2 "2019-04-27T18:57:18Z")

</div>

Hi Shah,

For custom webhook, there are 2 options.

Option1:- You can embed everything into the Url (host, port, params)  
Option2 :- You can input respective fields.

**Example Api call with custom webhook with option 1**

> curl -X POST localhost:9200/\_opendistro/\_alerting/destinations -H ‘Content-Type: application/json’ -d ’  
> {  
> “name”: “custom with everythign in url”,  
> “type”: “custom\_webhook”,  
> “custom\_webhook”: {  
> “url”: “[https://hooks.chime.aws/incomingwebhooks/383c0e2b-d028-44f4-8d38-XXXXXX?token=R2x1UlN4ZHF8MXxxVFJpelJNVDgzdGNwMnVRenJwRFBHUkR0NlhROWhXOVVTZXXXXXXXXX](https://hooks.chime.aws/incomingwebhooks/383c0e2b-d028-44f4-8d38-XXXXXX?token=R2x1UlN4ZHF8MXxxVFJpelJNVDgzdGNwMnVRenJwRFBHUkR0NlhROWhXOVVTZXXXXXXXXX)”  
> }  
> }’

**Example Api call with custom webhook with option 2**

```
curl -X POST localhost:9200/_opendistro/_alerting/destinations -H 'Content-Type: application/json' -d '
{
 "type" : "custom_webhook",
 "name" : "custom chime",
 "custom_webhook" : {
   "path" : "incomingwebhooks/383c0e2b-d028-44f4-8d38-696754bXXXXXX",
   "header_params" : {
     "Content-Type" : "application/json"
   },
   "scheme" : "HTTPS",
   "port" : 443,
   "query_params" : {
     "token" : "R2x1UlN4ZHF8MXxxVFJpelJNVDgzdGNwMnVRenJwRFBHUkR0NlhROWhXOVVTZXpXXXXX"
   },
   "host" : "hooks.chime.aws"
 }
 }'

```

---

<div class="post-metadata">

**Author:** ![shah](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/shah/32/150_2.png) [@shah](https://forum.opensearch.org/u/shah)\
**Post date:** [April 30, 2019, 5:14pm UTC](https://forum.opensearch.org/t/custom-webhook-params-documentation-for-create-destination-api/538/3 "2019-04-30T17:14:28Z")

</div>

Thanks Vamshin,

That worked!

---

<div class="post-metadata">

**Author:** ![Swaps](https://avatars.discourse-cdn.com/v4/letter/s/c67d28/32.png) [@Swaps](https://forum.opensearch.org/u/Swaps)\
**Post date:** [July 1, 2019, 6:41pm UTC](https://forum.opensearch.org/t/custom-webhook-params-documentation-for-create-destination-api/538/4 "2019-07-01T18:41:09Z")

</div>

Hi - could you provide some clarification on above. I am trying to set up a custom webhook for Pager Duty from Kibana UI - note this is an elasticsearch domain running in AWS for which the Alerting feature was available recently, and AWS direct us to Opendistro for further info.

In Alerting - Destinations - ‘Edit Destination’, I can either;

- define endpoint by URL
- Define endpoint by custom attributes URL

How would I compose the webhook URL needed in the ‘define endpoint by url’ field? I can send a test event using;

curl -H “Content-type: application/json” -X POST [https://events.pagerduty.com/generic/2010-04-15/create\_event.json](https://events.pagerduty.com/generic/2010-04-15/create_event.json) -d ‘{ “service\_key”: “”, “event\_type”: “trigger”, “description”: “pd-test” }’

However what is the structure of the Webhook URL?

Thank you!

Swapna

---

<div class="post-metadata">

**Author:** ![vamshin](https://avatars.discourse-cdn.com/v4/letter/v/c5a1d2/32.png) [@vamshin](https://forum.opensearch.org/u/vamshin)\
**Post date:** [July 11, 2019, 7:26pm UTC](https://forum.opensearch.org/t/custom-webhook-params-documentation-for-create-destination-api/538/5 "2019-07-11T19:26:11Z")

</div>

Hi Swapna,

In url portion, you should provide

> [https://events.pagerduty.com/generic/2010-04-15/create\_event.json](https://events.pagerduty.com/generic/2010-04-15/create_event.json)

and in message body of action, you should provide

> { “service\_key”: “”, “event\_type”: “trigger”, “description”: “pd-test” }

---

<div class="post-metadata">

**Author:** ![Swaps](https://avatars.discourse-cdn.com/v4/letter/s/c67d28/32.png) [@Swaps](https://forum.opensearch.org/u/Swaps)\
**Post date:** [July 16, 2019, 8:14am UTC](https://forum.opensearch.org/t/custom-webhook-params-documentation-for-create-destination-api/538/6 "2019-07-16T08:14:56Z")

</div>

Hi @vamshin,

Thank you for responding - I have done as you have said;

URL portion of webhook;

 ![15](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/1X/c58373c4dc5391cb05aee6a2f0621aa9b42b6a2e.png)

For the ‘in message body of action’ part - can you tell me where to enter this in the Kibana UI? The only place I can see ‘actions’ are within the trigger of the monitor, where you can edit the ‘message’ - is this correct?

 ![39](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/1X/2b71cda024c63a1c1cce0c0418cc662acfec0288.png)

I have removed the default ctx templates and replaced with ‘{ “service\_key”: “”, “event\_type”: “trigger”, “description”: “pd-test” }’. I have then run the ‘Send test message’, observing the results using developer tools - network in chrome. When I run this using AWS SNS (which is an integrated destination) it works, however using ^this method I get;

“output”:{},“throttled”:false,“error”:"java.io.IOException: Failed: HttpResponseProxy{HTTP/1.1 400 Bad Request

Please can you advise where I need to enter the parameters in the Kibana UI?

---

<div class="post-metadata">

**Author:** ![dbbaughe](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dbbaughe](https://forum.opensearch.org/u/dbbaughe)\
**Post date:** [July 16, 2019, 6:28pm UTC](https://forum.opensearch.org/t/custom-webhook-params-documentation-for-create-destination-api/538/7 "2019-07-16T18:28:48Z")

</div>

Hi @Swaps,

I responded to your question on the other thread:

> [@Pager Duty Custom Webhook - Destination](https://forum.opensearch.org/t/pager-duty-custom-webhook-destination/1088/7):
>
> Hi @Swaps, I created a test PD account and was able to publish an alert in this way: One thing to note, I was getting a similar 400 error until I removed the single quotes I had around the action message body. Let me know if this helps! Drew

---

<div class="post-metadata">

**Author:** ![skkosuri-amzn](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/skkosuri-amzn/32/935_2.png) [@skkosuri-amzn](https://forum.opensearch.org/u/skkosuri-amzn)\
**Post date:** [November 28, 2020, 10:10pm UTC](https://forum.opensearch.org/t/custom-webhook-params-documentation-for-create-destination-api/538/8 "2020-11-28T22:10:09Z")

</div>

Closed on November 28, 2020, 10:10pm UTC


