/// <summary> /// POST: api/Messages /// Receive a message from a user and reply to it /// </summary> public async Task <Message> Post([FromBody] Message message) { if (message.Type == "Message") { if (message.Text.ToLowerInvariant() == "testui") { var reply = message.CreateReplyMessage(); await DisplayUtils.AddActionsToMessage(reply, new BotFlow("Hi!", null) { Options = new List <DialogOption>() { new DialogOption("Option A") } }); return(reply); } else if (message.Text.ToLowerInvariant() == "countchars") { // calculate something for us to return int length = (message.Text ?? string.Empty).Length; // return our reply to the user return(message.CreateReplyMessage($"You sent {length} characters")); } else if (message.Text.ToLowerInvariant() == "testdialog") { return(await Conversation.SendAsync(message, () => new OptionsDialog(new BotFlow("Hello", null) { Options = new List <DialogOption>() { new DialogOption("dog") } }))); } else { // calculate something for us to return int length = (message.Text ?? string.Empty).Length; // return our reply to the user return(message.CreateReplyMessage($"You sent {length} characters")); } } else { return(HandleSystemMessage(message)); } }