botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[Question] Inconsistent ConversationIds for Skype

Open thschuetze opened this issue 9 years ago • 7 comments

Hi, we have noticed that we are getting inconsistent ConversationIds from Skype when trying to start a conversation with a user. Example: The skype userId is "29:1rOLHgXLKzajdOQVUz8MR-SF..." and all user initiated conversations seem to use that userId as conversationId. When initiating a conversation from the bots side (via connectorClient.Conversations.CreateDirectConversationAsync), we get a different conversationId for that user, "8:live:jami...". So we use that conversationId ("8:live:...") to send a question to the user. The user receives the message, but the response is not using the conversationId we just got, but its userId "29:1rO...." again.

The problem is that our bot/dialog stores data in the BotState that it needs to handle the users response. But since the users response is using the wrong conversationId it can't find the BotState. This approach works for all channels but Skype.

Is that a bug in the Skype backend or on purpose? Thanks :)

thschuetze avatar Aug 04 '17 08:08 thschuetze

@thschuetze For reference, are you using .NET or Node.js SDK?

nwhitmont avatar Aug 04 '17 18:08 nwhitmont

.Net SDK v3.9.0

thschuetze avatar Aug 04 '17 18:08 thschuetze

@EricDahlvang any thoughts?

JasonSowers avatar Aug 15 '17 18:08 JasonSowers

Hi @thschuetze

This is a known quirk in Skype. Please see: https://docs.microsoft.com/en-us/bot-framework/resources-identifiers-guide#conversation-id

Several channels (e.g., SMS, Skype, and possibly others) have the quirk that the conversation ID assigned to a 1:1 conversation is the remote channel account ID. This quirk has two side-effects: The conversation ID is subjective based on who is viewing it. If Participants A and B are talking, participant A sees the conversation ID to be "B" and participant B sees the conversation ID to be "A." If the bot has multiple channel accounts within this channel (for example, if the bot has two SMS numbers), the conversation ID is not sufficient to uniquely identify the conversation within the bot's field of view. Thus, a conversation ID does not necessarily uniquely identify a single conversation within a channel even for a single bot.

EricDahlvang avatar Aug 15 '17 21:08 EricDahlvang

@thschuetze Are you using a custom state client, or the default? Please share the code you are using to manipulate state data.

EricDahlvang avatar Aug 15 '17 22:08 EricDahlvang

Hi @EricDahlvang thank you for your reply.

The guide you posted is not really explaining why Skype is returning what seems to be the "real" (bot-independent) skype id of the user ("8:live:jami...") instead of the bot-specific user id ("29:1rOLHgXLKzajdOQVUz8MR-SF...") when creating a new conversation...

But the takeaway is that Skype conversationIds are not reliable and we should not use it to store BotData.

We are using a custom state client similar to this one (https://github.com/Microsoft/BotBuilder-Azure/blob/master/CSharp/Library/Microsoft.Bot.Builder.Azure/TableBotDataStore.cs) that uses the conversationId as key. Does the default state client use the conversationId internally to store the data? And how does it work around this inconsistency?

PS: As a workaround we ignore the conversationId Skype sends back and use the users id, but that will fail when/if Skype changes the way they create/handle conversationIds.

thschuetze avatar Aug 16 '17 09:08 thschuetze

glad you found a work around, closing this issue but feel free to continue the conversation here if needed.

JasonSowers avatar Sep 06 '17 22:09 JasonSowers