# Add a json in webhook body for teams

**URL:** <https://discuss.elastic.co/t/add-a-json-in-webhook-body-for-teams/132536>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [May 18, 2018, 8:16pm UTC](https://discuss.elastic.co/t/add-a-json-in-webhook-body-for-teams/132536 "2018-05-18T20:16:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastian\_Herrera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sebastian_herrera/32/53209_2.png) [@Sebastian\_Herrera](https://discuss.elastic.co/u/Sebastian_Herrera)\
**Post date:** [May 18, 2018, 8:16pm UTC](https://discuss.elastic.co/t/add-a-json-in-webhook-body-for-teams/132536/1 "2018-05-18T20:16:47Z")

</div>

Hello guys, i am trying to send alerts to a webhook that i have on my microsoft teams account. for that i need to add this on the webhook body

{  
"@context": "[http://schema.org/extensions](http://schema.org/extensions)",  
"@type": "MessageCard",  
"themeColor": "F00",  
"title": "Visit the Outlook Dev Portal",  
"text": "Click **Learn More** to learn more about Actionable Messages!"  
}

but when i add i am getting error. Any Help?

Regards

---

<div class="post-metadata">

**Author:** ![JKhondhu](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@JKhondhu](https://discuss.elastic.co/u/JKhondhu)\
**Post date:** [May 18, 2018, 10:21pm UTC](https://discuss.elastic.co/t/add-a-json-in-webhook-body-for-teams/132536/2 "2018-05-18T22:21:06Z")

</div>

Please share your elasticsearch.yml and the errors seen?

---

<div class="post-metadata">

**Author:** ![Sebastian\_Herrera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sebastian_herrera/32/53209_2.png) [@Sebastian\_Herrera](https://discuss.elastic.co/u/Sebastian_Herrera)\
**Post date:** [May 21, 2018, 12:59pm UTC](https://discuss.elastic.co/t/add-a-json-in-webhook-body-for-teams/132536/3 "2018-05-21T12:59:08Z")

</div>

"actions" : {  
"sendToTeamsWH" : {  
"webhook" : {  
"method" : "POST",  
"url" : "my url ",  
"body": {  
"@context": "[http://schema.org/extensions](http://schema.org/extensions)",  
"@type": "MessageCard",  
"themeColor": "F00",  
"title": "Visit the Outlook Dev Portal",  
"text": "Click **Learn More** to learn more about Actionable Messages!"  
}  
}  
}

and the error is that @context is not recogniced. Y add all the json in "" but it give me syntax error

---

<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:** [June 4, 2018, 12:48pm UTC](https://discuss.elastic.co/t/add-a-json-in-webhook-body-for-teams/132536/4 "2018-06-04T12:48:54Z")

</div>

the `body` field only allows for a string. This means you need to create the required data structure in a `transform` in the action and then use the `{{#toJson}}ctx.payload.however_you_named_it{{/toJson}}` mustache function to automatically convert that datastructure to JSON.

Hope this helps!

---

<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 2, 2018, 12:48pm UTC](https://discuss.elastic.co/t/add-a-json-in-webhook-body-for-teams/132536/5 "2018-07-02T12:48:55Z")

</div>

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