# MS teams alerts not getting triggered

**URL:** <https://discuss.elastic.co/t/ms-teams-alerts-not-getting-triggered/202767>\
**Category:** Kibana\
**Created:** [October 9, 2019, 6:32am UTC](https://discuss.elastic.co/t/ms-teams-alerts-not-getting-triggered/202767 "2019-10-09T06:32:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sumit\_Kumar1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sumit_kumar1/32/43471_2.png) [@Sumit\_Kumar1](https://discuss.elastic.co/u/Sumit_Kumar1)\
**Post date:** [October 9, 2019, 6:32am UTC](https://discuss.elastic.co/t/ms-teams-alerts-not-getting-triggered/202767/1 "2019-10-09T06:32:52Z")

</div>

MS teams alerts not getting triggered .

I am sharing my configuration .

{  
"trigger": {  
"schedule": {  
"interval": "1m"  
}  
},  
"input": {  
"search": {  
"request": {  
"search\_type": "query\_then\_fetch",  
"indices": [  
"xg\_elastalert\_status\_write\_error"  
],  
"types": ,  
"body": {  
"query": {  
"bool": {  
"must": [  
{  
"bool": {  
"should": [  
{  
"match": {  
"\_type": "elastalert\_error"  
}  
}  
]  
}  
},  
{  
"range": {  
"@timestamp": {  
"gte": "now-100m"  
}  
}  
}  
]  
}  
}  
}  
}  
}  
},  
"condition": {  
"compare": {  
"ctx.payload.hits.total": {  
"gt": 0  
}  
}  
},  
"actions": {  
"send\_email": {  
"email": {  
"profile": "standard",  
"to": [  
"sumitkumar.singh@in.imshealth.com"  
],  
"subject": "Elastalert Failure {{ctx.payload.hits.hits.0.\_source.@timestamp}}",  
"body": {  
"text": "Failure Message : {{ctx.payload.hits.hits.0.\_source.message}}\n Message: {{ctx.payload.hits.hits.0.\_source.message}}\n"  
}  
}  
},  
"MS\_Teams": {  
"webhook": {  
"scheme": "https",  
"host": "[outlook.office.com](http://outlook.office.com)",  
"port": 443,  
"method": "post",  
"path": "/webhook/b382dfec-3a3b-42d8-937f-89230bac95ad@5989ece0-f90e-40bf-9c79-1a7beccdb861/IncomingWebhook/3167e19281ee424285fe1ad3c0992f88/149a0b7b-ff63-48c1-ba38-1dee90dc2c12",  
"params": {},  
"headers": {},  
"body": "t"  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![Sumit\_Kumar1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sumit_kumar1/32/43471_2.png) [@Sumit\_Kumar1](https://discuss.elastic.co/u/Sumit_Kumar1)\
**Post date:** [October 9, 2019, 9:23am UTC](https://discuss.elastic.co/t/ms-teams-alerts-not-getting-triggered/202767/2 "2019-10-09T09:23:20Z")

</div>

Hi i have resolved it . Now , it's working fine .

---

<div class="post-metadata">

**Author:** ![cjcenizal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cjcenizal/32/11216_2.png) [@cjcenizal](https://discuss.elastic.co/u/cjcenizal)\
**Post date:** [October 9, 2019, 6:39pm UTC](https://discuss.elastic.co/t/ms-teams-alerts-not-getting-triggered/202767/3 "2019-10-09T18:39:08Z")

</div>

Hi Sumit, thanks for letting us know. Would you mind sharing your solution?

---

<div class="post-metadata">

**Author:** ![Sumit\_Kumar1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sumit_kumar1/32/43471_2.png) [@Sumit\_Kumar1](https://discuss.elastic.co/u/Sumit_Kumar1)\
**Post date:** [October 12, 2019, 3:38pm UTC](https://discuss.elastic.co/t/ms-teams-alerts-not-getting-triggered/202767/4 "2019-10-12T15:38:34Z")

</div>

I have used transform then used that script as JSON in body .

```
  "MS_Teams": {
  "transform": {
    "script": {
      "source": "return ['text':'Found ' + ctx.payload.hits.total]",
      "lang": "painless"
    }
  },
  "webhook": {
    "scheme": "https",
    "host": "outlook.office.com",
    "port": 443,
    "method": "post",
    "path": "/webhook/b382dfec-3a3b-42d8-937f-89230bac95ad@5989ece0-f90e-40bf-9c79-1a7beccdb861/IncomingWebhook/3167e19281ee424285fe1ad3c0992f8",
    "params": {},
    "headers": {
      "Content-Type": "application/json"
    },
    "body": "{{#toJson}}ctx.payload{{/toJson}}"
  }
}
```

---

<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:** [November 9, 2019, 3:38pm UTC](https://discuss.elastic.co/t/ms-teams-alerts-not-getting-triggered/202767/5 "2019-11-09T15:38:35Z")

</div>

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