public Task SendSmsAsync(string number, string message) { if (smtp.UsePickupFolder) { string path = $@"{smtp.PickupFolder}\{number}.txt"; if (!File.Exists(path)) { // Create a file to write to. using (StreamWriter sw = File.CreateText(path)) { sw.WriteLine($"{number}"); sw.WriteLine($"Verification code: {message}"); } } } else { SmsIrRestful.Token tk = new SmsIrRestful.Token(); string result = tk.GetToken("f102ae793839867ae1ee90f4", "d@k@nB2z1&2&3@VN@87134"); RestVerificationCode messageSendObject = new RestVerificationCode() { Code = message, MobileNumber = number }; RestVerificationCodeRespone restVerificationCodeRespone = new VerificationCode().Send(result, messageSendObject); } return(Task.FromResult(0)); }
public bool Sendsms(string phoneNumber, string message, int cat, string fname, string lname) { var result = new Response(); try { SmsIrRestful.Token tokenInstance = new SmsIrRestful.Token(); var token = tokenInstance.GetToken("ca3434a7ac76118b40a34a7", "tVuqAmCHGb@Dwy3m#cXmMm"); int category = 49512; if (cat == 1) // tamland { category = 49512; } SmsIrRestful.CustomerClubContact contact = new SmsIrRestful.CustomerClubContact(); var s = contact.Create(token, new CustomerClubContactObject() { Mobile = phoneNumber, CategoryId = category, FirstName = fname, LastName = lname }); var customerClubSend = new CustomerClubSend() { Messages = new List <string>() { message }.ToArray(), MobileNumbers = new List <string>() { phoneNumber }.ToArray(), SendDateTime = null, CanContinueInCaseOfError = false }; var customerClubContactResponse = new CustomerClub().Send(token, customerClubSend); // result.Code = (int)ResponseType.Ok; // result.Message = customerClubContactResponse.Message; return(customerClubContactResponse.IsSuccessful); // return Ok(result); } catch (Exception e) { var result2 = new Response(); result2.Code = 400; result2.Message = e.Message; return(false); } }
private string GetNewToken() { SmsIrRestful.Token tk = new SmsIrRestful.Token(); return(tk.GetToken(UserApiKey, SecretKey)); }