BotBuilder-Samples icon indicating copy to clipboard operation
BotBuilder-Samples copied to clipboard

[.Net SDK] CreateDirectConversation does not work with the Proactive Message sample

Open dhinag opened this issue 8 years ago • 5 comments

SDK Platform

.Net 4.6

URL of Code Sample

https://github.com/Microsoft/BotBuilder-Samples/tree/master/CSharp/core-proactiveMessages

Problem Description

I am trying to use the proactive message sample to start a new conversation based on the user data that was previously cached. But, I could not get the bot to start a new conversation to the user. When I debugged the problem, I noticed that the the line which calls the "CreateDirectConversationAsync" does not return the Conversation object and does not throw any error as well. Very similar to the problem statement described in https://github.com/Microsoft/BotBuilder/issues/2738.

I can get this to work through Bot Emulator. But, when I use the Webchat channel, I run into the above problem. I went through a few articles mentioning about using the credentials explicitly and also trusting the service URL. I noticed that the service URL is coming out as "https://webchat.botframework.com".

            var connector = new ConnectorClient(new Uri("https://webchat.botframework.com"), new MicrosoftAppCredentials("yyyyyyyyy", "xxxxxxxxx"));
            MicrosoftAppCredentials.TrustServiceUrl("https://webchat.botframework.com");

            IMessageActivity newMessage = Activity.CreateMessageActivity();
            newMessage.Type = ActivityTypes.Message;
            var userAccount = new ChannelAccount(toId, toName);
            var botAccount = new ChannelAccount(fromId, fromName);

            var conversation = await connector.Conversations.CreateDirectConversationAsync(botAccount, userAccount);

I assumed that "CreateDirectConversationAsync" method works with the Webchat channel. Please correct if my understanding is incorrect.

Any pointers or ideas would be helpful to move forward with this issue.

Thank you!

dhinag avatar Jun 25 '18 00:06 dhinag

Hi @dhinag,

How are you looking to use 'var conversation' in your code? Are you looking to create a completely new thread with it's own conversationId?

stevkan avatar Jun 29 '18 14:06 stevkan

@stevkan That's correct. I am basically gathering all the messages from the storage queue for a particular user and creating a new conversation to show it to the user.

dhinag avatar Jul 03 '18 17:07 dhinag

@dhinag could you please share your app id?

JasonSowers avatar Jul 03 '18 19:07 JasonSowers

Hi @JasonSowers , here is my app id: e442b736-ce72-46cb-b578-23b0ca0b22d6

dhinag avatar Jul 04 '18 01:07 dhinag

@dhinag lets track this issue in #274 please continue the conversation in that thread so we do not have 2 going for the same thing.

JasonSowers avatar Jul 05 '18 21:07 JasonSowers