Forum Discussion
beepboop
Sep 09, 2021Copper Contributor
Add a Channel mention to an adaptive card
All,
Using the beta version of the API, with the help of the documentation, I'm able to use graph to send a team mention to a channel and I'm also able to send an adaptive card to a channel but I can't send a team mention to a channel in an adaptive card, any help?
{
"importance": "high",
"subject": "This is a mention",
"body":
{
"contentType": "html",
"content": "Text goes here. <br/> <at id ='0'></at> <br/><br/>"
} ,
"mentions": [
{
"id": 0,
"mentionText": "test",
"mentioned": {
"conversation": {
"id": "",
"displayName": "test",
"conversationIdentityType": "team"
}
}
}
]
}
{
"subject": null,
"body": {
"contentType": "html",
"content": "<attachment id=" + randomKey + "></attachment>"
},
"attachments": [{
"id": randomKey,
"contentType": "application/vnd.microsoft.card.thumbnail",
"contentUrl": null,
"content": {
"title": "Test title",
"text": "textgoes here",
"buttons": [{
"type": "openUrl",
"title": "Button",
"value": "https://microsoft.com"
},
{
"type": "openUrl",
"title": "Button2",
"value": "https://google.com"
}
]},
"name": null,
"thumbnailUrl": null
}]
}
- ChetanSharma-msft
Microsoft
beepboop - Could you please share the error log details for your issue.- beepboopCopper Contributor
I've attempted to build a JSON script to perform this action:
{ "importance":"high", "subject":"This is a mention", "body":{ "contentType":"html", "content":"Text goes here. <br/> <at id ='0'></at> <br/><br/>" }, "mentions":[ { "id":0, "mentionText":"", "mentioned":{ "conversation":{ "id":"0", "displayName":"teamName", "conversationIdentityType":"team" } } } ], "attachments":[ { "id":"randomKey", "contentType":"application/vnd.microsoft.card.thumbnail", "contentUrl":null, "content":{ "title":"Test title", "text":"textgoes here", "buttons":[ { "type":"openUrl", "title":"Button", "value":"https://microsoft.com" }, { "type":"openUrl", "title":"Button2", "value":"https://google.com" } ] }, "name":null, "thumbnailUrl":null } ] }
The error I receive is:
Method failed: (/beta/teams/) with code: 400
{"error":{"code":"BadRequest","message":"Invalid request body was sent.",
- ChetanSharma-msft
Microsoft
beepboop - Look like your JSON is invalid, could you please verify your JSON body & try it again.