Microsoft Teams: Is at all possible to create a app/connector/bot for broadcasting? - microsoft-teams

Trying to parse through the Microsoft Documentation of this is a bit of a challenge.
Our use case is that we want the app to receive broadcasts from an external service. On that broadcast we want it to send a personalized message to every person in the team/org.
Is that at all possible? Doing this in Workplace and Slack was fairly straight forward but i'm going nowhere fast with Teams. Connectors seem weird and user-based, not team based, requiring you to set up a config page for it? Bots seem centered around AI interactions and on demand features and general apps? Not sure.
So yea the question is, is it possible. If so i would appreciate to know where to look for how to do this.

Yes, this is definitely possible. If you're wanting to send to a Team (i.e. a Channel within a Team) you can use either a bot or a webhook. If you want to send to individuals or to group chats, then you'd be looking to use a bot.
For webhooks, see Post external requests to Teams with incoming webhooks. For bots you can start here, and in that case you'd want to look into something called "Pro-active messaging", where the bot is sending a message on it's own, rather in response to a user's initial message.
The Pro-active messaging can be a bit tricky, so if you do want to go that approach (1 to 1 messaging), let me know in the comments and I give you some more guidance. However, I'd suggest rather looking at messaging the Team, and creating/using a relevant channel, rather than sending every user a 1-1 message.

Related

Get Slack channel where app is integrated

I might be missing something really simple but don't seem to find the solution.
I have created a quick and simple app which is meant to do some processing every morning and then send some logs to Slack.
I have been perfectly able to do so using Incoming Webhooks. Cool. The "problem" is that it requires me to set it up from the app settings (aka it obviously makes me define a specific channel for the Webhook so I can have the specific URL) and that's something I like a bit less.
I thought it'd be easier if I can just add/integrate the app on a channel using the Slack UI so I don't have to worry about having to know beforehand the channel(s) ID where the message has to go to and also any other user would be able to integrate in any other channel they consider.
I have integrated it on my testing channel (all good) and tested chat.postMessage (all good) but it still needs the channel (obviously). However, using conversations.list lists ALL channels and that's the opposite of what I'm looking for.
I need a way of getting just those channels where the app is integrated so I can post the message to those and only those.
Is this something that Slack doesn't allow or I'm just missing something very obvious here?
I hope it makes sense and someone can shed some light on this :)
You can use users.conversations method to get list conversations the calling user/bot may access.
https://api.slack.com/methods/users.conversations
Use Bot token to call the API.
Use type argument to search public, private, mpim & im conversations
https://api.slack.com/methods/users.conversations#arg_types
Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im

Calling an external API from MS Teams chat

Can anyone offer guidance on how to call an external API from within MS Teams chat/posts initiated by an #mention or #hastag? The service I want to build would use the mention/hastag to call an API and return various types of meta data that would then be added to the chat, post, etc. Wondering if Flow or Yo Teams is the best way to go.
The best approach for this would be to create a bot, which gets a name that can be '#' mentioned (e.g. if you bot is called MyBot, you could mention #MyBot in a Teams channel, and it will get notified). Once it receives the notification, the bot can do anything you need it to do.
If you have development skills available (yourself or someone on your team), have a look at the Teams Bot development documentation to get started. If not, Power Virtual Agents could suit your needs (it's like a "drag and drop" bot creator.

Slack API : Ability to view all recently added users to Slack Channel

I am working on a POC to proof out the ability to get a list of all the new users who have been added to a specific Slack Channel. From my initial review of the Slack API I am not seeing anything that showcases this ability, I was curious to see if anyone had worked on something similar or could point me to resources that would be a viable solution.
I believe there is no ready-made API method available, that will give you that specific information. However, Slack is very flexible and you can use the existing building blocks to easily add additional features as needed.
E.g. To get the requested information you can develop a small Slack app that listens to the member_joined_channel and member_left_channel events to keep track of when members joined a channel.
If you need a historical record of membership in a channel, you could use the Slack API's groups.history method, page through results, and build a membership log by looking for events of type member_joined_channel and member_left_channel through time.

Sharing same conversation with multiple bots

Question: How to have multiple bots supplying answers to the same Teams chat window a user has with an aggregator bot.
Description:
Several different teams have created bots that can answer questions related to their areas. Picture a services bot, a catalog bot, etc. All of these bots are maintained by their individual area owners, have their own sets of LUIS intents, etc. That works great, but you have to know where to look for each type of question.
Now we'd like to have a single bot for anyone to connect to, to get their questions answered no matter what area the question falls into. The idea is that this aggregator bot would then forward the questions to the appropriate area bot, which would then provide the answer. The scenario here is that someone troubleshooting an issue could ask questions crossing multiple areas in the same place without having to know about each individual area's bot.
The bots are currently hosted in Teams and are C#. So far, our solution has this flow:
Aggregator bot receives the question and asks each bot (through another endpoint specific to this flow) how confident it is that it can answer the question.
Aggregator bot decides which bot(s) to ask the question to, and sends the question off to the regular /api/messages endpoint for the bot.
[Broken] Area bot posts the answer/ auth prompt if needed/ or the start of a conversation to clarify the eventual answer.
We found the bot-to-bot handoff project, but in the readme.MD, it says:
Note: The main bot and each of the sub-bots share the same AppID and
AppPassword. This allows all the bots to share the same conversation
ID, Dialog
Stack,
and Bot State
Data.
This is not possible in Azure, because you can't create multiple bots with the same AppId.
Trying a hack based on that, we found that if we change the bot configuration to use the same MicrosoftAppId and MicrosoftAppPassword in the Application Settings in Azure for all the bots, then everything works fine through the aggregator bot. At that point, you can no longer connect directly to the individual bots anymore. While that is clearly a hack and not a solution, it implies that the problem is authentication based and not something that is implicitly impossible.
There are lots of pieces around that seem like they might help, but we haven't found the documentation to fit them together. This seems like something that should be a common scenario. Ideally we could specify some kind of bot trust at a higher level and not have to specify AppId and AppPassword directly, though we're willing to do that in this case since we're all the same company.
Things we've tried:
Using TrustServiceUrl to trust the aggregator bot from each area
bot, and all the area bots from the aggregator bot. The call was
made in Application_Start in Global.asax for each bot.
The hack described above
Specifying AppId and AppPassword in the BotAuthentication attribute
Number 3 actually solved the auth problem for letting the aggregator bot ask each bot for it's confidence in answering the question when we used it to tag those functions. Specifying the AppId and AppPassword for the aggregator bot in the specification for that endpoint in the individual area bots worked great. But it didn't fix the ability for the individual area bot to post back to the conversation owned by the aggregator bot. In that case, the aggregator bot itself is consuming the answer, and it is an answer and not a flow.
What do we try from here? Is there something we've missed, or is there something fundamentally wrong with the approach we've started with?

Slack: Get notification when Bot is offline

I searched the www for a solution to a problem of mine without finding an answer.
I need to get notificated when my bot in slack goes offline, but I don't know how.
To get notificated when he logs in is cacke, because I can set him to send a message, but when he's off there is no option to send a message.
I prefer PHP, Javascript, but other languages are also fine.
Thank you very much for your effort
There are many options how to setup a way to monitor your bot and get notified when it is offline.
One option that has worked well for me is to use an external website to monitor your bot. That website will send requests to your bot every couple of minutes to see if is is still alive and will notify you if the request fails. You may need to extend your bot a bit, so that he can reply to these requests in a proper way.
There are many website that provide this service. The one I use is uptimerobot, which also happens to be free for up to 50 monitors.

Resources