OfficeDev / microsoft-teams-library-js

JavaScript library for use by Microsoft Teams apps
https://docs.microsoft.com/microsoftteams/platform/
Other
430 stars 199 forks source link

Deeplink without app installed losing subPageId #2176

Open Wesleyzxc opened 8 months ago

Wesleyzxc commented 8 months ago

Hi, I'm trying to deeplink through sharing content with shareWebContent with embeded . However, if the recipient does not have the app installed, it redirects to the store to install the app.

After installing the app, the user gets redirected to the app but loses the subPageId for internal navigation. Is there a way to keep that subPageId, or to know if the user gets redirected to app installation or if they already have the app installed?

ChetanSharma-msft commented 8 months ago

Hello @Wesleyzxc - Thanks for raising your query. Could you please confirm whether you are facing this issue in Classic or New Teams or both?

Also, could you please share the steps and code snippets for deep link ?

Wesleyzxc commented 8 months ago

Hi @ChetanSharma-msft, this issue is in both classic and new teams.

A deeplink is shared in chat to a user that does not have the app installed. This can be through the code or just by typing. When the user clicks on the link, they get redirected to the store to install the app. After installation the context is lost and we are unable to retrieve the context through the deeplink anymore.

The deep link looks like this: https://teams.microsoft.com/l/entity/<appId>/explore?context=%7B%22subEntityId%22%3A%22article%3AShare%3A4f09741c-246f-4572-abca-380c26f07c85%22%7D

Vaibhav-MSFT commented 8 months ago

To maintain the subPageId or determine if the user is redirected to app installation or already has the app installed, you can use the appContext parameter in the deep link URL. When you generate a deep link using the shareWebContent method, you can include additional information in the appContext parameter. This information can be used to pass context data to your app when it is launched. In the appContext JSON object, you can include the subPageId and any other relevant information that you want to pass to your app. For example:

const appContext = {
  subPageId: 'your-sub-page-id',
  // other relevant information
};
const appContextJson = JSON.stringify(appContext);

When the user clicks on the deep link and your app is launched, you can retrieve the appContext from the URL and use it to determine if the user was redirected to app installation or already had the app installed.

By including the subPageId and other relevant information in the appContext parameter, you can maintain the internal navigation and determine if the user was redirected to app installation or already had the app installed.

Wesleyzxc commented 8 months ago

Where can we find this appContext parameter? I'm looking at the documentation here for sharing module here but there's no mention of appContext. I have included the subPageId as part of the encoded context, is that the right way to do it?

If the user has my app installed, everything works fine and I am able to proceed with internal navigation with the app context. However if the user does not have the app installed, after installation and getting redirected to the app, the app does not know about the subPageId anymore.

Wesleyzxc commented 8 months ago

Hi, is there any updates on this? I'm still unable to find any additional documentation to support this functionality

ChetanSharma-msft commented 8 months ago

Hello @Wesleyzxc - Sorry for delay in response. We will check on it and let you know, if any.

Vaibhav-MSFT commented 8 months ago

Hello @Wesleyzxc , We are able to repro that issue, we have raised bug for the same. We will inform you once we get any update.