Forum Discussion
beepboop
Sep 09, 2021Copper Contributor
Add a Channel mention to an adaptive card
All, Using the beta version of the API, https://docs.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http, I'm able to use graph to send a team mention to a channel and I'...
ChetanSharma-msft
Microsoft
Sep 09, 2021beepboop - Could you please share the error log details for your issue.
- beepboopSep 10, 2021Copper 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-msftSep 11, 2021
Microsoft
beepboop - Look like your JSON is invalid, could you please verify your JSON body & try it again.- ChetanSharma-msftSep 11, 2021
Microsoft
beepboop - Look like you haven't added attachment reference in body section like below:
"body": {
"contentType": "html",
"content": "<attachment id=\"74d20c7f34aa4a7fb74e2b30004247c5\"></attachment>"
},
Because of it it's throwing error 400.