Bad Request exception in CreateConversationAsync() method
HI Team,
I am trying to send a proactive message to user but getting error in last line, CreateConversationAsync() method. It throws Microsoft.Bot.Connector.ErrorResponseException
Code Sample :
string appId = ConfigurationManager.AppSettings["MicrosoftAppId"];
string appPassword = ConfigurationManager.AppSettings["MicrosoftAppPassword"];
var appCredentials = new MicrosoftAppCredentials(appId, appPassword);
var connector = new ConnectorClient(new Uri(serviceUrl), appCredentials);
MicrosoftAppCredentials.TrustServiceUrl(serviceUrl, DateTime.MaxValue);
IMessageActivity message2 = Activity.CreateMessageActivity();
message2.Type = ActivityTypes.Message;
message2.Text = "Testing group proactive message";
List
Output:
An error has occurred. Operation returned an invalid status code 'BadRequest' ExceptionType - Microsoft.Bot.Connector.ErrorResponseException StackTrace - at Microsoft.Bot.Connector.Conversations.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Connector.ConversationsExtensions.d__1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Indigo_ProactiveMessages.ConversationStarter.d__7.MoveNext() in C:\Users\documents\visual studio 2015\Projects\ProactiveMessages\ProactiveMessages\ConversationStarter.cs:line 102 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Indigo_ProactiveMessages.CustomWebAPIController.d__0.MoveNext() in C:\Users\documents\visual studio 2015\Projects\ProactiveMessages\ProactiveMessages\Controllers\CustomWebAPIController.cs:line 25
Closing this as we are closing this repository and will no longer maintain it. The Teams code snippets in this sample are replicated in the ASP.NET Core Graph Snippets sample. We apologize for any inconvenience.