# Watcher Microsoft teams webhook

**URL:** <https://discuss.elastic.co/t/watcher-microsoft-teams-webhook/203811>\
**Category:** Elasticsearch\
**Created:** [October 16, 2019, 10:16am UTC](https://discuss.elastic.co/t/watcher-microsoft-teams-webhook/203811 "2019-10-16T10:16:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wellerbar](https://avatars.discourse-cdn.com/v4/letter/w/a88e57/32.png) [@wellerbar](https://discuss.elastic.co/u/wellerbar)\
**Post date:** [October 16, 2019, 10:16am UTC](https://discuss.elastic.co/t/watcher-microsoft-teams-webhook/203811/1 "2019-10-16T10:16:56Z")

</div>

Hi,

I would like to send a notification to a Microsoft Teams webhook but I don't understand why this isn't workin, can someone help me please?

Here is my watch :

```
{
  "trigger": {
    "schedule": {
      "interval": "2m"
    }
  },
  "input": {
    "simple": {
      "summary": "Test Nom",
      "text": "test"
    }
  },
  "condition": {
    "always": {}
  },
  "actions": {
    "MS_TEAMS": {
      "webhook": {
        "scheme": "https",
        "host": "outlook.office.com",
        "port": 443,
        "method": "post",
        "path": "/webhook/XYZ",
        "params": {},
        "headers": {
          "content-type": "application/json"
        },
        "body": "{{#toJson}}ctx.payload.summary{{/toJson}}"
      }
    }
  }
}

```

And here is the response :

```
{
  "watch_id": "629a6c2e-74df-41eb-b3b4-6a95af79d1e6",
  "node": "QUApyNq4S5GyhHF-CuNjfg",
  "state": "executed",
  "status": {
    "state": {
      "active": true,
      "timestamp": "2019-10-16T10:05:39.087Z"
    },
    "last_checked": "2019-10-16T10:15:14.954Z",
    "last_met_condition": "2019-10-16T10:15:14.954Z",
    "actions": {
      "MS_TEAMS": {
        "ack": {
          "timestamp": "2019-10-16T10:05:39.087Z",
          "state": "awaits_successful_execution"
        },
        "last_execution": {
          "timestamp": "2019-10-16T10:15:14.954Z",
          "successful": false,
          "reason": "received [400] status code"
        }
      }
    },
    "execution_state": "executed",
    "version": -1
  },
  "trigger_event": {
    "type": "schedule",
    "triggered_time": "2019-10-16T10:15:14.954Z",
    "schedule": {
      "scheduled_time": "2019-10-16T10:15:14.685Z"
    }
  },
  "input": {
    "simple": {
      "summary": "Test Nom",
      "text": "test"
    }
  },
  "condition": {
    "always": {}
  },
  "metadata": {
    "name": "testJsonALaMano",
    "xpack": {
      "type": "json"
    }
  },
  "result": {
    "execution_time": "2019-10-16T10:15:14.954Z",
    "execution_duration": 112,
    "input": {
      "type": "simple",
      "status": "success",
      "payload": {
        "summary": "Test Nom",
        "text": "test"
      }
    },
    "condition": {
      "type": "always",
      "status": "success",
      "met": true
    },
    "actions": [
      {
        "id": "MS_TEAMS",
        "type": "webhook",
        "status": "failure",
        "reason": "received [400] status code",
        "webhook": {
          "request": {
            "host": "outlook.office.com",
            "port": 443,
            "scheme": "https",
            "method": "post",
            "path": "/webhook/XYZ",
            "headers": {
              "content-type": "application/json"
            },
            "body": "Test Nom"
          },
          "response": {
            "status": 400,
            "headers": {
              "date": [
                "Wed, 16 Oct 2019 10:15:15 GMT"
              ],
              "content-length": [
                "49"
              ],
              "expires": [
                "-1"
              ],
              "x-beserver": [
                "VI1PR07MB5053"
              ],
              "x-aspnet-version": [
                "4.0.30319"
              ],
              "x-proxy-backendserverstatus": [
                "400"
              ],
              "x-cafeserver": [
                "VI1PR04CA0090.EURPRD04.PROD.OUTLOOK.COM"
              ],
              "x-calculatedbetarget": [
                "VI1PR07MB5053.eurprd07.prod.outlook.com"
              ],
              "request-id": [
                "75d18af1-1482-4fdb-9fd5-c86cb73a9475"
              ],
              "pragma": [
                "no-cache"
              ],
              "x-msedge-ref": [
                "Ref A: 400B2560B3794E4BBEE7C1503D62762A Ref B: PAR02EDGE0517 Ref C: 2019-10-16T10:15:15Z"
              ],
              "x-feserver": [
                "VI1PR04CA0090"
              ],
              "x-powered-by": [
                "ASP.NET"
              ],
              "x-backendhttpstatus": [
                "400"
              ],
              "content-type": [
                "text/plain; charset=utf-8"
              ],
              "cache-control": [
                "no-cache"
              ]
            },
            "body": "Bad payload received by generic incoming webhook."
          }
        }
      }
    ]
  },
  "messages": []
}
```

---

<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:** [October 16, 2019, 12:53pm UTC](https://discuss.elastic.co/t/watcher-microsoft-teams-webhook/203811/2 "2019-10-16T12:53:30Z")

</div>

The error message is returned by the endpoint, and it seems the format is not the desired one, so you may want to check the required format of the endpoint you are hitting.

Also, please do not open a second thread, when the first thread is not finished. This is a voluntarily driven forum and does not come with any SLAs, if you need something like that, go ahead and open a support issue.

Thank you!

---

<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 13, 2019, 12:53pm UTC](https://discuss.elastic.co/t/watcher-microsoft-teams-webhook/203811/3 "2019-11-13T12:53:42Z")

</div>

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