Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,20 @@ If you want to compile it yourself, here's how:

## Quickstart

### Send a SMS
### Initialize the client

```java
String accountSid = "ACXXXXXX"; // Your Account SID from www.twilio.com/user/account
String authToken = "XXXXXXXX"; // Your Auth Token from www.twilio.com/user/account
// Find your Account SID and Auth Token at twilio.com/console
// DANGER! This is insecure. See http://twil.io/secure
String accountSid = "ACXXXXXX";
String authToken = "XXXXXXXX";

Twilio.init(accountSid, authToken);
```

### Send a SMS

```java
Message message = Message.creator(
new PhoneNumber("+15558881234"), // To number
new PhoneNumber("+15559994321"), // From number
Expand All @@ -79,11 +85,6 @@ System.out.println(message.getSid());
### Make a call

```java
String accountSid = "ACXXXXXX"; // Your Account SID from www.twilio.com/user/account
String authToken = "XXXXXXXX"; // Your Auth Token from www.twilio.com/user/account

Twilio.init(accountSid, authToken);

Call call = Call.creator(
new PhoneNumber("+15558881234"), // To number
new PhoneNumber("+15559994321"), // From number
Expand All @@ -95,6 +96,20 @@ Call call = Call.creator(
System.out.println(call.getSid());
```

### Use a different client

```java
TwilioRestClient client = new TwilioRestClient.Builder(accountSid, authToken).build();

Message message = Message.creator(
new PhoneNumber("+15558881234"), // To number
new PhoneNumber("+15559994321"), // From number
"Hello world!" // SMS body
).create(client); // Pass the client here

System.out.println(message.getSid());
```

### Generating TwiML

To control phone calls, your application needs to output [TwiML][twiml].
Expand Down