Sending context information to chatbot - botframework

While launching a web chat bot from a portal (through iframe), is it possible to send the details of the logged in user (who has already logged into the portal) to the bot and save it in the bot state so it can retrieved inside the bot code to do some customization or apply custom logic based on the user details. User details can include their name, date of birth, gender etc.

Your web app and bot can exchange information "behind the scenes" (i.e., invisible to the end-user) by exchanging activities of type event. An activity with type event will not be displayed by clients such as Web Chat, so the end user won't see any evidence of the communication. This type of communication between client and bot is sometimes referred to as the "backchannel mechanism."
For an example of how this is done, check out Ryan Volum's backchannel sample bot.

Related

How to send messages (3 types, text only) from external service to MS Teams user; each type can be toggled ON or OFF by that user in MS Teams?

Im new to MS Teams application development and looking for suitable solution based on the following requirements. Can I have some guidance from experts?
I have a web service, which sends emails to users based on certain activity. Eg: "Survey started", "Reminder for those who didn't complete the survey" and "when the survey results are out". On top of the email notifications, I also want to send a notification to those individuals who opt-in to receive the notification in MS Teams.
My requirements are,
My web service should be able to send the notification to those
opt-in users in MS Teams as a private message and not as a message in
groups/channels.
In MS Teams, the users should have control over which notification
they wants to receive. For eg: "User A" can opt-in to receive a
notification when a survey starts & survey reminders but can opt-out
of survey results notification where as "User B" can opt-in to
receive notifications for all three.
opt-in and opt-out settings for specific notification should be
configurable in the MS Teams. My web service irrespective of the
settings, will always send the notification to MS Teams but it will
be controlled in the MS Teams side whether to show the notification
to the user or not based on the individual user settings.
Based on the above requirements, please advise what should I build in MS Teams. Whether "Tabs" is enough or "Bot" needs to be built or anything else.
Any guidance or suggestions are really appreciated. Thanks in advance.
Please find below suggestions as per your requirements:
You can use the activity feed notification APIs in Microsoft Graph
to extend this functionality or SDK methods:
Reference doc link, Reference sample link
Also you can send proactive notifications via bot to user:
Send proactive messages
You can create a configurable page and add it to your Tab, which
will be visible to all users who install the bot.
There is no way in MS Teams which will filter or control the
notification to send it to different users without any custom
configuration or condition check.

Sending a message to users as a bot in bot channel of Microsoft Teams using the Graph API

I have created a bot by following the steps mentioned in the doc.I have authenticated user using oauth 2.0 (auth code grant) as mentioned in the doc and in reverse I got a access token. But when I send message to channel in the teams using (/teams/{id}/channels/{id}/messages) API the message was sent on behalf of me. But I want my bot as the sender of message. Here is the image of the message that I have sent using the above API. and is there any way to send direct message to user as a bot?
Instead of using the Graph, there's another approach using the Bot Framework itself, to send a message to a team channel, a group chat, or a 1-1 conversation. The code doesn't even need to live inside the bot itself, it just needs to leverage the bot framework under the covers (for example, I have several Azure Functions that pro-actively message users). This idea is called "Proactive messaging" and you can read more about it in the docs here.
You do need to get certain fields when the user first installs the bot though, or any time the bot receives a message. I've described that more at Programmatically sending a message to a bot in Microsoft Teams. You haven't said what language you're using, but there are examples for a bunch of them - I can send you links if you let me know what you're using.

Add to Slack - MS Bot framework - he Bot Directory is no longer accepting new submissions

I am enabling slack channel in MS bot framework. All mentioned steps are done and from my own ID i am able to communicate with bot.
However, I when I give "Add to Slack" button to another slack user, it asks for permissions. After allowing the permission, the user is transferred to https://bots.botframework.com/ webpage where following is written:
Persmissions snapshot: Permissions snapshot before bot framework page
error page
The Bot Directory is no longer accepting new submissions. Add your bot to the Bing channel so users will not only be able to find it, but chat with it too
I have already enabled bot for public in slack settings, and users should be able to chat with bot who have the ID of bot.
Looks like some change has been done from Microsoft, which I am not aware of. Ideally it should take the user to conversation page
In order for user to chat with your bot on Slack, you DO NOT need to use that link to connect them. The method you're attempting is to give them a roundabout admin access, which won't actually work.
In order for your users to communicate with your bot, once it's properly connected to Slack, they can simply select it on the app list, like so:
Additionally, you as the admin, can add the bot to a particular channel, where the users can chat with the bot directly.

Find the address of a specific user using Microsoft bot-builder

I would like to open new conversations with users using the Microsoft Bot Builder on the Skype for Business channel. The only information I have is the user id (sip:user#domain.com)
In all the examples I could find, it is needed to save the conversation id/address of a user in a previous conversation to send a new message to this user.
How to create a new conversation as a bot to a user knowing only his id?
Thanks
Like you stated the userId is required to send a message to the user. A new conversation can be created by the framework but ultimately, you can't do anything without the userId and to obtain this the user has to contact your bot first. This is only true for channels like Skype. Other channels like E-mail just use the email address as an id. Skype uses a GUID as the id for their users. This is done so bots can't randomly add themselves to any user on Skype. Source
This doesn't mean you have to necessarily wait for the user to start a conversation. Whenever a user adds a bot to their contact list an event is send to the bot. This is the ContactRelationUpdate event. It warns the bot that a user has added the bot and the bot can then respond accordingly. Once this event is thrown you can obtain the userId from the activity and do whatever you want with it. Source

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