-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathSendSMSWithVerificationCode.cs
More file actions
47 lines (39 loc) · 1.43 KB
/
SendSMSWithVerificationCode.cs
File metadata and controls
47 lines (39 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using Telesign;
namespace TelesignEnterprise.Example.VerifySms
{
class SendSMSWithVerificationCode
{
static void Main(string[] args)
{
string customerId = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890";
string apiKey = "EXAMPLETE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw==";
string phoneNumber = "phone_number";
string verifyCode = "12345";
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["verify_code"] = verifyCode;
try
{
VerifyClient verifyClient = new VerifyClient(customerId, apiKey);
RestClient.TelesignResponse telesignResponse = verifyClient.Sms(phoneNumber, parameters);
Console.WriteLine("Please enter your verification code:");
string code = Console.ReadLine().Trim();
if (verifyCode == code)
{
Console.WriteLine("Your code is correct.");
}
else
{
Console.WriteLine("Your code is incorrect.");
}
}
catch (Exception e)
{
Console.WriteLine(e);
}
Console.WriteLine("Press any key to quit.");
Console.ReadKey();
}
}
}