How to send OTP by Twilio SMS

 //Twilio SMS sender
        public static void SendSMS(string countryCode,string ToMobileNo,string otp)
        {
            
            TwilioClient.Init(TwilioAccountSid, TwilioAuthToken);
//pass your Accound sid and Auth tocken in TwilioClient.Init method
            var message = MessageResource.Create( 
                body: "Otp for your account: " + otp,
                from: new Twilio.Types.PhoneNumber(TwilioPhoneNumber),
                to: new Twilio.Types.PhoneNumber("+" + countryCode + ToMobileNo)
            );            
        }
Posted in: C#

Leave a Reply

Your email address will not be published. Required fields are marked *