public static void Main(string[] args) { CloudRail.AppKey = "[Your CloudRail Key]"; List <ISMS> services = new List <ISMS>(); Nexmo nexmo = new Nexmo(null, "[Nexmo API Key]", "[Nexmo API Secret]"); services.Add(nexmo); Twilio twilio = new Twilio(null, "[Twilio Account SID]", "[Twilio Auth Token]"); services.Add(twilio); Twizo twizo = new Twizo(null, "[Twizo Key]"); services.Add(twizo); foreach (ISMS service in services) { try { service.SendSMS("[Sending Number]", "[Receiving Number]", "Hello from " + service); } catch (Exception e) { Console.WriteLine(e); } } }
private static void JsonExample() { Log.Info("- JsonExample -"); var textModel = new TextRequestModel {Text = "HelloWorld!"}; var requestModel = RequestModelBuilder.Create("{USERNAME}", "{PASSWORD}", "{FROM}", "{TO}", textModel); var nexmo = new Nexmo(); var responseModel = nexmo.Send(requestModel, ResponseObjectType.Json); Log.Info("- Result -"); responseModel.ReadObject(); Log.Info("- End -"); }
private void SendSMS(double pesoValue) { var nexmoBaseUrl = ConfigurationManager.AppSettings.Get("nexmoBaseUrl"); var nexmoApi = ConfigurationManager.AppSettings.Get("nexmoApi"); var mobileNumber = ConfigurationManager.AppSettings.Get("mobileNumber"); var nexmoKey = ConfigurationManager.AppSettings.Get("nexmoKey"); var nexmoSecret = ConfigurationManager.AppSettings.Get("nexmoSecret"); var textMessage = GeneratePlainMessage(pesoValue); var nexmoObj = new Nexmo("CryptoNotifier", textMessage, mobileNumber, nexmoKey, nexmoSecret); var client = new RestClient(nexmoBaseUrl); var request = new RestRequest(nexmoApi, Method.POST) { RequestFormat = DataFormat.Json }; request.AddJsonBody(nexmoObj); _ = client.Execute(request); }