public string sendSMStoPhoneTel(string Message, string Mobile) { string customerId = "F246C360-8CFD-443D-9227-D30134043B75"; string apiKey = "BdcTq1dXhaCnhKENlxEXzhYWm8B1Du/0bYDXMR8Ex+7Q3M9fMkFXQXiLzC6EdFovA7yIg7MYxigCj0UkkkpZwg=="; string phoneNumber = "919629987977"; string verifyCode = "12345"; string message = string.Format("Your code is {0}", verifyCode); string messageType = "OTP"; try { MessagingClient messagingClient = new MessagingClient(customerId, apiKey); RestClient.TelesignResponse telesignResponse = messagingClient.Message(phoneNumber, message, messageType); } catch (Exception e) { Console.WriteLine(e); } //Console.WriteLine("Press any key to quit."); //Console.ReadKey(); return(""); }
public void TestMessagingClientMessage() { var client = new MessagingClient(this.customerId, this.apiKey, string.Format("http://localhost:{0}", this.mockServer.Port)); client.Message("15555555555", "TestMessagingClientMessage", "ARN"); Assert.AreEqual("POST", this.requests.Last().HttpMethod, "method is not as expected"); Assert.AreEqual("/v1/messaging", this.requests.Last().RawUrl, "path is not as expected"); Assert.AreEqual("phone_number=15555555555&message=TestMessagingClientMessage&message_type=ARN", this.requestBodies.Last()); Assert.AreEqual("application/x-www-form-urlencoded", this.requestHeaders.Last()["Content-Type"], "Content-Type header is not as expected"); Assert.AreEqual("HMAC-SHA256", this.requestHeaders.Last()["x-ts-auth-method"], "x-ts-auth-method header is not as expected"); Guid dummyGuid; Assert.IsTrue(Guid.TryParse(this.requestHeaders.Last()["x-ts-nonce"], out dummyGuid), "x-ts-nonce header is not a valid UUID"); DateTime dummyDateTime; Assert.IsTrue(DateTime.TryParse(this.requestHeaders.Last()["Date"], out dummyDateTime), "Date header is not valid rfc2616 format"); Assert.IsNotNull(this.requestHeaders.Last()["Authorization"]); }
protected void Timer1_Tick(object sender, EventArgs e) { DateTime current = DateTime.Now; dayOfWeek = current.DayOfWeek.ToString(); hour = current.Hour.ToString(); minute = current.Minute.ToString(); second = current.Second.ToString(); now.InnerText = dayOfWeek + " " + hour + ":" + minute + ":" + second; try { if (dayOfWeek.ToLower() == "thursday") { if (hour == "15" && minute == "30") { if (canSendText) { MessagingClient messagingClient = new MessagingClient(customerId, apiKey); RestClient.TelesignResponse telesignResponse = messagingClient.Message(phoneNumber, message, messageType); canSendText = false; } } } } catch (Exception ex) { Console.WriteLine(ex); } }
public static void SendSMS(string phoneNumber, string content) { string customerId = "A7B64D9C-9375-433A-87FE-90454D6F2429"; string apiKey = "sDfY84uHPfzViXCLXejqkuP0uAzlUKrC1DbwKoNYrBXj6qmzb/WOxvyO1xjGtfnJA9YOzaa9ZTSZeKz2pTzhMA=="; string message = content; string messageType = "ARN"; try { MessagingClient messagingClient = new MessagingClient(customerId, apiKey); RestClient.TelesignResponse telesignResponse = messagingClient.Message(phoneNumber, message, messageType); } catch (Exception e) { Console.WriteLine(e); } Console.WriteLine("Press any key to quit."); Console.ReadKey(); }
public static void SendTeleSignSMS(string templateName, UserLogin user, Book book, Reservation reserve) { string filePath = @"C:\Users\@dm1n\Desktop\GitRepository\API\API\API\Content\templates\ReserveACopy.txt"; string templateContent = File.ReadAllText(filePath); string customerId = "A7B64D9C-9375-433A-87FE-90454D6F2429"; string apiKey = "sDfY84uHPfzViXCLXejqkuP0uAzlUKrC1DbwKoNYrBXj6qmzb/WOxvyO1xjGtfnJA9YOzaa9ZTSZeKz2pTzhMA=="; templateContent = Notification.TemplateParser(templateContent, user, book, reserve); string message = templateContent; string messageType = "ARN"; try { MessagingClient messagingClient = new MessagingClient(customerId, apiKey); RestClient.TelesignResponse telesignResponse = messagingClient.Message(user.PhoneNumber, message, messageType); } catch (Exception e) { } }
static void Main(string[] args) { string customerId = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890"; string apiKey = "EXAMPLETE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw=="; string phoneNumber = "phone_number"; string message = "You're scheduled for a dentist appointment at 2:30PM."; string messageType = "ARN"; try { MessagingClient messagingClient = new MessagingClient(customerId, apiKey); RestClient.TelesignResponse telesignResponse = messagingClient.Message(phoneNumber, message, messageType); } catch (Exception e) { Console.WriteLine(e); } Console.WriteLine("Press any key to quit."); Console.ReadKey(); }
static void Main(string[] args) { string customerId = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890"; string apiKey = "EXAMPLETE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw=="; string phoneNumber = "phone_number"; string verifyCode = "12345"; string message = string.Format("Your code is {0}", verifyCode); string messageType = "OTP"; try { MessagingClient messagingClient = new MessagingClient(customerId, apiKey); RestClient.TelesignResponse telesignResponse = messagingClient.Message(phoneNumber, message, messageType); } catch (Exception e) { Console.WriteLine(e); } Console.WriteLine("Press any key to quit."); Console.ReadKey(); }