# Formatting mustache for MS-Teams webhook

**URL:** <https://forum.opensearch.org/t/formatting-mustache-for-ms-teams-webhook/4099>\
**Category:** Alerting\
**Created:** [November 3, 2020, 5:48pm UTC](https://forum.opensearch.org/t/formatting-mustache-for-ms-teams-webhook/4099 "2020-11-03T17:48:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![H1PpoN](https://avatars.discourse-cdn.com/v4/letter/h/51bf81/32.png) [@H1PpoN](https://forum.opensearch.org/u/H1PpoN)\
**Post date:** [November 3, 2020, 5:48pm UTC](https://forum.opensearch.org/t/formatting-mustache-for-ms-teams-webhook/4099/1 "2020-11-03T17:48:58Z")

</div>

Hello,  
Was using Opendistro alerting to send alerts to Slack using webhook.  
I’m trying to setup the same webhook for MS-Teams, but something fails in the message format i’m trying to send.

Here is an example of what i’m sending to Slack:

{{#ctx.results}}  
{{#aggregations.serial.buckets}}  
{“serial”: “{{key}}”, “platform”: “{{#platform.buckets}}{{key}}{{/platform.buckets}}”, {{#version.buckets}}“version”: “{{key}}”, “count”: “{{doc\_count}}”{{/version.buckets}}}  
{{/aggregations.serial.buckets}}  
{{/ctx.results}}

This would create for me a list like that:

{“serial”: “_ **", “platform”: "** _”, “version”: “3.5.31”, “count”: “8”}  
{“serial”: “_ **", “platform”: "** _”, “version”: “3.5.30”, “count”: “7”}  
{“serial”: “_ **", “platform”: "**.05", “version”: “3.5.25”, “count”: “6”}  
{“serial”: "_ **", “platform”: "**.05”, “version”: “3.5.25”, “count”: “6”}  
{“serial”: “\ ***", “platform”: "** ”, “version”: “3.5.30”, “count”: “5”}

I would very much want to keep this list format also when sending it to Teams, but the message  
fails to arrive, something with Teams blocking the message for formatting.

any idea how can i keep this list format and to be able sending it to Teams?

---

<div class="post-metadata">

**Author:** ![H1PpoN](https://avatars.discourse-cdn.com/v4/letter/h/51bf81/32.png) [@H1PpoN](https://forum.opensearch.org/u/H1PpoN)\
**Post date:** [November 4, 2020, 4:01pm UTC](https://forum.opensearch.org/t/formatting-mustache-for-ms-teams-webhook/4099/2 "2020-11-04T16:01:10Z")

</div>

issue solved by myself - i had to escaped the double quotes i had inside the message with backslash  
so it will look like this :

{text: “{{#ctx.results}}  
{{#aggregations.serial.buckets}}  
{\“serial\”: \“{{key}}\”, \“platform\”: \“{{#platform.buckets}}{{key}}{{/platform.buckets}}\”, {{#version.buckets}}\“version\”: \“{{key}}\”, \“count\”: \“{{doc\_count}}\”{{/version.buckets}}}  
{{/aggregations.serial.buckets}}  
{{/ctx.results}}”}

that way it worked.

---

<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 16, 2020, 10:28pm UTC](https://forum.opensearch.org/t/formatting-mustache-for-ms-teams-webhook/4099/3 "2020-11-16T22:28:45Z")

</div>


