7
A Really Quick Twilio Outline www.twilio.com Fast, web based Voice & SMS Applications

Twilio - OJUG - 2010-09-21

Embed Size (px)

Citation preview

Page 1: Twilio - OJUG - 2010-09-21

A Really Quick Twilio Outline

www.twilio.com

Fast, web based Voice & SMS Applications

Page 2: Twilio - OJUG - 2010-09-21

Twilio API

Two Parts

Call Flow - TwiML− http://www.twilio.com/docs/api/2010-04-01/twiml/

− Defines what happens during a call

Active Changes / Reporting – REST− http://www.twilio.com/docs/api/2010-04-01/rest/

− Modifies calls, makes calls, etc.

Page 3: Twilio - OJUG - 2010-09-21

TwiML

<?xml version="1.0" encoding="UTF-8" ?>

<Response>

<Say>Hello World</Say>

<Play>hello-world.mp3</Play>

<Redirect>/next.xml</Redirect>

</Response>

Page 4: Twilio - OJUG - 2010-09-21

TwiML

Say any text with TTS system Play audio files, MP3, WAV, OGG, etc. Gather key presses from users Redirect to other TwiML documents Dial other numbers Conference rooms Send SMS to caller Record the user

Page 5: Twilio - OJUG - 2010-09-21

REST

Many resources, different actions for HTTP verbs Get account info Make phone calls Terminate phone calls Modify conference rooms Access the last X phone numbers to call in

Page 6: Twilio - OJUG - 2010-09-21

Java Twilio Helper Library

− http://github.com/twilio/twilio-java

− Not well documented yet

− Nothing fancy

TwilioRestClient client = new TwilioRestClient( AccountSid, AuthToken, null );TwilioRestResponse response;Map<String,String> params = new HashMap<String,String>();params.put("From", "402-555-1234");params.put("To", "402-555-4321");params.put("Url", "http://example.com/twiml.xml");response = client.request( "/" + APIVERSION + "/Accounts/" + client.getAccountSid() + "/Calls", "POST", params );

Page 7: Twilio - OJUG - 2010-09-21

Questions?