Teams SDK events - determine if Team has been deleted - microsoft-teams

I have a fairly basic Teams app I've been developing, that has a bot associated with it. The bot is a simple NodeJS application, that us just waiting on events sent by my teams app to it
I see the teams conversationUpdate Type and some associated eventType in the SDK docs.
Is there an easy way to detect if the actual Team itself has been deleted?
i.e I have a Team, I add my app to it and create a tab in the team for the app. I can detect that the app has been added to the team, by checking the teamMemberAdded eventType.
But, I'm unsure if i can use the teamMemberRemoved eventType to determine if the Team has been deleted
Thanks

Currently, Bots do not receive an event when its containing team is deleted.
If you are storing team and channel details for proactive messages then you can clean it up when you get "NotFound" error code in exception while sending a message.

Related

Is it possible to automate the moderation of a channel in Microsoft Teams?

My organization recently implemented Microsoft Teams and is experiencing issues with users tagging #General unnecessarily, posting in the wrong channel, and posting inappropriate content (not necessarily NSFW but off-topic).
Slack has third-party tools that allow you to set rules for a channel and, if a rule is triggered, the message is automatically deleted. For example, if a user inadvertently tapped their yubikey and sent it to the entire organization, there is a bot that will recognize the key and immediately delete the message. It's effectively the same concept as the AutoMod functionality in Reddit.
I've been looking all over the place but can't seem to find any articles about this type of feature. Does Microsoft Teams allow for any functionality like this?
Currently Teams have functionalities such as sending notification from external app to Teams channel via incoming webhook. And also using proactive message notifications.
https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook
https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/conversations/send-proactive-messages?tabs=dotnet#get-the-user-id-or-teamchannel-id

How do you get a notification only teams bot to call the messaging endpoint after initial installation?

We have a notification only teams bot that is live for a number of customers in production.
Most of the time when it is installed it calls our messaging endpoint and updates the conversation ID so we can send teams notifications to our customers, however sometimes it seems to fail to do this for some reason so our systems don’t get a conversation ID.
We tried incrementing the version number of the teams bot and that didn’t seem to help.
Is there some way to get the conversation ID updated after initial installation?
Answer after contacting Microsoft Support is that it is impossible. The best solution is to have a non-notification only bot and then it works as you'd expect.

Azure Bot messaging endpoint does not get teamMemberRemoved event when the Bot App is removed from Teams

I created an Azure Bot and set the Messaging Endpoint to my web-app, which is not hosted on Azure.
I created a deploy package zip as a Teams App to be deployed on Teams and use my bot.
My messaging endpoint gets the ConversationUpdate events with membersAdded type when the customer adds my bot to Teams, and when users are added. The events are sent to the Messaging Endpoint configured in my bot.
When the customer deletes the App from Teams I do not get any event to the messaging endpoint.
According to https://techcommunity.microsoft.com/t5/microsoft-teams/which-event-fired-when-someone-uninstall-your-app-in-microsoft/m-p/1610299 I expected to get an event with type teamMemberRemoved to the bot messaging endpoint.
I need to know the Teams App was removed so I can clean up resources on my end, and indicate in my UI to the customer that the bot is no longer configured for his Teams team.
I tried adding and removing the App from my Teams account a few times but never got the expected event to the messaging endpoint.
How can I know that my App was uninstalled on a Teams team?
If you just want to know when the App is getting added or remove you can use OnInstallationUpdateAsync, here you will get the type installationUpdate and action as remove when it gets uninstalled.
I tried with onConversationUpdateAsync as well and got the request as . Please confirm once if you are handling it property,

Microsoft Azure Bot Service Proactive Messaging to Group (Meeting) Chat

I would like to implement the following Scenario:
Within a Meeting that should take place in the real world in a room (not necessarily within MS Teams), I want a Microsoft Azure Chat bot to post a message to the meeting-chat, without someone having to add the bot to that meeting chat.
I noticed, that real proactive messaging to MS Teams is still not possible, a workaround is necessary: Catching a conversation reference including the users teams-chat-id while he adds the bot e.g. via personal teams app. This works good, if the teams app is pushed to all users within an organization via policies.
This workaround however is not possible within a meeting-chat, that might not exist at the time the bot should write to it. So, no possibility to catch a conversation reference to post to.
Also, I noticed that there does not even exist a MS Graph endpoint neither a connector within Logic apps to post a teams message to several users without cannel-context.
Do you see any workaround for this scenario, or is it simply not supported?
To my knowledge, you're right on both accounts - a bot can't proactively message a chat that it's not part of, and I don't think Graph supports messaging to group chats altogether, which is your scenario.
Just on a point of correctness though, a bot can proactively message (a) individual users (1-1), (b) group chats, and (c) Team channels, each separately (i.e. it does not need to be installed by each user, and message each user privately, unless that is the desired scenario. All that's required for each of these is the relevant "conversationid" that represents the specific conversation, and the ServiceUrl.

Does a bot get notified when it's uninstalled from a tenant?

I'm testing out a bot right now via an uploaded custom (sideloaded) app. I can see that when I add the bot to a team or remove it from a team that I get an activity with a type of conversationUpdate with the bot's ID in the members added or members removed element.
Is there a specific activity or other event that the bot gets when it's removed from the tenant entirely? Do I just have to track all teams the bot was added to?
Teams does not yet have a well-defined concept of being added at the tenant level. We will be adding that in the first half of 2018.
In the meantime, yes, you have to track it on a team-by-team basis I'm afraid.

Resources