Thank you for sharing the article. The last method mentioned in that blog was in line with my requirement. Unfortunately, the mention (for channel and user) was not working in the output:
It could've been a miss from my end, but the usage of graph API gave me the idea to use same to include both a message and an adaptive card together in the chat (which is what I needed in the first place). So below code is working fine for me so far (body of the graph API request):
{
"subject": "Adaptive Cards test",
"body": {
"contentType": "html",
"content": "<p><at id=\"1\">Gen</at> - Please join me in congratulating <at id=\"0\">Robin Roy</at></p><attachment id=\"d9ca1229-c4bf-48d1-b43a-4e54f5e42e39\"></attachment>"
},
"attachments": [
{
"id": "d9ca1229-c4bf-48d1-b43a-4e54f5e42e39",
"contentType": "application/vnd.microsoft.card.adaptive",
"contentUrl": null,
"content": "{\r\n \"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\",\r\n \"type\": \"AdaptiveCard\",\r\n \"version\": \"1.6\",\r\n \"body\": [\r\n {\r\n \"type\": \"TextBlock\",\r\n \"id\": \"MentionTextBlock\",\r\n \"text\": \"Fun with mentions!\",\r\n \"weight\": \"Bolder\",\r\n \"size\": \"Medium\"\r\n },\r\n {\r\n \"type\": \"TextBlock\",\r\n \"text\": \"This is user mention. Hi: <at id=\\\"0\\\">Robin Roy</at>!\",\r\n \"size\": \"Medium\"\r\n },\r\n {\r\n \"type\": \"TextBlock\",\r\n \"text\": \"This is channel mention. Hello: <at id=\\\"1\\\">Gen</at>!\",\r\n \"size\": \"Medium\"\r\n } \r\n ]\r\n}",
"name": null,
"thumbnailUrl": null
}
],
"mentions": [
{
"id": 0,
"mentionText": "Robin Roy",
"mentioned": {
"user": {
"id": "User ID",
"displayName": "Robin Roy",
"userIdentityType": "aadUser"
}
}
},
{
"id": 1,
"mentionText": "Gen",
"mentioned": {
"conversation": {
"id": "Channel ID",
"displayName": "Gen",
"conversationIdentityType": "channel"
}
}
}
]
}
Graph endpoint - POST /teams/{team-id}/channels/{channel-id}/messages
Output of request: