deep linking to tab in teams from adaptive card from bot

Given we have a teams bot and personal teams tab ( with name TT and content URL : a.example.com/g ).

Consider a scenario, Bot sent an adaptive card with openUrl button (whose url is a.example.com/b/c?d=f). On clicking this, normally the url a.example.com/b/c?d=f will be opened in new browser tab.

Since this above URL can be opened in teams tab TT, I am planning to deeplink to the tab and open the url in the tab.

On using openUrl button’s url as https://teams.microsoft.com/l/entity/<appId>/<entityId>, ( referred from Generate a deep link to your tab ), I was able to achieve redirection to the expected teams tab TT. But it doesn’t solve my entire problem, because I should be opening the a.example.com/b/c?d=f in the tab, not its default content URL.

How can I achieve redirection from Chat tab to personal teams tab and open the url a.example.com/b/c?d=f in the tab automatically.

Answer

You can use the subEntityId properly in the deeplink for this, I think. Put a URL-encoded value of the url you want to pass to your tab, and decode it from within your tab (there’s a section in the doc you linked about accessing the value from your tab via the Context object: https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/deep-links#consume-a-deep-link-from-a-tab)