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

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

Related

Send a user message to a user via Power Automate in MS Teams

Is there a possibility to send a user message to specified user(s) in MS Teams?
Elaboration:
My current flow triggers a message to a user, but it is always sent via FlowBot and appears in the Power Automate chat of MS Teams.
Flow: (Outlook; Trigger) "When a new email arrives (V3)" → (MS Teams) "Post message in chat or channel" → (Outlook) "Mark as read or unread" (v3)
Can individual users be set as recipients of direct messages with the message sent in the already existing chat with the user?
If yes, is it possible without a value chain?
Thanks!
As I see it, there are kind of a few different questions in your post, so I'll try deal with each of them:
In order to send a message directly to a user, the user has to come "from" someone/something, and in Teams that basically means a Bot. The easiest way, therefore, to do this is to use the out-of-box FlowBot. If that's fine for you, you're good to go. If you want it to come from another Bot (i.e. one you own) then you need to create a Bot somehow. Two main options are:
Code it from scratch using Microsoft Bot Framework - code in a regular language (C#, Python, etc.) or using Bot Framework Composer
Use Power Virtual Agents - ala "Power" family, it's kind of a "Drag and Drop" bot capability. You don't need to actually have the bot DO anything though, if you don't want it to handle user responses (you can do most of that visually in your Power Automate flow. For this option, you'll be able to select the bot from within Power Automate designer as the "send from" bot
You can choose to have the bot send a message directly to the user (i.e. in a 1-1 chat, like what you're seeing with FlowBot) or you can choose to have it send to a particular Channel inside Teams - either is fine. Be aware that Channels have threaded conversations, if you want to use them, but 1-1 chats do not.
You can try these Power Automate steps to create the 1:1 chat between you and the user, then send a message to it.

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.

MS Teams Outgoing Webhook Without Mention Possible?

I'm trying to create a subscription to receive the contents of all new messages sent within a private Team, and so far it appears I have to configure a bot / webhook within Teams (and only messages #mentioned to that bot / webhook will be sent to me), or otherwise use the Graphs API (I can't determine whether the same caveat exists with #mentions).
The use case is to allow members of the Team to post messages, and for my listening application to consume the message contents and take an action (turn on a light, etc.. but external to Teams). I don't anticipate needing to write anything back into the Team.
I found this link in another post: https://blog.thoughtstuff.co.uk/2020/01/how-to-use-the-new-webhooks-for-microsoft-teams-channel-chat-messages/
Has anyone successfully been able to subscribe to all messages within a private team for a similar use case?
Thank you!
Posting the Answer for better knowledge
Copying from #Sridevi comments
To track messages and replies in a channel, you can create a change notification subscription at a channel level. Please follow this documentation.

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.

Can user resume a conversation in a different channel? (Bot Framework)

Let's think of the following example:
1) I have a certain bot deployed on Azure
2) Bot can be talked via Facebook Messenger and via Skype
3) A certain user talks to the bot via Facebook Messenger and then he leaves.
4)A couple of minutes ago the same user resumes the conversation with the bot, but via Skype.
Is this possible? I assume Bot Framework doesn't have anything included for this, hence, that this isn't posible (as conversations are independent and state changes depending on the channel). Is there any way to identify a user (via some authentication method maybe), and then making this logic again?
Do any of you know any workaround for this?
Thanks in advance!
The Bot Framework Connector service is a component which provides a single API for your bot to communicate across multiple client services such as Skype, Email, Slack. Every bot and user has an account within each channel.
The channel account contains an identifier (id) and other informative bot non-structural data, like an optional name.
And there us unique conversation ID created for each conversation of each user for each channel. And you can customize your channel capabilities as described here.
Regards,
Jyo

Resources