Updating your Post method

Let's use the following code to update your Post method:

public async Task<HttpResponseMessage> Post([FromBody]Activity activity)         {             if (activity.Type == ActivityTypes.Message)             {                 ConnectorClient connector = new ConnectorClient(new                 Uri(activity.ServiceUrl));                 StateClient stateClient = activity.GetStateClient();                 Query Result = new Query();                 try                 {                     if (activity.Text != null)                     {                         string strContextId = "";                         BotData userData = await                          stateClient.BotState.GetUserDataAsync                        (activity.ChannelId, activity.From.Id);                         if (userData.GetProperty<string>                        ("contextId")!=null)                         {                             // If we have a ContextId saved in TempData                             // retrieve it                             strContextId = userData.GetProperty<string>                             ("contextId").ToString();                         }  LUIS objLUISResult ...

Get Building Bots with Microsoft Bot Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.