Forum Discussion
Navigate user to particular message in channel upon clicking a button in Personal Chat adaptive card
I am sending a message to the user using an Adaptive card. With the click of a button, I would like to redirect the user to a particular message in the channel. Is there any way we can achieve this?
AyeshaKulsumSJ -You can redirect User to particular channel using deep link.
You need to configure deep link URL with Adaptive Card button.Use this deep link format to navigate to a particular conversation within channel thread:
https://teams.microsoft.com/l/message/<channelId>/<parentMessageId>?tenantId=<tenantId>&groupId=<groupId>&parentMessageId=<parentMessageId>&teamName=<teamName>&channelName=<channelName>&createdTime=<createdTime>
Example:
https://teams.microsoft.com/l/message/<channelId>/1648741500652?tenantId=<tenantId>&groupId=<groupId>&parentMessageId=1648741500652&teamName=<teamName>&channelName=<channelName>&createdTime=1648741500652
Reference document-Create deep links - Teams | Microsoft Docs
Thanks,
Sayali
------------------------------------------------------------------------------------------
If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.
5 Replies
- Sayali-MSFT
Microsoft
AyeshaKulsumSJ -You can redirect User to particular channel using deep link.
You need to configure deep link URL with Adaptive Card button.Use this deep link format to navigate to a particular conversation within channel thread:
https://teams.microsoft.com/l/message/<channelId>/<parentMessageId>?tenantId=<tenantId>&groupId=<groupId>&parentMessageId=<parentMessageId>&teamName=<teamName>&channelName=<channelName>&createdTime=<createdTime>
Example:
https://teams.microsoft.com/l/message/<channelId>/1648741500652?tenantId=<tenantId>&groupId=<groupId>&parentMessageId=1648741500652&teamName=<teamName>&channelName=<channelName>&createdTime=1648741500652
Reference document-Create deep links - Teams | Microsoft Docs
Thanks,
Sayali
------------------------------------------------------------------------------------------
If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.
- AyeshaKulsumSJBrass Contributor
Are created time, teamName, and ChannelName mandatory as they can be changing? And already sent adaptive cards might not work. Can you help me with if there are any optional parameters here?
I had doubts if this is possible with message Id alone.
- Sayali-MSFT
Microsoft
AyeshaKulsumSJ - You can try like below snippest.No need to change channel name and teams name everytime.
if (turnContext.Activity.Conversation.ConversationType == "channel") { channelID = turnContext.Activity.Conversation.Id.Split(';')[0]; tabUrlTask1 = deeplinkHelper.GetDeepLinkToChannelTask(teamsUrl, _configuration["MicrosoftAppId"], _configuration["BaseURL"], channelID, _configuration["ChannelEntityId"], "bot1"); tabUrlTask2 = deeplinkHelper.GetDeepLinkToChannelTask(teamsUrl, _configuration["MicrosoftAppId"], _configuration["BaseURL"], channelID, _configuration["ChannelEntityId"], "bot2"); tabUrlTask3 = deeplinkHelper.GetDeepLinkToChannelTask(teamsUrl, _configuration["MicrosoftAppId"], _configuration["BaseURL"], channelID, _configuration["ChannelEntityId"], "bot3"); extendedDeepLink = deeplinkHelper.GetDeepLinkToChannelTask(teamsUrl, _configuration["MicrosoftAppId"], _configuration["BaseURL"], channelID, _configuration["ChannelEntityId"], ""); }
Here is sample related to deeplink.
Sample Link-OfficeDev/Microsoft-Teams-Samples: Welcome to the Microsoft Teams samples repository. Here you will find task-focused samples in C#, JavaScript and TypeScript to help you get started with the Microsoft Teams App! (github.com)
- Sayali-MSFT
Microsoft
AyeshaKulsumSJ- We are looking into this we will get back to you soon.