# Please provide script for sections under msteams configuration watcher

**URL:** <https://discuss.elastic.co/t/please-provide-script-for-sections-under-msteams-configuration-watcher/218126>\
**Category:** Kibana\
**Created:** [February 6, 2020, 9:12am UTC](https://discuss.elastic.co/t/please-provide-script-for-sections-under-msteams-configuration-watcher/218126 "2020-02-06T09:12:03Z")\
**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:** [February 6, 2020, 9:12am UTC](https://discuss.elastic.co/t/please-provide-script-for-sections-under-msteams-configuration-watcher/218126/1 "2020-02-06T09:12:04Z")

</div>

I want alerts in a tabular format in MS Teams , I am providing a snippet for adding sections in the body . Please, help me know where i am making mistake .

```
 "MS_Teams": {
  "transform": {
    "script": {
      "source": "return ['title': 'Failure at timestamp :'+ ctx.payload.hits.hits.0._source.eventTimestamp, 'sections': [{ 'facts': [ { 'name': 'Service Incident:', 'value': 'ID' }] } ] ]",
      "lang": "painless"
    }
  }
```

---

<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:** [February 10, 2020, 6:05am UTC](https://discuss.elastic.co/t/please-provide-script-for-sections-under-msteams-configuration-watcher/218126/2 "2020-02-10T06:05:36Z")

</div>

I have resolved it .

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 10, 2020, 6:14am UTC](https://discuss.elastic.co/t/please-provide-script-for-sections-under-msteams-configuration-watcher/218126/3 "2020-02-10T06:14:42Z")

</div>

Please share the solution in the thread, it might help someone in future 🙂

---

<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:** [February 10, 2020, 6:57am UTC](https://discuss.elastic.co/t/please-provide-script-for-sections-under-msteams-configuration-watcher/218126/4 "2020-02-10T06:57:39Z")

</div>

```
    "MS_Teams": {
  "webhook": {
    "scheme": "https",
    "host": "outlook.office.com",
    "port": 443,
    "method": "post",
    "path": "/webhook/141b6cf0-7568-4013-872a-3e4c0af99f00@5989ece0-f90e-40bf-9c79-1a7beccdb861/IncomingWebhook/4f931fbe4e26a52fb293642f086c/bd2a812e-0995-47dd",
    "params": {},
    "headers": {
      "Content-type": "application/json"
    },
    "body": "{ \"summary\":\"Failure At timestamp: {{ctx.payload.hits.hits.0._source.eventTimestamp}}\", \"sections\":[{ \"activityTitle\":\"Timestamp : {{ctx.payload.hits.hits.0._source.eventTimestamp}}\" }, { \"title\":\"Details of failure:\", \"facts\":[ { \"name\":\"Event Level\", \"value\":\"{{ctx.payload.hits.hits.0._source.eventLevel}}\"}, { \"name\":\"Event Description\", \"value\":\"{{ctx.payload.hits.hits.0._source.eventDescription}}\" }, { \"name\":\"Component Lifecycle\", \"value\":\"{{ctx.payload.hits.hits.0._source.componentLifecycle}}\" }, { \"name\":\"Country Scope\", \"value\":\"countryScope\" }] } ] }"
  }
}

```

It will provide alerts in tabular format .

---

<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:** [March 9, 2020, 6:57am UTC](https://discuss.elastic.co/t/please-provide-script-for-sections-under-msteams-configuration-watcher/218126/5 "2020-03-09T06:57:47Z")

</div>

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