How can I localize my Microsoft Teams bot welcome message? - microsoft-teams

When my bot is first installed on a Teams tenant, I appear to have no way of localizing that message. Most of my Teams app is currently localized by the browser locale available with all messages sent to it by users.
However, when a bot is added to a team (membersAdded), this locale information is not present.
Since I use graph for other app needs, I try to leverage the users preferred language, but that cannot be done without first granting the app permissions to use graph. This means that the first time the bot is added to a team, it is never localized. After app permissions are granted by the user, future welcome messages in other teams are localized, but that also has the limitation that the locale used by the welcome message doesn't necessarily match the users current browser language preferences.
Is there another way to localize the welcome message the bot sends out?

This is a known limitation currently. Bot has to wait for user to message. The message activity has clientInfo filled out in channelData with locale information.

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

Can I create a configuration page for a Teams bot app?

I'm building my first Teams app which will have two primary functions:
Proactively send a message to the channel (the bot is installed into) when a specific event occurs on my backend.
Members of the channel reacts to the message via actions.
I finally have a pretty good idea of how to set this up (I think) - but one part I'm missing is that in order to identify the specific app installation as belonging to one of my customers, I need to be able to allow the installing user to supply extra information like e.g. an API-key so that I can associate the specific channel with my specific customer.
Is there any way of doing this with a bot app? I've found examples for creating a configuration page, but they all seem to be associated with tab apps?
I could of cource have the bot ask the user for the information - but maybe there's a "cleaner" way?
Any examples or tutorials would be greatly appreciated as I find it rather hard to get stuff working using Microsoft's own examples etc. :)
Thanks a lot!
When you receive any message from the user, either by typing to your bot, or even installing it into a channel, group chat, or personal context (where you get the conversationUpdate event), you are able to get specific details off of the activity object. If the user sends a message, for instance, then the text property on the activity object will have a value. Incidentally, this is the same activity you will use to get the conversation details you need for the Proactive message.
With regards your question, the activity class also includes a tenantId property, hanging off the conversation property. This is the unique Microsoft 365 Id for the tenant, which would be what I'd suggest to uniquely identify them for your API, or licensing, or similar.

Microsoft Teams App added or removed from personal scope events missing

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.

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.

How to make a bot to message only certain people

I developed a welcome bot using the Microsoft Bot Framework. I want to add it to Teams. In teams I want the bot to send welcome messages to only certain members belonging to a particular team or group. Please provide me advice or steps how to do it.
You can only send a welcome message to a specific user if that user first contacted your bot. This is done purposefully to minimize the possibility of spam bots being created. Once a user has contacted your bot you can capture the user's Id and, coupled with the conversationId, you can send future (proactive) messages.

Resources