/// <summary> /// POST: api/Messages /// Receive a message from a user and reply to it /// </summary> public async Task <HttpResponseMessage> Post([FromBody] Activity activity) { new Thread(() => { if (activity.ChannelId == ChannelIds.Facebook) { Thread.CurrentThread.IsBackground = true; FacebookClient fbClient = new FacebookClient(); fbClient.SendTyping(activity.From.Id); } }).Start(); if (activity.Type == ActivityTypes.Message) { //Reset conversation on facebook start //if(activity.Text == "STARTED_CON") // activity.GetStateClient().BotState.DeleteStateForUser(activity.ChannelId, activity.From.Id); await Conversation.SendAsync(activity, () => RootDialog.StartWithHelloChain()); } else { await HandleSystemMessage(activity); } var response = Request.CreateResponse(HttpStatusCode.OK); return(response); }