This is the second article in my "Building a Microsoft Teams Bot" series. In
this series, I am planning to write down some interesting things I came across
while creating a Microsoft Teams Bot app which is now available on
AppSource: https://appsource.microsoft.com/en-us/product/office/WA200002297
Click here to see the previous article in the series: Building a Microsoft Teams Bot: Posting an Adaptive Card carousel as a
welcome message
Todays article is around how to create deep links to teams messages from
Adaptive cards. This can be useful in scenarios when you want to send users to
a specific Teams chat message when they click on an Adaptive Card button:
If you are building the deep link manually, it can be grabbed from the
"Copy link" button from the ellipsis menu in a Teams message:
Deep links to personal chats are in a different format compared to channel
messages.
For Teams messages, the deep link format is:
https://teams.microsoft.com/l/message/{ChannelId}/{messageId}
For personal chats, the deep link format is:
https://teams.microsoft.com/l/message/19:{userAadObjectId}_{botId}@unq.gbl.spaces/{messageId}?context=%7B%22contextType%22:%22chat%22%7D
For bots and messaging extensions, this deep link can be built from parts of
the payload sent to the Bot from the Teams platform when the bot is invoked:
Once you have the desired deep link, the next step is to assign it as the URI
to an Adaptive Card button:
And that's it! Now you can easily add buttons to your adaptive cards which
take the user to specific messages in Teams personal chats or channels.
Hope
this was helpful!
No comments:
Post a Comment