How to perform Teams Channel Authentication for bot framework? - botframework

I am working on team's bot that is scoped to teams' channel and group chat. I am using a external service that is being used by the bot. Now if I add the bot to channel or group chat, i want a way to only authorize certain group of users or use their auth token to access the external service within bot. In a personal chat as given by the example 46. (link: https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/python/46.teams-auth) Teams auth in Bot framework samples, we can do auth when we click sign in and the user gets to login then pass the token to the bot. How to perform the same action (bit less intrusive) in a channel or a group chat?

Related

DM to any user on Slack using Slack API

I'm trying to send Direct Messages (DMs) to a user on Slack using chat.postMessage using Bot token. But I'm only able to send messages to the users that are in my workspace.
How can I send message to any user on another workspaces?
When I try to do so, I get: "error": "channel_not_found"
I've that user's UserID (U02....), user's email and my Bot token.
When you create a bot/app in Slack, you grant it OAuth Scopes which provide the bot access to certain information in your Slack instance. So for example, I expect you have added the users:read Bot Token Scope to your Slack app, so that it can determine the users, and userId's in your workspace.
However, this scope restricts the bot to only see users in your workspace.
There's a couple of ways around this though:
Solution 1 - Slack Connect
Now in Slack, you can message users in other workspaces with a feature called Slack Connect.
You'll first need to establish a connection with the user you want the bot to message. This can be arranged via an invite process, and once completed that userId should become available to the bot. You can use that userId in the channel field of the chat.postMessage API to direct message the user from the other workspace.
Solution 2 - Org Level App
If you are on an Enterprise version of Slack, you should have multiple workspaces within a company, that are all linked by an enterpriseId.
In this case, a possible solution might be to create what is known as an Org Level App to have access to information across multiple workspaces. More information on Org Level apps can be found here.

MTeams bot authorization (OAuth, get/use/refresh token) to my web service

Could you help me to implement login functionality to my web application (OAuth)?
I created MS teams bot and need to connect to my web service. I need to call (from the bot) my login web page (Login page: user & pass), get token and then use (refresh if needed) the token to make API requests (from bot) to my service.
Examples, architecture, suggestions?
Thank you ...
How to authenticate a user using a teams bot using my own custom authentication service?
https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/csharp_dotnetcore/46.teams-auth
I found some solution and ... Any different suggestions?
Also ... A question ... How can I override the existing dialog (the example) and use my content (new dialog body)?
You can take a look at Adding Authentication to your Teams Bot. Invoke activity is send to the Bot when user to click on oAuthPrompt Dialog. We have TeamsAuth sample code using the same oAuthPrompt dialog, You can set the oAuth setting for your Bot in Azure and test it. For more information how Authentication flow works in Teams Bot you can check the MS Teams Authentication flow in Bots, Bot uses the Dialog from TeamsActivityHandler class, You can create your own dialog using the same.

Skype Channel: Unable to login with 'Sign in' to save your chat

I have enabled Skype channel for my bot which on top of chat window shows option to login. I am unable to login using my work ID, rather I could login with my personal Microsoft account.
I could not find much documentation on this. How can I enable bot so that bot users can login only with their work email id?
This is the expected behavior as Skype doesn't let you create an account anymore with a business email address. If you want to test your bot by connecting it to Skype channel, then you can use your personal account. The Skype for Business channel is specifically designed for the usage of work email ID but it is being deprecated on the Bot Framework. I would suggest you to connect the bot to Microsoft Teams to login using work email ID.

How to let a user join channel in Slack App

I am working on a slack app which has its bot also.A user can share a file from the bot to any public channel even if he is not in that channel. If user is not in the channel then firstly I will add the user in the channel and then share the file. For this slack provides api https://api.slack.com/methods/channels.join which helps a user join a channel. But it expects a user token corresponding to the user who wants to join the channel. Now the issue is I only have bot token(xoxb-) and api token(xoxp-) corresponding to the user which has installed the app. So how can I get the token corresponding to any user whom I want to join OR I am missing something here. Please help.
No, you do not need a token corresponding with the joining user.
When installing a Slack app with a bot user you receive two tokens: a bot token and an app token. The app token (but not the bot token) will work for inviting users to public channels, provided your app has the required scopes (channels:write).

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