Is there a way to use a bot, webhook, or some other connector to be notified when someone joins an online Teams Meeting? - microsoft-graph-api

Our company uses Teams Online Meetings extensively. Teams is a great product and is a wonderful communication tool. We have a scenario where we need to be notified when a participant joins a Teams meeting, leaves the meeting, or the meeting ends (all participants have left).
Can a bot, webhook, or connector be setup to listen to those events? Also, these meetings will be dynamically created real-time (not a scheduled event) using the Microsoft Graph API. Can the bot, webhook or connector be programmatically added to the meeting in order to receive the join, leave and end meeting events?
Thanks for your help,
Joe

Yes and No...
The problem is that you can think of a "bot" as a virtual teams client for a bot user. So it has the same limitations as a "normal" client (in most cases). So unless you invite the bot into the call or the bot is already in the call (e.g. started the call) then no you can't do what you want. If the bot IS in the call already then yes you can do what you want. The bot can invite, drop participants and end calls.
There is another way, you can create a Policy Recording Bot and will automatically insert itself into every call for a user that has the policy set to them. There is a overhead that the call start up time is a lot greater and all such calls are now conference calls. So the media is NOT endpoint to endpoint any longer. See the sample for an example of this type of bot.
The other downside would be that Microsoft may not like what you are doing using the Policy Recording Bot for non-recording purposes.

Related

Microsoft Teams - invoke HTTP request on message/reply in team channel

In MS Teams whenever someone replies to a message in a particular team channel, I want to invoke a HTTP request or publish a message to something like Azure Service Bus.
Is there a way to do this?
FWIW I'm trying to do 2-way SMS between a users mobile device and an agent using MS Teams. I'm using Azure Logic App(s) as the glue between the SMS provider and MS Teams, but the 1 part of the communication loop that I don't know how to handle is when the agent replies to messages in MS Teams. I know I can get messages via MS Graph API, but I don't really like this polling approach - I'd prefer more of an event based approach.
Bartsch, currently we don't have any such event to trigger whenever someone replies to a message in a particular team channel. But have an option when a new channel message is added. As this feature is not available at present, could you please raise an User Voice if this needs to be consider as a future request.

Posting to a teams channel from a logic app or flow which includes an banner alert / activity feed item

