Build the future of communications.
Start building for free

0 to 60 with Java – Sending an SMS in a Minute


Would you laugh if I told you that you could send an SMS message in 60 seconds with Java? Well stop what you’re doing and believe my friend.

Video: Sending an SMS in 60 seconds with Java

Play Along At Home

To get going on your own you’ll need a few things.

If you need help setting things up I’ve got a great blog post for you.

Once you have the Twilio library downloaded, create a new file named with the following code and plug in your credentials and phone numbers.

Note the following snippet uses the updated version of the Java helper library.

// Install the Java helper library from
import com.twilio.Twilio;
import com.twilio.type.PhoneNumber;

public class Example {
 // Find your Account Sid and Token at
 public static final String ACCOUNT_SID = "YOUR_ACCOUNT_SID";
 public static final String AUTH_TOKEN = "YOUR_AUTH_TOKEN";

 public static void main(String[] args) {

 Message message = Message
 .creator(new PhoneNumber("YOUR_PHONE_NUMBER"), new PhoneNumber("YOUR_TWILIO_NUMBER"),
 "Ahoy from Twilio!").create();


And just like that you are sending caffeinated text messages!

What’s Next?

We can’t wait to see what you build with a fresh cup of one of our favorite programming languages.

Head on over to the new Tutorials by Twilio for some inspiration and guidance. I dig the Automated Survey one that’s built with the Spark Framework.

Let me know on Twitter or in the comments where you go from here.

Sign up and start building
Not ready yet? Talk to an expert.