Forum Discussion
Trying to understand MS Teams "Tab App"
-
State Preservation: Tabs in Teams are indeed similar to iFrames and do not inherently preserve state. However, you can implement state preservation in your app by storing state information in a database or other persistent storage and retrieving it when the tab is reloaded. This would require additional development work on your part.
-
Notifications: Tabs themselves do not support notifications. However, you can use a bot in conjunction with your tab to send proactive messages to users. The bot can be triggered by events in your tab, such as incoming messages, and send notifications to the user. You can also use the bot to send messages to the user when the tab is not active.
-
Authentication: Tabs do support Single Sign-On (SSO) with Azure Active Directory (Azure AD), which provides a seamless sign-in experience for users. However, SSO is not required. You can implement your own authentication mechanism, allowing users to sign in with their credentials as they would on your website.
Thanks,
Prasad Das
------------------------------------------------------------------------------------------
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.
- I understand I can preserve state in my own backend, but it's there any way to preserve any small bit of identifying info in a tab app itself? For example, you mentioned I could implement my own auth instead of using SSO. If there is no way to store state, though (like cookies or local storage APIs), how would I persist their auth or session token (client side) between "visits" to the tab? Even if it was just one simple token string identify them. I can't have them logging in repeatedly.
- My goal with notifications is to have a toast notification pop up in the corner that they can click on to deep link them into the tab and into my app regardless of where they might be in Teams itself- in a meeting, in a totally unrelated chat, in another app's tab, etc. Do "bots" allow this, or is a bot something you have to add to a specific Teams conversation? Is a bot a while secondary/separate app or would it be part of the same tab app?
- Prasad_Das-MSFTNov 08, 2023
Microsoft
AlexKozler - Yes, you can use the local storage APIs to store state, such as a session token or other identifying information, between visits to the tab. This can be done by using the
localStorage
orsessionStorage
objects to store key-value pairs. These objects allow you to store data on the client side, and the data persists even after the browser is closed or the user navigates away from the page. This way, you can persist the user's authentication or session token between visits to the tab, without requiring them to log in repeatedly.For notifications, you can use a bot to send a message with a deep link to your tab. This method is preferred especially if the tab thread is targeted. A bot can be part of the same tab app and it's not a separate app. You can @mention specific users if needed.