diff --git a/src/TeleSign.Services.Verify/RawVerifyService.cs b/src/TeleSign.Services.Verify/RawVerifyService.cs index 94f0e21..8a31f0e 100644 --- a/src/TeleSign.Services.Verify/RawVerifyService.cs +++ b/src/TeleSign.Services.Verify/RawVerifyService.cs @@ -387,15 +387,19 @@ private static Dictionary ConstructVerifyArgs( args.Add("verify_code", verifyCode.ToString()); } - args.Add("language", language); + if (!string.IsNullOrEmpty(language)) + { + args.Add("language", language); + } - if (verificationMethod == VerificationMethod.Sms || verificationMethod == VerificationMethod.Push || verificationMethod == VerificationMethod.TwoWaySms) + if (verificationMethod == VerificationMethod.Sms || verificationMethod == VerificationMethod.Push) { args.Add("template", messageTemplate); } if (verificationMethod == VerificationMethod.TwoWaySms) { + args.Add("message", messageTemplate); args.Add("validity_period", validityPeriod); args.Add("ucid", useCaseId); } diff --git a/src/TeleSign.TeleSignCmd/Commands.cs b/src/TeleSign.TeleSignCmd/Commands.cs index 94381ad..d2510ec 100644 --- a/src/TeleSign.TeleSignCmd/Commands.cs +++ b/src/TeleSign.TeleSignCmd/Commands.cs @@ -241,6 +241,32 @@ public static void SendSms(string[] args) } } + [CliCommand(HelpString = "Help me")] + public static void SendTwoWaySms(string[] args) + { + CheckArgument.ArrayLengthAtLeast(args, 1, "args"); + + string phoneNumber = args[0]; + string message = string.Empty; + + if (args.Length >= 2) + { + message = args[1]; + } + + try + { + VerifyService verify = new VerifyService(GetConfiguration()); + VerifyResponse verifyResponse = null; + verifyResponse = verify.SendTwoWaySms(phoneNumber, message); + Console.WriteLine("Sent two way sms"); + } + catch (Exception x) + { + Console.WriteLine("Error: " + x.ToString()); + } + } + private static void PerformVerify(string[] args, VerificationMethod method) { CheckArgument.ArrayLengthAtLeast(args, 1, "args");