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

The conversationId X and bot Y doesn't match a known conversation

Open ta4 opened this issue 9 years ago • 18 comments

I have created a new skype bot and can't send message from bot to user. Old bot works fine, issue with a new bot only.

Error: The conversationId 29:1LdWKO8GtgmCFPuspsVg8bX8TXV_-x7QHnJln2oYI8fg and bot 2df68b89-7ba6-463a-858a-0eb621b74f8e doesn't match a known conversation

ta4 avatar Jan 10 '17 11:01 ta4

I have same problem!

nkornushin avatar Jan 10 '17 12:01 nkornushin

Hi @ta4 and @nkornushin, is there any chance that you have the hostname "skype.botframework.com" hardcoded in your bot somewhere?

The issue I'm seeing is that your bot has been moved to a different server but is still using the skype.botframework.com hostname.

dandriscoll avatar Jan 10 '17 15:01 dandriscoll

I have same problem! Is "skype.botframework.com" old? Please tell me the new hostname

HiroshiKobayashi1980 avatar Jan 11 '17 08:01 HiroshiKobayashi1980

I am also suffering. Is the host name changed? If so, it will be helpful if you tell me your new hostname :)

yasuda-ss avatar Jan 11 '17 08:01 yasuda-ss

Hi @dandriscoll. What we should use instead "skype.botframework.com"?

ta4 avatar Jan 11 '17 13:01 ta4

Same problem here. I have a solution that works well on one bot/webapp. Then when I publish it to another bot/webapp it gives this error. Config is updated accordingly.

MrCharli3 avatar Jan 11 '17 13:01 MrCharli3

The hostname is in the ServiceUrl field for any activities you receive. Does that URL contain skype.botframework.com or another hostname?

dandriscoll avatar Jan 11 '17 15:01 dandriscoll

I use ConnectorClient connector1 = new ConnectorClient(new Uri("https://skype.botframework.com/")); connector1.Conversations.SendToConversation((Activity)message1);. That is the only instance of "skype.botframework.com I can find. Are you saying it should be changed to something else? Because it works on my old bot but not the new.

MrCharli3 avatar Jan 11 '17 16:01 MrCharli3

You can retrieve the ServiceUrl from activities when they are received. ServiceUrls should not be hardcoded as they may change.

dandriscoll avatar Jan 11 '17 19:01 dandriscoll

It went well! Thank you

HiroshiKobayashi1980 avatar Jan 12 '17 02:01 HiroshiKobayashi1980

@dandriscoll It's work now. But where this information we can find in documentation???

nkornushin avatar Jan 12 '17 02:01 nkornushin

@dandriscoll Thank you dandriscoll . It has solved successfully !

yasuda-ss avatar Jan 12 '17 02:01 yasuda-ss

It depends on which SDK you're using. You will not find the hostnames documented.

dandriscoll avatar Jan 12 '17 03:01 dandriscoll

I use REST API and now I see in documentation "The return value is a ResourceResponse which contains a conversation id which is suitable for use in the message payload and REST API uris." :) Thank You @dandriscoll

nkornushin avatar Jan 12 '17 03:01 nkornushin

For those of you that solved this, what in your code did you change? Maybe I'm a bit greener then the rest of you because I am still not sure what I need to change and what to change it to.

MrCharli3 avatar Jan 12 '17 08:01 MrCharli3

Still wondering What to change and where. Not sure what a serviceUrl is. Can 1 of the people that managed to solve it please show what they changed and where?

MrCharli3 avatar Jan 13 '17 09:01 MrCharli3

Hi @MrCharli3, I take from your earlier comment that you're coding in C#. If so, are you using the Bot Builder dialog system?

If yes, simply send a response and the SDK handles it for you: await context.PostAsync(message);

If you are managing inputs and outputs on your own, create the client this way:

var activity = // supplied in call to bot
var reply = activity.CreateReply();
// fill in fields for reply

if (MicrosoftAppCredentials.IsTrustedServiceUrl(activity.ServiceUrl))
{
    var client = new ConnectorClient(new Uri(activity.ServiceUrl));
    client.Conversations.ReplyToActivity(reply);
}

dandriscoll avatar Jan 13 '17 15:01 dandriscoll

Closing as we've addressed the issue and described how to store and load ServiceUrls. Please at-mention or open a new issue if you'd like to discuss further.

dandriscoll avatar Jan 28 '17 11:01 dandriscoll