Custom webhook params documentation for `Create Destination` api

#1

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

Currently the create destination api docs 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!

#2

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
}
}’

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"
 }
 }'
#3

Thanks Vamshin,

That worked!