public async Task <IActionResult> SendMessage(MessageViewModel message) { if (!ModelState.IsValid) { return(Ok(new { message = "" })); } string humanId = User.GetUserId(); _msg.BotId = BotExtentions.BotId; _msg.HumanId = humanId; _msg.MessageBody = new Regex("[^ء-يa-z A-Z0-9]").Replace(message.MessageBody, ""); _msg.SenderIsBot = false; await _msg.InsertAsync(_msg); var classifications = await _wordClassification.GetClassificationInMessageAsync(_msg.MessageBody); string botMsg = await _botSpeech.GenerateBotSpeech(_msg.MessageBody, classifications); _msg.MessageBody = botMsg; _msg.SenderIsBot = true; await _msg.InsertAsync(_msg); return(Ok(new { message = botMsg })); }