Webhook.host doesn't translate ctx.metadata values

I have a multiple watches that perform a webhook action. I want to store the host in a ctx.metatdata field for flexibility in cases where the host may differ depending on installation parameters, but the {{ctx.metadata}} value isn't being translated on watch execution.

meta data look like this:

"metadata":
{
    "Host" : "myurl",
    "Authorization" : "myauth"
}

webhook like this:

    "webhook" :
      {
            "method" : "post",
            "scheme" : "https",
            "host" : "{{ctx.metadata.Host}}",
            "headers" : 
            {
                "Authorization": "Basic {{ctx.metadata.Authorization}}",
            },
       }

when the watch is executed I get this error

           "reason": "ElasticsearchException[Illegal character in authority at index 8: https://{{ctx.metadata.Host}}:443/rest/api/2/issue]; nested: URISyntaxException[Illegal character in authority at index 8: https://{{ctx.metadata.Host}}:443/rest/api/2/issue]; "

When host is hard coded everything works. The ctx.metadata.Authorization translation in the "headers" section occurs as expected so I can only assume the webhook.host field doesn't support ctx.metadata values. Can anyone confirm, or provide an alternative.

I'm using Elasticsearch version 2.1.2

Hey,

you are right. The host is not templatable right now, header, params and body are however. I do not have any alternative on top of my head right now, but we could make this templatable in the future.

--Alex

We would definitely use it. Where in the documentation could I have found this information? I looked around, but didn't find it.

Hey,

the webhook action attributes table lists which fields support templates

--Alex

Thanks -- I see the information now. When considering adding additional templating please include host port and scheme

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.