To get user details from Chat of MS BoT Framework - botframework

We want to build a BoT and want to target 3 channels Webchat, Teams and Email. For these channels can we capture the logged in user.
Don’t think we can do in Web Chat channel.
In teams -- can we capture the email id of the logged in user chatting with BoT?
in email channel -- can we capture the sender email id who has emailed to our BoT?
any sample code?

The IDs are included in the JSON sent to your bot when it receives a message (see "From"). Here is an example (from an email received by a bot):
{
"type": "message",
"id": "AAMkAD....",
"timestamp": "2017-01-09T21:18:06.113698Z",
"serviceUrl": "https://email.azurewebsites.net/",
"channelId": "email",
"from": {
"id": "**EMAIL HERE**",
"name": "**USER NAME HERE**"
},

Related

Teams file consent card not sending "accept" activity to bot handler while implementing Teams Bot API , it is showing went wrong

We have a Teams bot installed for internal company use and it is capable of sending files to our users. Our application that handles the bot does not receive the file consent allow activity but decline activity is working fine , as said in the documentation we have implemented it .
will you pls help me out with the issue .
I'm using the proper documentation of Microsoft teams passing these values but not getting the result.
attachments": [{
"contentType": "application/vnd.microsoft.teams.card.file.consent",
"name": "result.txt",
"content": {
"description": "Text recognized from image",
"sizeInBytes": 4348,
"acceptContext": {
"resultId": "1a1e318d-8496-471b-9612-720ee4b1b592"
},
"declineContext": {
"resultId": "1a1e318d-8496-471b-9612-720ee4b1b592"
}
}
}]

Webex Bot framework how to show user selected button text

I'm using MS Teams bot and Webex teams bot, I have some Adaptive-Card buttons on my bot message and I want to know which Adaptive Card button is pressed, by wrting it as a user message.
In MS Teams I can do that:
{
"type": "Action.Submit",
"title": "Click me for imBack",
"data": {
"msteams": {
"type": "imBack",
"value": "Text to reply in chat"
}
}
}
How can I do it in webex? I cannot find any documentaion talking about it
You can make use of the Bot Builder Community Webex Adapter. There is also a sample that shows how to use it (C# linked).

Create MSTeams Personal chat with customized name

We are trying the following payload using MSTeams Bot access Token to create the Personel chat Room with the provided topicName.
Request : POST /v3/conversations
{
"bot": {
"id": "28:XXXXXXXX-a2Xe-460b-8793-XXXXXXXXXXXX",
"name": "XXXXXXXX"
},
"isGroup": false,
"members": [
{
"id": "29:18KXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"name": "Jane"
}
],
"topicName": "News",
"tenantId": "XXXXXX-XXXX-XXX-829b-5131e9a77XXX"
}
In response we got the resource id and we can post Bot message using that Id. But that message is always shown in the Personal Chat \room and it is not creating c chat with the topicName.
Is there any other permissions we need to add ?
To create a chat with customized name you should have minimum 3 participants[Including you]. In the above request only one user is there, that is why it becomes one-one personal chat between you and Jane.

Correct id to send message to a skype account

I am trying to test my bot by sending a message to my skype account. I can't find a way how to contact myself what is the members.id id suppossed to be? I tried Skype Name but can't find any other id suitable and the docs are not very helpful.
I started a conversation:
{
"bot": {
"id": "2",
"name": "bot's name"
},
"isGroup": false,
"members": [
{
"id": "123", <----------------- WHAT SHALL BE HERE?
"name": "My Account"
}
],
"topicName": "News Alert"
}
The id for the conversation is { "id": "123" }.
I could find the bot from the Skype app but I never receive anything.
You can get the ID of user by checking the Activity.From.Id property when s/he sends a message.
Also please note that in case of Skype and Facebook user IDs are altered for each user.
So each user has different ID for each Bot, and that ID is not the Skype (or Facebook) ID, as mentioned in documentation

Is botId that bot scoped? Is it permanent?

Is the botId that I receive in the webhook only bot scope or is it unique across all the bots found?
Is it permanent or can it be changed?
By botId I mean the id in recipient.id and replyToId that you fill in send message request to endpoint https://smba.trafficmanager.net/apis/v3/conversations/{{skype.idRecipient}}/activities:
{
"text": "God help us!",
"type": "message",
"from": {
"id": "{{skype.idBot}}",
"name": "bot"
},
"recipient": {
"id": "{{skype.idRecipient}}",
"name": "user"
},
"replyToId": "{{skype.idBot}}"
}
The ID you are talking about is unique only in the current channel (Skype/Facebook/Slack...) as it is the ID of ChannelAccount.
Here are some statements from documentation:
Every bot and user has an account within each channel. The account
contains an identifier (id) and other informative bot non-structural
data, like an optional name.
Also
Channel accounts have meaning only within their associated channel
So it's not excluded that id may be repeated on another channels.
And what about permanency, it depends on the channel you use as stated in documentation again:
The stability of associations between IDs, accounts, mailboxes, and
people depends on the channel
But if you want it to be "unique across all the bots found" then you can create an id by combining AppID, ChannelID and User ID.
Also here is a quite informative guide about IDs in Bot Framework which may be helpful to you

Resources