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

Entering an existing conversation from DirectLine - FORBIDDEN RESPONSE

Open rodzillarr opened this issue 10 years ago • 1 comments

The C# code below errors with a forbidden response even though I'm using a valid Secret for my client. I'm doing this from the debug client as opposed to the live client, is this supported? Anything jump out at anybody? TIA

            //using a valid secret
            var creds = new DirectLineClientCredentials(Constants.Constants.DirectLineSecret);

            var uri = new Uri("https://directline.botframework.com");
            var client = new DirectLineClient(uri, creds);
            var conversations = new Conversations(client);
            var token = new Tokens(client);
            //this is an existing valid conversation id
            token.RenewToken(conversationId);

            var message = new Message(conversationId: conversationId, text: "fawesome");
            conversations.PostMessage(conversationId, message);
`

rodzillarr avatar May 12 '16 18:05 rodzillarr

I think you're overdoing it. :)

If you want to restart an existing conversation:

var client = new DirectLineClient(secret); var message = ... client.Conversations.PostMessage(conversationId, message);

dandriscoll avatar May 13 '16 01:05 dandriscoll