# Insert comment through Teams

**URL:** <https://community.dynatrace.com/t/insert-comment-through-teams/38780>\
**Category:** Automations\
**Tags:** integrations, problem-notification\
**Created:** [March 10, 2023, 12:26pm UTC](https://community.dynatrace.com/t/insert-comment-through-teams/38780 "2023-03-10T12:26:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Biaggio](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/biaggio/32/39499_2.png) [@Biaggio](https://community.dynatrace.com/u/Biaggio)\
**Post date:** [March 10, 2023, 12:26pm UTC](https://community.dynatrace.com/t/insert-comment-through-teams/38780/1 "2023-03-10T12:26:30Z")

</div>

Guys, does anyone know if it’s possible to insert a comment in my problem, through Teams? I’m calling the Dyna API, passing the body, but it’s not working. Has anyone ever done something like this?

 ![Biaggio_1-1678451130748.png](https://global.discourse-cdn.com/dynatrace/original/3X/d/c/dcd90dfc29d42ad541b681f61132735e09dba734.png)

 ![Biaggio_2-1678451151620.png](https://global.discourse-cdn.com/dynatrace/original/3X/c/a/ca34a8834f2e98276c280fa6f375a958f88ac709.png)

---

<div class="post-metadata">

**Author:** ![michiel\_otten](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/michiel_otten/32/21987_2.png) [@michiel\_otten](https://community.dynatrace.com/u/michiel_otten)\
**Post date:** [March 13, 2023, 9:50am UTC](https://community.dynatrace.com/t/insert-comment-through-teams/38780/2 "2023-03-13T09:50:07Z")

</div>

So a few things what you could try  
- adding a content type (application/json)  
- i’m not sure your posting a valid json in your body. Should be something like this:  
{ “message”: “string”, “context”: “string” }

---

<div class="post-metadata">

**Author:** ![radek\_jasinski](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/radek_jasinski/32/10432_2.png) [@radek\_jasinski](https://community.dynatrace.com/u/radek_jasinski)\
**Post date:** [March 13, 2023, 2:35pm UTC](https://community.dynatrace.com/t/insert-comment-through-teams/38780/3 "2023-03-13T14:35:55Z")

</div>

Hi,

I agree with Michiel. You should add:

- Content-Type: application/json
- “message”: “string”
- “context”: “string”

Like you can see here:&nbsp;[Problems API v2 - POST a comment — Dynatrace Docs](https://www.dynatrace.com/support/help/dynatrace-api/environment-api/problems-v2/comments/post-comment)

For example I add the correct curl below:

curl -X POST “{env\_id}/api/v2/problems/{problemID}/comments" -H “accept: \*/\*” -H “Authorization: Api-Token {token}” -H “Content-Type: application/json; charset=utf-8” -d “{\“message\”:\“Example Message\”,\“context\”:\“Community\”}”

 ![comment.png](https://global.discourse-cdn.com/dynatrace/original/2X/a/a5dc80ea642ff811b19ec290cafcb3b498a2893c.png)

---

<div class="post-metadata">

**Author:** ![Biaggio](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/biaggio/32/39499_2.png) [@Biaggio](https://community.dynatrace.com/u/Biaggio)\
**Post date:** [March 21, 2023, 9:52pm UTC](https://community.dynatrace.com/t/insert-comment-through-teams/38780/4 "2023-03-21T21:52:43Z")

</div>

I already tried that. The problem here is being configured in a way that Dynatrace understands that the content of my input is what should be sent. I’ve tried to pass the body in several ways. An example is below:

```markup
"body":"{\"message\":\"string\",\"context\":\"string\"}={{comment.value}}"

```

This is just an example, to show that you need to pass the

```markup
={{comment.value}}"

```

With the intention that it takes the input data entered in Teams and makes the post.

 ![Biaggio_2-1679435557826.png](https://global.discourse-cdn.com/dynatrace/original/2X/3/36d31aa8f85d9d3a8510e64429a4774c7209a543.png)

---

<div class="post-metadata">

**Author:** ![michiel\_otten](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/michiel_otten/32/21987_2.png) [@michiel\_otten](https://community.dynatrace.com/u/michiel_otten)\
**Post date:** [March 21, 2023, 11:34pm UTC](https://community.dynatrace.com/t/insert-comment-through-teams/38780/5 "2023-03-21T23:34:19Z")

</div>

Tested it out, this worked for me.

{  
“@type”: “MessageCard”,  
“summary”: “{PID}}”,  
“potentialAction”: [  
{  
“@type”: “ActionCard”,  
“name”: “Add a comment”,  
“inputs”: [  
{  
“@type”: “TextInput”,  
“id”: “note”,  
“isMultiline”: true,  
“title”: “Add note here…”  
}  
],  
“actions”: [  
{  
“@type”: “httpPost”,  
“method”:“POST”,  
“name”: “OK”,  
“title”: “Submit”,  
“headers”: [  
{  
“name”: “Authorization”,  
“value”: “”  
},  
{  
“name”: “Content-type”,  
“value”: “application/json”  
}  
],  
“target”: “https:\/\/[URL]\/e\/[ENVID]\/api\/v2\/problems\/[PID]\/comments?api-token=[API-TOKEN]”,  
“body”: “{\“message\”:\”{{note.value}}\“}”  
}  
]  
}  
]  
}

---

<div class="post-metadata">

**Author:** ![Biaggio](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/biaggio/32/39499_2.png) [@Biaggio](https://community.dynatrace.com/u/Biaggio)\
**Post date:** [April 18, 2023, 12:17am UTC](https://community.dynatrace.com/t/insert-comment-through-teams/38780/6 "2023-04-18T00:17:24Z")

</div>

Thank you very much. It worked.
