Microsoft Teams App added or removed from personal scope events missing - botframework

I try to write an app for Microsoft Teams which does include a Bot.
The bot should write a welcome message as soon as the app is installed by the user in his personal scope. Additionally I want to be informed when the user uninstalled an app.
There are events when a new user is added/removed to a team (onTeamsMemberAdded/onTeamsMemberRemoved) in which the bot is installed, but is there also something for the personal scope?

onTeamsMemberAdded should deal with personal scope as well, and it will enable you to send a welcome message. However, there is unfortunately no way to get notified when your bot is removed. onTeamsMemberRemoved only applies when your bot is part of a group chat, or channel, and only tells if other users have been removed. This is a missing feature in Teams right now.

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 to perform certain actions after a Slack workspace's admin approves the installation of the app?

Edit: I'm using Django and inside the DjangoInstallationStore.save method I create a channel, join the bot to it, and post a message into the channel.
It seems that if a user attempts to install the app to a workspace where there might be admin restrictions, the installation and bot are created but the channel cannot be created (restricted_action) or joined (channel_not_found ) and the members of the channel cannot be viewed (channel_not_found).
I'm investigating if I have a bug in my code but also wonder if there is anything I missed about Slack API as to if certain restrictions in the workspace could cause such scenarios to happen? Cheers.

Teams proactive messages with uninstalled app

I'm trying to build a personal Teams bot which has to send proactive messages regularly. I made it work by storing the conversation when the user installed the app, just like the examples here. Now it works great, but I realized that I keep messaging users that have uninstalled my application. I can't seem to find any event that is triggered when a user uninstalls a personal scoped bot (app).
I tried conversation events, but nothing seems to be triggered for personal scoped bots at least.
I'm using the NodeJs botbuilder SDK.
Open to any suggestions, thanks.
To my knowledge, there is no such event unfortunately. I think you'll just receive a 403 at the moment without much info. This is due to change though - Microsoft just made an announcement about this yesterday in fact. See https://developer.microsoft.com/en-us/office/blogs/best-practices-and-updates-for-bot-lifecycle-events-in-microsoft-teams/ in the paragraph "Changes to post uninstall behavior for bots in personal scope":
Moving forward we’ll also align the post uninstall behavior for bots in the personal scope with the teams and groupChat scopes and you will not be able to send or receive messages after an app has been uninstalled. Your bot will receive a 403 response code to new messages posted by your bot. The 403 response code will have fields telling you the reason behind the it – which is either the app was uninstalled or the bot was blocked. We expect these changes to roll out in the coming few months.

Is there any way to get user details whenever user uninstalls bot and bot is installed in personal scope only?

This is conversationUpdate event with membersRemoved object but that works only in the case when the bot is installed in a group and either the bot or member is removed from the group but I don't receive any callback when the bot is installed in personal scope and is removed later.
Unfortunately, there's no event/information sent on this at all from Teams. There's a new event in the bot framework (latest release) called "InstallationUpdate", which I was hoping would cover this, but that also doesn't send anything, at least not at the moment.

Can't add bot to group chat

I've created a bot (a simple echo bot) and deployed it to Azure. Everything works well now and I can talk to the bot in the desktop Skype client (Windows 10 app).
However, I can't seem to be able to add the bot to an existing group chat. When I click on the add button the list of contacts to add doesn't have my bot in it, which is weird because I've added it to my contacts.
https://stackoverflow.com/a/41644443/249230
^ According to that post I need to create a "private chat" with my bot and then I'll be able to add it to group chats, but I have no idea how to do that.
I haven't published my bot, but I did enable "Allow adding to a group" in bot settings on https://dev.botframework.com.
Any idea why it's not working?
Private chat is talking directly to your bot. If you have added it to your contacts, it should be easy to open a direct conversation with it by double clicking.
Then you can add people in the conversation using the top right button:
Then you will have your group chat working:
Note for other people asking the same question (but you already mentioned that you did it), don't forget to activate the group conversation for your bot in botframework portal, in Skype channel settings
Have you tried to add a bot to group?:
https://telegram.me/[botname]?startgroup=foo

Resources