Forum Discussion
Teams App lifecylce questions and approach for external callbacks
Hi all,
i have started writing a teams app that mainly will display a (on board) angular application in a static tab. This application will connect to an external service via REST and register for some push updates which will be displayed in some table/cards. The user has to initially enter username and password which will be different from Teams/365 credentials.
What i would like to achieve is that directly after teams has started, the application registers the user for the push updates, without the user having to click on the app or activate the tab. I would then like to send a message to the user or to his activity feed that an update has been received whenever the angular application receives a push update.
So the main questions are:
- Is any part of the app initialized directly upon starting teams? Some static scripts possibly? I assume the full angular app will only be loaded upon loading the tab?
- Would it make more sense to work with bots here?
- Assuming we want to be able to use the app in outlook as well, is there a unified API that allows to notify the user? Since outlook does not have an activity stream or chat messages, would things like toasts work?
Thanks for reading so far!
Greetings,
Florian
frapp32 - Typically, the full Angular app will only be loaded when the tab is activated by the user. Static scripts or background services are not initialized directly upon starting Teams. However, you can consider using a bot or proactive messaging to notify the user when there are updates, which might prompt them to open the app tab.
- Bots can be a good solution for sending notifications to users. They can interact with users proactively and can be used to send messages to the user's activity feed when an update is received.- There isn't a unified API that allows notifications in both Teams and Outlook in the same manner. Teams has an activity feed where you can post notifications, but Outlook does not have a similar feature. You might need to use different methods for each application. For Outlook, you could consider using actionable messages or email notifications.
- For connecting to an external service via REST and registering for push updates, you'll need to handle this on the server side. The server can then use the Microsoft Graph API or Bot Framework to communicate with your Teams app and send notifications to users.
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.
- Prasad_Das-MSFTMicrosoft
frapp32 - Typically, the full Angular app will only be loaded when the tab is activated by the user. Static scripts or background services are not initialized directly upon starting Teams. However, you can consider using a bot or proactive messaging to notify the user when there are updates, which might prompt them to open the app tab.
- Bots can be a good solution for sending notifications to users. They can interact with users proactively and can be used to send messages to the user's activity feed when an update is received.- There isn't a unified API that allows notifications in both Teams and Outlook in the same manner. Teams has an activity feed where you can post notifications, but Outlook does not have a similar feature. You might need to use different methods for each application. For Outlook, you could consider using actionable messages or email notifications.
- For connecting to an external service via REST and registering for push updates, you'll need to handle this on the server side. The server can then use the Microsoft Graph API or Bot Framework to communicate with your Teams app and send notifications to users.
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.
- frapp32Copper Contributor
HiPrasad_Das-MSFT ,
thank you for your response. Sorry for reacting so late, but other things became high priority.
I got back to working with the teams app and i understand that using a bot is probably the best approach here. When the user initially adds the bot, i can send and save the conversation id (or what ever ids are needed). This will allow me to proactivley message the bot via REST if i understand this correctly.
I would like to know if there is some kind of event when the user logs in that is made known to the bot? This would allow me to only register the user for push updates when he actually is using teams.
If there is no such event, i assume if i send continuous updates, they would just pile up and the user gets them once he logs in again?Finally, is there some overview as to which scope a bot is responsible for? Like, is a bot limited to a specific company/tenant or is there only one global instance of the bot that handles all interactions?
Thanks and greetings,
Florian- Prasad_Das-MSFTMicrosoft
frapp32 -
1. There isn't a specific event in Microsoft Teams that directly notifies a bot when a user logs in. However, you can use the
conversationUpdate
event to detect when a user joins a conversation or when the bot is added to a conversation. This event can be used to trigger actions such as sending a welcome message or updating user-specific data
Conversation events - Teams | Microsoft Learn
2. The scope of a bot in Microsoft Teams can vary based on its configuration. Bots can be scoped to different levels, including:- Personal Scope: The bot interacts with a single user in a one-on-one chat. This scope is useful for personal productivity tools or personal assistants.
- Team Scope: The bot interacts with all members of a specific team. This scope is suitable for team collaboration tools or project management bots.
- Group Chat Scope: The bot interacts with multiple users in a group chat. This scope is ideal for small group collaborations or discussions.
Create a bot in Microsoft Teams - Teams | Microsoft Learn
Send and receive messages with a bot - Teams | Microsoft Learn
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.