Twilio SMS API Part-1

1) Go to for Register like

Twilio register

2) Click Add Caller button on Numbers Tab in dashboard to verify after you will see popup then put your USA phone number than click ok.

Twilio phone number config

3) Then you will get call from Twilio for verify phone number because you are using trail version.
4) Twilio server ask to type 6 digit pin that you need to enter in that phone.
5) If you don’t have US number you can get trail account from
6) After verified you can send sms to that number only(trial version) using following Twilio Code from JAVA

For sending SMS (Code from TWILIO)

* To change this template, choose Tools | Templates
* and open the template in the editor.

package twilioapp;

import java.util.HashMap;
import java.util.Map;

import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.TwilioRestResponse;

public class Main {
/* Twilio REST API version */

public static final String APIVERSION = “2010-04-01”;
public static final String ACCOUNTSID = “AC66a1b1xxxxxxxxxxxxxxxxxxxxx”;
public static final String AUTHTOKEN = “7b36a648ffxxxxxxxxxxxxxxxxxxxx”;

public static void main(String args[]){

/* Instantiate a new Twilio Rest Client */
TwilioRestClient client = new TwilioRestClient(ACCOUNTSID, AUTHTOKEN, null);

//build map of server admins
Map<String,String> admins = new HashMap<String,String>();
admins.put(“(469) 442-4522”, “Raja”);

// Iterate over all our server admins
for (Map.Entry<String, String> entry : admins.entrySet()) {
// Send a new outgoinging SMS by POST’ing to the SMS resource */
// YYY-YYY-YYYY must be a Twilio validated phone number

//build map of post parameters
Map<String,String> params = new HashMap<String,String>();
params.put(“From”, “(415) 599-2671”);
params.put(“To”, entry.getKey());
params.put(“Body”, “9620-8805 UNSUBSCRIBE “);

TwilioRestResponse response;
try {
response = client.request(“/”+APIVERSION+”/Accounts/”+client.getAccountSid()+”/SMS/Messages”, “POST”, params);

System.out.println(“Error send SMS: “+response.getHttpStatus()+”\n”+response.getResponseText());
else {
System.out.println(“Success sending SMS: ” + response.getResponseText());
} catch (TwilioRestException e) {



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s