# Use Mustache template in SLACK

**URL:** <https://discuss.elastic.co/t/use-mustache-template-in-slack/60515>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [September 14, 2016, 2:43pm UTC](https://discuss.elastic.co/t/use-mustache-template-in-slack/60515 "2016-09-14T14:43:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmbtenorio](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@mmbtenorio](https://discuss.elastic.co/u/mmbtenorio)\
**Post date:** [September 14, 2016, 2:43pm UTC](https://discuss.elastic.co/t/use-mustache-template-in-slack/60515/1 "2016-09-14T14:43:06Z")

</div>

Hello!

I want to insert mustache template in my watch. I tried to use webhooks instead of slack but I'm always getting an error such as ConnectException, status:400, etc.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [September 14, 2016, 3:52pm UTC](https://discuss.elastic.co/t/use-mustache-template-in-slack/60515/2 "2016-09-14T15:52:27Z")

</div>

Hey,

can you please provide a complete reproducible example, the exact error message (from the watch history), log file excerpts, your elasticsearch configuration, the elasticsearch and java versions you are using.

just one sentence as a question will not suffice for an adequate reply other than "something is wrong" or "that might be a bug" or "must be your fault". None of those help 🙂

--Alex

---

<div class="post-metadata">

**Author:** ![mmbtenorio](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@mmbtenorio](https://discuss.elastic.co/u/mmbtenorio)\
**Post date:** [September 14, 2016, 5:25pm UTC](https://discuss.elastic.co/t/use-mustache-template-in-slack/60515/3 "2016-09-14T17:25:21Z")

</div>

Actually I didn't know how to explain. Sorry for that. I just wanna know how to insert mustache template in watcher, SLACK action.

By the way, thanks for the help, but I've already figured it out. I put it in the "text" field.

"notify-slack" : {  
"throttle\_period" : "5m",  
"slack" : {  
"account" : "monitoring",  
"message" : {  
"from" : "Test Watch",  
"text" : "Test Watch found some unexpected failures",  
"icon" : ":watcher:",  
"attachments" : [{  
"title" : "Test Watch",  
**"text" : "Found {{ctx.payload.hits.total}} SL On-boarding error(s) \n{{#ctx.payload.hits.hits}} ID = {{\_id}}, \nEnvironment = {{\_source.env}}, \nOrder Number = {{\_source.orderNumber}}, \nOrdering Country = {{\_source.orderingCountry}}\n\n {{/ctx.payload.hits.hits}}"**,  
"color" : "danger"

```
      }]
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:42pm UTC](https://discuss.elastic.co/t/use-mustache-template-in-slack/60515/4 "2017-07-06T13:42:56Z")

</div>


