Forum Discussion
deep link to teams channel tab using entityId
Hi,
I a have deep link navigation issue - I am simply trying to navigate to a channel tab in Teams.
Here is the tab information, according to Graph API:
{
"id": "7e8e4ab6-288b-434c-9959-d9c89dc49913",
"displayName": "Fable",
"webUrl": "https://teams.microsoft.com/l/entity/[removed for brevity]",
"configuration": {
"entityId": "club-54112bf5-f765-4f6a-9c67-27e281921638",
"contentUrl": "https://[redacted]/club?channel=19:c1e4970eb1a9479aac1c0b4168ce5e9a@thread.tacv2",
"removeUrl": null,
"websiteUrl": "https://[redacted]/club",
"dateAdded": "2024-01-16T23:06:24.163Z"
}
}
I use the entityId above to navigate to the tab as follows:
function createTeamsAppLink(params) {
const url = new URL(
'https://teams.microsoft.com/l/entity/' +
encodeURIComponent(params.appId) +
'/' +
encodeURIComponent(params.pageId),
);
if (params.webUrl) {
url.searchParams.append('webUrl', params.webUrl);
}
if (params.channelId || params.subPageId) {
url.searchParams.append('context', JSON.stringify({ channelId: params.channelId, subEntityId: params.subPageId }));
}
return url.toString();
}
const url = createTeamsAppLink({
pageId:'club-54112bf5-f765-4f6a-9c67-27e281921638',
appId: '24d6d825-3472-47c3-a81a-6a88b90322f5',
channelId: '19:c1e4970eb1a9479aac1c0b4168ce5e9a@thread.tacv2'}
)
microsoftTeams.executeDeepLink(url);
The above code navigates me to the correct channel but it does not open my app tab (it opens the default tab for the channel).
If I replace pageId above with either of the following values, the navigation to my channel tab works perfectly:
pageId: '_djb2_msteams_prefix_223818790' or
pageId: '_djb2_msteams_prefix_7e8e4ab6-288b-434c-9959-d9c89dc49913'
However I don't think I am able to access the internal tab ID without elevated Graph permissions (in my application I am trying to use minimal permissions). According to the docs, the entityId I used when creating the tab should work for deep links, so I am puzzled why it is not working for me.
Thanks for any help!
- Thanks for your reply. I think that in the end, the problem was that there were two apps installed with the same ID. After removing one of them, deep linking worked.
- ChetanSharma-msftMicrosoftHello @ keithfable - Thanks for raising your query.
Whenever we create the tab personal/configurable, we can configure the entity id.
For configurable tab, one way to get the page id or subPageId from tab context.
Reference doc: https://learn.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/access-teams-context?tabs=Json-v2%2Cteamsjs-v2%2Cdefault#get-context-by-using-the-microsoft-teams-javascript-library
You can also refer this sample: https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/tab-deeplink/nodejs/Bots/DeepLinkTabsnode.js- keithfableBrass ContributorThanks for your reply. I think that in the end, the problem was that there were two apps installed with the same ID. After removing one of them, deep linking worked.