Created
February 3, 2013 23:26
-
-
Save manzke/4704207 to your computer and use it in GitHub Desktop.
Twilio Tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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