Ejemplo n.º 1
0
        public ActionResult SendMessageToClient(Record record)
        {
            try
            {
                var messageForClient = string.Format($"Buna ziua dl/dna {record.ClientName}. \n\r Va informam ca asigurarea dvs urmeaza sa expire pe data de {record.ExpirationDateString}. \n\r Va asteptam la noi pentru a prelungi valabilitatea acesteia. O zi buna. Echipa MobaTehnic. ");

                var client = new Nexmo.Api.Client(creds: new Nexmo.Api.Request.Credentials
                {
                    ApiKey    = "e12689ef",
                    ApiSecret = "P9iflKUmKi9lbjkE"
                });
                var results = client.SMS.Send(request: new SMS.SMSRequest
                {
                    from = "MobaTehnic",
                    to   = "40760073998",
                    text = string.Format($"Va informam ca asigurarea dvs urmeaza sa expire pe data de {record.ExpirationDateString}. \n\r O zi buna. Echipa MobaTehnic.")
                });

                return(Json(new { messageSent = true }));
            }
            catch (Exception ex)
            {
                return(Json(new { messageSent = false }));
            }
        }
Ejemplo n.º 2
0
 static void Main(string[] args)
 {
     var client = new Nexmo.Api.Client(creds: new Nexmo.Api.Request.Credentials {
         ApiKey = "a13c5956", ApiSecret = "It62MH4bBVU9k7BZ"
     });
     var result = client.SMS.Send(request: new Nexmo.Api.SMS.SMSRequest {
         from = "NexmoDemo", to = "6584531029", text = "Send Chinese to Melody's Phone: 中文测试", type = "unicode"
     });
 }
Ejemplo n.º 3
0
        public static SMS.SMSResponse SendSignedSms(string TO_NUMBER, string NEXMO_BRAND_NAME, string message, string NEXMO_API_KEY, string NEXMO_API_SIGNATURE_SECRET, SmsSignatureGenerator.Method method)
        {
            var client = new Nexmo.Api.Client(new Nexmo.Api.Request.Credentials()
            {
                ApiKey         = NEXMO_API_KEY,
                SecuritySecret = NEXMO_API_SIGNATURE_SECRET,
                Method         = method
            });
            var results = client.SMS.Send(new SMS.SMSRequest
            {
                from = NEXMO_BRAND_NAME,
                to   = TO_NUMBER,
                text = message
            });

            return(results);
        }
Ejemplo n.º 4
0
 private bool EnviarCodigoSMS(ClientesModel model)
 {
     try
     {
         var client = new Nexmo.Api.Client(creds: new Nexmo.Api.Request.Credentials
         {
             ApiKey    = VariablesModel.getVariableValue("ApiKeyNexmo"),                  //"513e39de",
             ApiSecret = VariablesModel.getVariableValue("ApiSecretNexmo"),               //"9CaNjhJGjDW9pp0q"
         });
         var results = client.SMS.Send(request: new SMS.SMSRequest
         {
             from = "ACMarket",
             to   = "+52" + model.TELEFONO,
             text = "Tu còdigo de activaciòn acmarket es: " + model.CODIGO
         });
         return(true);
     }
     catch (Exception e) {
         LogModel.registra("Error al enviar sms código de verificacíon", e.ToString());
     }
     return(false);
 }