private void HandleMessage(string content) { RMQMessage msgContent = JsonConvert.DeserializeObject <RMQMessage>(content); string toNumber; if (msgContent.isSendToExpert) { content = "A customer has asked you a question with following details : " + msgContent.Message + " Please click here https://bit.ly/2CWbJta to answer the question!"; toNumber = _twilloConfig.Value.ExpertNumber; } else { content = "An expert on JustAnswer responded to your question with following details : " + msgContent.Message + " Please click here https://bit.ly/2CWbJta to continue chat!"; toNumber = _twilloConfig.Value.CustomerNumber; } SendWhatsAppMessage sendWhatsApp = new SendWhatsAppMessage(); sendWhatsApp.SendMessage(_twilloConfig.Value, new SendSmsInput() { MessageBody = content, ToNumber = toNumber }); _logger.LogInformation($"consumer received {content}"); }
public ActionResult SendSms(SendSmsInput sendSmsInput) { SendWhatsAppMessage sendWhatsApp = new SendWhatsAppMessage(); var message = sendWhatsApp.SendMessage(_configuration.Value, sendSmsInput); return(Content("Sid : " + message.AccountSid + " Body : " + message.Body)); }
public static void SendMessage() { var mobileNo = "whatsapp:+Number"; var url = new Uri("URL"); var body = "Hello There! Please find your receipt."; List <Uri> uriList = new List <Uri>(); uriList.Add(url); try { log.Info(SendWhatsAppMessage.SendMessageAsync(mobileNo, body, uriList).GetAwaiter().GetResult()); } catch (Exception ex) { log.Error(ex); } }