I have a logic app which posts a channel chat message to teams automatically when a new item is created in SharePoint. This I have working but our client requires that all the team members receive a banner alert and activity feed which I am having a lot of difficulty with.
What I've already tried...
Using a Incoming web hook on the teams channel - this was a very simple way to post from the logic app but the incoming webhook don't seem to support mentions.
Using the msft graph api - The /team/channel/message endpoint can post messages and user mentions but the this endpoint doesnt support channel or team mentions. It also appears that the graph API needs to use delegated permissions to post messages in teams. I'm using application permissions as this is a logic app. The logic app HTTP post connector doesnt offer the "connect as username#tenant.com" some of the other connectors use.
Using the flowbot post message - Like the above channel and team mentions are supported here so the post is added to the channel but with no notification to the team members
Using a notification only bot - I thought I nearly had it with this one. Microsoft's node bot sample number 57 looked like it can do most of what I want, it iterates through the users in the team and messages them this a customisable alert message...
https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs/57.teams-conversation-bot
However I can't see how this bot can be triggered from my logic app as it seems to require an existing conversation context or an #mention from within teams to start communicating with users.
What I'm considering trying next
Iterating users within the logic app - Next I plan to try and get team membership from the graph API and iterate the members in the Logic App, posting a message to each user separately. I had hoped to utilise the group #mention feature as a simpler way so I'd be grateful if anyone had any thoughts on other ways of doing this, or maybe there's something wrong with what I've already tried that you could give me some expertise on.
Thanks in advance ;)
Andy
You're on the right track with the Bot, but you're wanting to send something called a "Pro-active" message. You need the bot registered in the channel in order to get access to a few key properties (conversation id, service url, etc.), but you can use those to send a message from -outside- your bot (e.g. in an Azure Function). You might be able to do this directly from a Logic App, but I haven't tested that specifically.
To find out more, see my answer at Programmatically sending a message to a bot in Microsoft Teams but I've also got a recent blog post that you might find interesting for background on this at How Bots Actually Work.
Hope that helps
You can use Graph to post a message in 1:1 chat as long as you have the chat it. You can find the answer in this post Send message to personal Chat via Graph API
You can also call Graph API from Logic Apps. (https://techcommunity.microsoft.com/t5/integrations-on-azure-blog/calling-graph-api-from-azure-logic-apps-using-delegated/ba-p/1997666#:~:text=Calling%20Graph%20API%20from%20Azure%20Logic%20Apps%20using,Manage%20-%3E%20Certificates%20%26%20secrets%20More%20items...%20)

Show system messages in conversation history using iOS Twilio SDK

Hi I have been working on one of my apps for integrating chat using Twilio SDK. I would want to know if it is possible to get the system message inside a channel for eg: 'Member A joined the channel', 'Member B left the channel', 'Member C accepted the invitation to join' and so on. It seems like Twilio SDK does not have API to get the system messages or to set them. How can we achieve this?
I also noticed that it can be achieved by setting the custom key-value pair in attributes inside the message and sending it to the channel. But for the newly invited members, they cannot send a message when they are declining the invitation request such as 'Member A declined the invitation to join channel', as they have not joined the channel yet.
Twilio developer evangelist here.
If you want to send persistent system level messages like this, you can do so with a combination of webhooks and the REST API.
The idea is that you can send messages to a channel using the REST API whenever you need one of these system messages. The default user for the REST API is the system and you can then treat messages from system as special for display in your UI.
I mention the webhooks because you can register to receive them for a number of useful events, like members joining and leaving channels. The webhooks may not cover all the things you want, like declining an invite, but for that I would just trigger my own HTTP request from the application to your server.
Let me know if that helps at all.

Twilio controlling video room access

jut for a background, I'm building a poc of twilio based video chat contact center and I've came upon one issue. Most of the people using the service will be anonymous customers, no logging / authentication here. Looking at the twilio api, once I produce a Token with VideoGrant I loose all control of what the javascript client does with it, for example, someone can modify my JS client to create their own room, instead of joining the one assigned by my app.
Is there any way to create VideoGrant which would allow only joining a room, preferably a single, selected room?
There is a mention of Room Events in the console, but I didn't see any docs on it, maybe it would allow to catch rooms creation and kill the unknown ones, btw is there a REST api for rooms? nothing on official REST api docs again.
Sorry if the questions are a bit vauge, I'm aware that they might not meet SO standards, but I know that few Twilio developer evangelists are active so maybe you guys can propose some best practices here or just point out to the right docs if I am dumb enough to have missed them.
Lukasz,
Rob Brazier here, PM for Video. In the next few weeks we'll be adding a new grant to the Video section of our Access Tokens that allow you to lock down access only to a specific Room.
The basic flow will be:
User visits your site.
Your app server decides what Room they should connect to.
Your app server creates a Room using whatever identifier you like as the name (using the upcoming Video REST API).
Your app server generates an Access Token with a grant for the specific Room created in #3.
Your app server returns that Access Token to the client.
Client connects using the provided token and is joined to the specified Room.
Let me know if this is clear. Thanks,

What OAuth Scopes are required for a listen & reply Slack Bot using the Slack Events API?

I am trying to make a bot that will listen to all public & private channels, and IMs for a team, and will reply when it sees certain trigger words. This will be a "Slack App", installable to your team using the "Add to Slack" button, and includes a "Bot User".
I have asked for the "bot" OAuth scope, and subscribed to the "message.channels,message.groups and message.im" Team Events (at https://api.slack.com/apps/myAppId/event-subscriptions) but do not appear to receive event POSTs through the Events API when new messages are sent.
Adding the "channels:history,groups:history,im:history" scopes makes the bot receive these event POSTs, but I believe only for the user that added the bot, so it will not watch groups that the adding-user was not a member of, or IMs between 2 other users. This means that behaviour will be different, depending on which user installed my bot.
Is there a way of installing the app/bot for an entire team? The documentation seems to indicate that a 'bot' scope should have the ability to receive events, but I am not seeing this (I require the channels:history scope etc. above).
bot - request this scope when your Slack app includes bot user functionality. Unlike incoming-webhook and commands, the bot scope grants your bot user access to a subset of Web API methods, the RTM API, and certain event types in the Events API.
(from https://api.slack.com/docs/oauth-scopes)
The page on bots also claims that a bot can receive all messages through the RTM API:
This websocket will send you all of the messages and activity that happen in public and private channels that the bot user is invited to, as well as messages that are sent to it via direct message. A bot user opens this websocket with the RTM API by sending an authenticated call to the rtm.start API method. To learn more about connecting to the RTM API, read the documentation here.
(from https://api.slack.com/bot-users)
Is this same behaviour possible in the events API without needing to use the RTM API or add those additional scopes mentioned above?
I see from your comment that you have understood that the bot scope (and the channels.message Events subscription) allows your bot to receive from channels it is present in.
You have two options
1) you ask for channel.write scope in addition to bot, and you invite the bot in all channels (using the user token, not the bot token)
2) you work on your onboarding and figure out a way to get your "champion", ie the user who installed your app, to invite your bot in relevant channel.
Keep in mind that solution 1) is usually seen as very intrusive, especially in large teams where most people haven't heard of your app nor taken the decision to install it. But it can be suitable for some very specific use cases. Option 2) is the recommended route, but it is hard :-) Good luck!

Resources