Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 126.96.36.199 release ready!
Owner and Founder. Opencart
So many times we need to send the SMS or OTP(One time password ) to the user mobile number through our application it can be for any purpose like verification your account , message etc and Twilio make this task more easy for us. Today i am going to share the code for send sms using twilio.
Twilio is a cloud communications platforms it makes sending and receiving SMS easy, it works as an SMS provider which will send a password to users that attempt to login with a properly configured security policy. You can integrate Twilio SMS service in your application for sending OTP SMS to authenticate the users.
For this process first thing we need to do is Sign up for a twilio account and we will get –
1. Twillio Account SID
2. Auth token
3. Twilio phone number
Now for the reference i have added some code with retrofit-
Add the retrofit dependency in build.greadle file
we will create a interface for twilio api .
In the above code ACCOUNT_SID is Twillio Account SID and Authorization is basic Authentication which is base64 of account sid and auth token.
To send sms i have passed the url with base authentication here is the code
In the above code the smsData contain these perameters-
From – the number from you want to send sms.
To – the number to which you want to send sms
Body – Message you want to send.
If your twilio account is trial account you have to add the test mobile number to the twillio account.
you can also refer their integration guide –
Hope it will help you Thanks for reading.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.