Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve Teams User ID based on AAD ID

I am trying to start a scheduled proactive conversation (the bot initiates the conversation on scheduled time). I managed to get the User's AAD ID based on Graph API, but it doesn't match the Teams user ID. Tried for over 2 hours to obtain the right id, but I can't figure it out how. What would be the best approach I should take?

like image 584
AlinP25 Avatar asked Nov 07 '22 08:11

AlinP25


1 Answers

Have a look at the Microsoft Graph api to get the chat thread ID.

When the app is installed for the user, the bot will get receive a conversationUpdate event that will contain the necessary information for it to send the proactive message. For more information, see Bot events.

If you lose the chatThreadId, you can find it again by calling:

GET /users/{user-id}/chats?$filter=installedApps/any(a:a/teamsApp/id eq '{teamsAppid}')

However, this will only for for the personal scope! My advice would be to make sure you catch the conversationUpdate which is triggered after an install and persist the user details in a database.

like image 184
Mick Avatar answered Nov 18 '22 09:11

Mick