When a bot chat with a user individually or in a group, the API returns different user ids. How can I know it's the same person?
Skype user's information fields looks like the following "from": { "id": "29:1DwlGVzj.....", "name": "My Skype Name" } (and bot's id is "28:appId").
This user id is a specific to your bot, it is a hash but the way it is generated is not known (not open-source). But this id is identidical for a unique user when talking individually with the bot or inside a group conversation with the same bot.
See sample here, I just checked:
Direct message between user and bot:
Group conversation including same user and same bot:
I've hidden some characters of the id in case of... but I confirm they are exactly the same values.
See also questions around the same problems:
For more details about the different channels and the ID format: Authenticate user across channels in Microsoft bot Framework
Get Skype ID from Activity object Bot Framework V3
Getting Skype Identity In Bot Framework?
Related
I have a message extension app for MS TEAMS. This app will be preinstalled inside some organization. I should get members of any conversation type. There is a way via a graph
https://graph.microsoft.com/v1.0/groups/{group-id-for-teams}/members. I use application permission here.
But it looks like I can get users only for "group" (a team is inside Teams), which has channels.
I got 4 types of conversation type from ChannelAccount (namespace Microsoft.Bot.Schema):
personal
groupChat,
channel,
null
Also, there is bool isGroup property.
How can I get members of a specific chat, which can be any conversation type?
You can use this set of endpoints to access both group chat and channel members. You don't technically need to get the "members" of a 1-1 chat, because it is only individual users (if you add a 3rd user, for instance, it will switch to becoming a group chat, I think). If you -do- want to get the -existence- of these 1-1 chats, you can use this endpoint. Note that these are both BETA endpoints, so some caveats apply.
I'm able to open Teams chat with a specified contact using 'sip:example#emailaddress.com' but 'msteams:example#emailaddress.com' only opens the application; it does not open chat with the specified individual.
Is there, or will there be, a scheme which allows for opening chat with an individual using the 'msteams:' uri similar to 'skype:example#emailaddress.com'?
Updated answer
try this Teams Chat
This will open a private conversation with the user in ms teams
Currently this is not supported for Microsoft Teams but it's on our roadmap.
https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/deep-links
Find the Chat deeplink, and embed elsewhere.
Example: With one or more users can be specified.
Example: https://teams.microsoft.com/l/chat/0/0?users=joe#contoso.com,bob#contoso.com&topicName=Prep%20For%20Meeting%20Tomorrow&message=Hi%20folks%2C%20kicking%20off%20a%20chat%20about%20our%20meeting%20tomorrow
The query parameters are:
users The comma-separated list of user IDs representing the participants of the chat. The user performing the action is always included as a participant. The User ID field currently only supports the Azure AD UserPrincipalName (typically an email address).
topicName An optional field for chat's display name, in the case of a chat with 3 or more users. If this field is not specified, the chat's display name will be based on the names of the participants.
message An optional field for the message text that you want to insert into the current user's compose box while the chat is in a draft state.
Note that the link will only open a chat if the users are in your tenant. For federated users it will only open if you previously had a chat window with them.
I need to develop enhancements to an existing app which will interact with a bot developed using MS bot framework. For this, I am thinking of utilising the Direct Channel. However, I dont understand, how I can pass on user specific information from the app to the bot.
In documentation available at https://learn.microsoft.com/en-us/bot-framework/rest-api/bot-framework-rest-direct-line-3-0-send-activity,
It is mentioned that the payload of the REST request would be
{
"type": "message",
"from": {
"id": "user1"
},
"text": "hello"
}
Where should I pass on the user specific or sessions information like user first name, last name, email id or Login id or initiating app or location from where the user is initiating the chat or anything else here ?
Any guidance will help.
How can I start a conversation with user data like user name, user domain ID
As NicolasR pointed, it does not enable us to attach/specify user information when starting a conversation on Direct Line Channel.
how I can pass on user specific information from the app to the bot
If you’d like to send activity and pass user information (firstname, lastname etc) to your bot by using the Direct Line API, as you see in that documentation, to send an activity to the bot, the client must create an Activity object to define the activity. You can refer to the following example request to contains the user information in from field of your request JSON payload.
In my bot app code (c#), I can extract user information from Activity object using the following code snippet.
if (activity.From.Properties["firstname"] != null)
{
var fname = activity.From.Properties["firstname"].ToString();
}
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
I am wanting to be able to post messages to Skype users via my bot, ideally the message would be posted using the users email address however the channel account for the user only has Id and Name.
Why does Skype not provide this information on the Activity?