Writing Twilio service to validate Australian mobile number

Hmm. after long time I am writing a blog post. I have been busy. Family and work take up time. You know how it is.

Recently I have given the task the validate the mobile number, lets say its for two authentication. But my purpose is different, lets leave it with that. So bottom line, you send a SMS (TXT)/Voice message to given mobile number, for SMS (TXT) based  verification will receive a 4 digits number which they will enter back. and that number get validated. You can use your own database for this if you want, but you will have to use a SMS/Voice service for the rest. But  Twilio has this build in, why not use it.

You can use the Twilio client library for this if you want, But I prefer the RESTfull interface, as I don’t want to bring many 3rd party library to my project. Lets see how it looks like (hope some one has a gun to my head, when I code to do it clean as possible.)

Interface as below

Actual implementation

DTO objects

Hope this helps


Leave a comment