DEV Community

Use adaptive cards with mention in Microsoft Teams

Kenichiro Nakamura on April 29, 2020

Adaptive Card is very flexible way to create rich card which I can send to many platform. One of the platform is Microsoft Teams. What's more inte...
Collapse
 
task4233 profile image
task4233

Hello.
I'd like to send the message which contains @mention with incoming webhook.

However, I couldn't make work @mention with 8:orgid:{org-ID-of-the-user}.
I consider the reason why I couldn't do was org-ID-of-the-user was too short, c57b6b553*******(16 digits), which is got with Graph Explorer(graph.microsoft.com/v1.0/me).

As I have no idea to solve this problem, I appreciate if you would let me know the solution.

Thanks in advance.

Collapse
 
kenakamu profile image
Kenichiro Nakamura

The user id is guid form one, which you can find from graph results.

for example, this is my result.

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
    "businessPhones": [
        "xxxx"
    ],
    "displayName": "Kenichiro Nakamura",
    "givenName": "Kenichiro",
    "jobTitle": "SR SOFTWARE ENGINEER",
    "mail": "xxxxx",
    "mobilePhone": "xxxx",
    "officeLocation": "xxxx",
    "preferredLanguage": null,
    "surname": "Nakamura",
    "userPrincipalName": "xxxxx",
    "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" <- This one
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
task4233 profile image
task4233

Thank you for replying.

This is my result with calling graph.microsoft.com/v1.0/me

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
    "displayName": "xxxx",
    "surname": "xx",
    "givenName": "xx",
    "id": "xxxxxxxxxxxxxxxx", <- This is too short, I think
    "userPrincipalName": "xxxxxxxxxxxxxxxxxx@yahoo.co.jp",
    "businessPhones": [],
    "jobTitle": null,
    "mail": null,
    "mobilePhone": null,
    "officeLocation": null,
    "preferredLanguage": null
}
Enter fullscreen mode Exit fullscreen mode

I think the format of id is a different to from yours.
Would you tell me why they are different if you know.

Thread Thread
 
kenakamu profile image
Kenichiro Nakamura

That's interesting which I don't have much idea. And you can query your info via graph.microsoft.com/v1.0/users/ ?

Thread Thread
 
task4233 profile image
task4233

Of cource!
However, it seems that the value is same...

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
    "value": [
        {
            "displayName": "xxxx",
            "surname": "xx",
            "givenName": "xx",
            "id": "xxxxxxxxxxxxxxxx",
            "userPrincipalName": "xxxxxxxxxxxxxxxx@yahoo.co.jp",
            "businessPhones": [],
            "jobTitle": null,
            "mail": null,
            "mobilePhone": null,
            "officeLocation": null,
            "preferredLanguage": null
        }
    ]
}
Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
kenakamu profile image
Kenichiro Nakamura

Then I assume that's your user id. Not sure why format is different. So if you create mention by using the id with 8:orgid:{org-ID-of-the-user} , nothing happens?

Collapse
 
cassavaexp profile image
Michael

Anyone still following along here I found that I could get the user Id option to work by dropping the 8:orgId: prefix. Hope that helps.

Collapse
 
kenakamu profile image
Kenichiro Nakamura

Thanks for your update!

Collapse
 
vladsmanolescu profile image
Vlad Manolescu

Hello i managed to to mention someone but that person is not alerted and when i hover over his name nothing happens as opposed to a manual mention. Any suggestions?

Collapse
 
kenakamu profile image
Kenichiro Nakamura

that's wired.. please check org id is correct.

Collapse
 
phoenixfangor profile image
phoenixfangor

I am also having this issue; I'm using what I know to be our organization's tenant id. Is the "org id" different?

Thread Thread
 
kenakamu profile image
Kenichiro Nakamura

It's not organization id but organization user id in mention.