MicrosoftDocs / msteams-docs

Source for the Microsoft Teams developer platform documentation.
https://aka.ms/teamsdev
Creative Commons Attribution 4.0 International
284 stars 506 forks source link

Deeplink of submitted teams app doesn't work since 02/18/2019 #462

Closed CedricOettel closed 5 years ago

CedricOettel commented 5 years ago

Regarding the documentation at https://github.com/MicrosoftDocs/msteams-docs/blob/master/msteams-platform/concepts/deep-links.md we created an app that posts MessageCards with deep link to a configurable tab.

It worked and also the app was submitted, reviewed and published in AppSource. But since yesterday or maybe a Friday the Deeplinks already created in the MessageCards don't Redirect to the tab but they Redirect to the app info overview page.

When getting the tab deep link manually "Copy link to tab" i recognized, that the url structure changed. Did the entity url change and the documentation is old or is this a Teams Client issue?

New structure doesn't contain "/entity/< custom teams App Id >/< tab entityId >?":

https://teams.microsoft.com/l/entity/1a79dfa6-b77b-4700-adcf-dd48e1cde774/_djb2_msteams_prefix_545714726?

Our app generates the following structure by adding app id and tab entitty id: https://teams.microsoft.com/l/entity/78eeedc5-f719-4f92-8f55-ddc3c52c6a0d/NewsTab_19%3a1574c127974f426dba712174858e10bd%40thread.skype

Gousia-Begum commented 5 years ago

@CedricOettel - We have tried creating a deep link to configurable tab and there is no change in the URL structure which is documented. https://teams.microsoft.com/l/entity/<appId>/<entityId>?webUrl=<entityWebUrl>&label=<entityLabel>&context=<context>

Are you also specifying channelId in context parameter? Could you please share the complete link with context?

CedricOettel commented 5 years ago

The following Url ist generated and worked 2 weeks ago: https://teams.microsoft.com/l/entity/78eeedc5-f719-4f92-8f55-ddc3c52c6a0d/NewsTab3_19%3a1574c127974f426dba712174858e10bd%40thread.skype?webUrl=https%3a%2f%2fnewsService%2fcontent%2fnews%2farticle%2f5c5016e60a09a26e2842551a&label=News&context=%7b+%22subEntityId%22%3a+%225c5016e60a09a26e2842551a%22%2c+%22canvasUrl%22%3a+%22https%3a%2f%2fnewsService-teams-app.azurewebsite.net%2fpublic%2ftabs%2fNewsTab.aspx%22%2c+%22channelId%22%3a%2219%3a1574c127974f426dba712174858e10bd%40thread.skype%22+%7d&tenantId=99fb0996-d5ad-4730-8ddf-116d3fcc2532

In the WebClient i'm seeing the following error, when Pressing the MessageCard Button with that url:
UserAppsStore: Error launching the app id provided, app not found in store. appId: 78eeedc5-f719-4f92-8f55-ddc3c52c6a0d

But this app id, is exactly the id in the manifest and the id of the app, that was just released in AppSource few days ago.

Gousia-Begum commented 5 years ago

@CedricOettel -Could you please try removing the tenantid from the deep link and running it. We have tried doing it and it worked for us.

CedricOettel commented 5 years ago

I tried it today, but got the same result. @Gousia-MSFT Is there any support contact for that issue?

billbliss commented 5 years ago

We looked at it under the debugger and I think the problem is that the embedded spaces in your JSON are URL encoded as + symbols. When decoded you can see them:

https://teams.microsoft.com/l/entity/78eeedc5-f719-4f92-8f55-ddc3c52c6a0d/NewsTab3_19:1574c127974f426dba712174858e10bd@thread.skype?webUrl=https://newsService/content/news/article/5c5016e60a09a26e2842551a&label=News&context={ "subEntityId": "5c5016e60a09a26e2842551a", "canvasUrl": "https://newsService-teams-app.azurewebsite.net/public/tabs/NewsTab.aspx", "channelId":"19:1574c127974f426dba712174858e10bd@thread.skype" }&tenantId=99fb0996-d5ad-4730-8ddf-116d3fcc2532

Does it work if you strip the embedded spaces in the context JSON object before URL encoding it? (E.g. JSON.stringify() ).

CedricOettel commented 5 years ago

@billbliss That indead was an issue, but another one was also there. With your hint i finally found the code that is parsing and executing the routing command.

The issue occurs when the app tries to locate the internal tab Id (e.g. "tab::4234234") by using a hash value of the entityId. Because we used the following pattern <someName>_<channelId> for the entityId of the tab, we encoded this part as well for the MessageCard Action Uri. Before: NewsTab3_19%3a1574c127974f426dba712174858e10bd%40thread.skype After: NewsTab3_19:1574c127974f426dba712174858e10bd@thread.skype Not encoding the entityId in the MessageCard ActionButton OpenUri helped, because the tab id now was calculated the right way and the Angular router could successfully navigate to the tab. this.utilityService.djb2_hash(e.containerId + ":" + e.itemId.replace(/\+/g, " "));

            var t = this, i = e.context;
            if (i && i.channelId) {
                var n = null;
                n = 0 === e.itemId.indexOf(this.constants.deeplinkDjb2Prefix) ? e.itemId.substring(this.constants.deeplinkDjb2Prefix.length) : this.utilityService.djb2_hash(e.containerId + ":" + e.itemId.replace(/\+/g, " "));
                var s = this.constants.tab.configType.tab + ":" + n;
                return this.$state.go(this.constants.states.appConversation, {
                    middlePane: s,
                    notify: !1,
                    reload: !1,
                    slug: e.containerId,
                    groupName: "unknown",
                    threadId: i.channelId,
                    messageId: e.itemId,
                    ctx: "chat" === e.conversationType ? this.constants.navigation.context.chat : this.constants.navigation.context.channel,
                    navCtx: e.viewCtx === this.constants.navContext.alert ? this.constants.navContext.alert : this.constants.navContext.deepLink,
                    deepLinkContext: i
                }, this.goOptions)
            }

Something might have changed, because that same encoded EntityID in the url worked for several months.

@Gousia-MSFT Please update the Deep-link documentation, because the sample codes on that page include white-spaces and there is no hint regarding the Need of decoded string for entityId.

Wajeed-msft commented 5 years ago

We have added note in the docs for this.

image