Skip to content

Instantly share code, notes, and snippets.

@manzke
Created February 3, 2013 23:26
Show Gist options
  • Save manzke/4704207 to your computer and use it in GitHub Desktop.
Save manzke/4704207 to your computer and use it in GitHub Desktop.
Twilio Tests
public class TwilioTests {
public static final String ACCOUNT_SID = "accountid";
public static final String AUTH_TOKEN = "token";
public static void main(final String[] args) throws TwilioRestException,
TwiMLException {
// Create a rest client
final TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID,
AUTH_TOKEN);
// Get the main account (The one we used to authenticate the client)
final Account mainAccount = client.getAccount();
// Send an sms
final SmsFactory smsFactory = mainAccount.getSmsFactory();
final Map<String, String> smsParams = new HashMap<String, String>();
smsParams.put("To", "target number");
smsParams.put("From", "your twilio number");
smsParams.put("Body", "This is a test message!");
Sms sms = smsFactory.create(smsParams);
System.out.println("send body: "+sms.getBody());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment