twilio
         CLOUD COMMUNICATIONS




      Designing the Best
Telecommunications API
   Tim Milliron, Director of Engineering
                            @timmilliron
Who is twilio?
          RESTful web APIs to automate
          Voice & SMS communications


      Voice             SMS           Phone
                                     Numbers
•   Inbound        • Incoming      • PhoneNumber
•   Outbound       • Outgoing        Provisioning
•   Mobile VoIP    • Short Codes   • ShortCode
•   Browser VoIP                     Applications
(415) 233-WAZA
    • Find & buy a number:
curl -u $U:$P
https://api.twilio.com/2010-04-01/Accounts/AC123/
AvailablePhoneNumbers/US/Local?Contains=415***WAZA

curl -u $U:$P -d “PhoneNumber=415233WAZA”
https://api.twilio.com/2010-04-01/Accounts/AC123/IncomingPhoneNumbers/


    • Make an outgoing call:
curl -u $U:$P -d “Url=www.example.com/outgoing.xml”
-d “From=4152339292” -d “To=4158675309”
https://api.twilio.com/2010-04-01/Accounts/AC123/Calls/



    • Receive an incoming call:
<Response>
    <Say>Thanks for calling the Waza Twilio number! Huzzah!</Say>
    <Sms>Heroku’s Waza Rocks!</Sms>
</Response>
7 Principles
#1 APIs are for Abstraction
Example: DIDs
  DID	
  (Direct	
  Inward	
  Dial)	
  —	
  Inbound-­‐only	
  phone	
  number	
  
  assigned	
  to	
  a	
  group	
  of	
  phone	
  lines	
  that	
  allows	
  a	
  
  phone	
  system	
  to	
  route	
  to	
  a	
  unique	
  location	
  or	
  person.	
  
  A	
  group	
  of	
  DIDs	
  is	
  often	
  assigned	
  to	
  a	
  single	
  trunk	
  
  group.	
  DID	
  numbers	
  are	
  not	
  sent	
  out	
  as	
  the	
  ANI	
  when	
  
  the	
  caller	
  places	
  an	
  outbound	
  call.



Developers don’t give a f*** about DIDs
  twilio’s API talks PhoneNumbers
  (they work for incoming & outgoing)
#2 What’s the noun?
Speak resources:
  GET api.twilio.com/.../Calls
  GET api.twilio.com/.../Calls/CA123
  POST api.twilio.com/.../Calls


Not RPC:
  GET api.twilio.com/.../GetCalls/
  POST api.twilio.com/.../PlaceCall
#3 Be RESTful
Hypermedia for sub-resource traversal:
  <Account>
     <Sid>AC123</Sid>
     <OwnerAccountSid>AC456</OwnerAccountSid>
     <FriendlyName>tim@twilio.com's Account</FriendlyName>
     <Status>active</Status>
     ...
     <Uri>
        /2010-04-01/Accounts/AC123
     </Uri>
     <SubresourceUris>
        <AvailablePhoneNumbers>
           /2010-04-01/Accounts/AC123/AvailablePhoneNumbers
        </AvailablePhoneNumbers>
        <Calls>
           /2010-04-01/Accounts/AC123/Calls
        </Calls>
        ...
     </SubresourceUris>
  </Account>
#3 Be RESTful
Hypermedia for list traversal:
 <SMSMessages page="0" numpages="16" pagesize="50" total="780"
 start="0" end="49" uri="/2010-04-01/Accounts/AC123/SMS/
 Messages" firstpageuri="/2010-04-01/Accounts/AC123/SMS/
 Messages?Page=0&PageSize=50" previouspageuri="" nextpageuri="/
 2010-04-01/Accounts/AC123/SMS/Messages?Page=1&PageSize=50"
 lastpageuri="/2010-04-01/Accounts/AC123/SMS/Messages?
 Page=15&PageSize=50">
    ...
 </SMSMessages>
#4 The API Giveth...
... but the API can’t (usually) taketh away


It’s much easier to add something
than to remove something
  ➡ Get it in developers’ hands,
      see what use cases develop.
  ➡ Then, aggressively add
      frequently-requested features
#5 The Smallest API Possible...


                    twilio.com/
                     authorize



                   access_token=
                     xxxyyyzzz

/Calls?access_token=xxxyyyzzz
/IncomingPhoneNumbers?access_token=xxxyyyzzz
...
#5 The Smallest API Possible...


                    twilio.com/
                     authorize



                   account_sid=
                      AC678

/Calls
/IncomingPhoneNumbers
...
#6 ...But No Smaller
“As close to C as possible, but no closer”
 - Bjarne Stroustrup, creator of C++


Make the common case easy.

This works, and it’s generic:
   curl api.twilio.com/.../AvailablePhoneNumbers?
   Contains=510*******



But, this is what most developers want:
   curl api.twilio.com/.../AvailablePhoneNumbers?
   AreaCode=510
#7 Don’t Settle
• Late changes are OK
• Don’t be afraid to version
  (with good reason)
• Get feedback early, often, & throughout
     Discuss, spec, write, try it, rewrite
      discuss it some more, rewrite again
Process    Perspective
 Discuss      Developers
              Developers
  Spec
              Developers

  Build
twilio
        CLOUD COMMUNICATIONS




Tim Milliron, Director of Engineering
                         @timmilliron

More Related Content

PDF
Integrating Communications into CRM
PDF
Twiliobot at Google Wave Meetup 2009-09-14
PDF
Building Blocks for Next Generation Contact Centers
PDF
Twilio Contact Center Overview
PDF
Twilio Product Overview
PDF
Open Source Software Business Model
ODP
TWILIO SMS Introduction
Integrating Communications into CRM
Twiliobot at Google Wave Meetup 2009-09-14
Building Blocks for Next Generation Contact Centers
Twilio Contact Center Overview
Twilio Product Overview
Open Source Software Business Model
TWILIO SMS Introduction

What's hot (20)

PDF
Twilio SMS - API for Sending & Receiving SMS Messages
PDF
Smarter SIP Trunks: 6 Ways You Can Save Time and Get More Features
PDF
Twilio Signal 2016 Real-time Communications Overview
PDF
Twilio Signal 2016 Keynote
PPT
Twilio API: Build SMS Text Message Into Web Apps
PDF
What Can You Do With Twilio
PDF
Twilio Presentation
PDF
Twilio Signal 2016 Build Your Own Cloud Enterprise VoIP
PDF
Final Twilio Under the Radar 2009 Cloud
PDF
Tropo Presentation for TADHack
PPTX
Cloud Telephony Public
ODP
Otra forma de hacer aplicaciones de telefonía
PDF
How the Realtime Web is influencing the future of communications
PDF
Create an IVR that Keeps Up with Your Customers
PDF
Building A Great API - Evan Cooke, Cloudstock, December 2010
PDF
Twilio MMS Deep Dive
PDF
Twilio Signal 2016 Using Add-ons
PPTX
Twilio using Groovy Grails
PDF
Twilio Signal 2016 Taking Your SMS App Global
PDF
Twilio Signal 2016 Best Practices for Debugging Twilio Apps
Twilio SMS - API for Sending & Receiving SMS Messages
Smarter SIP Trunks: 6 Ways You Can Save Time and Get More Features
Twilio Signal 2016 Real-time Communications Overview
Twilio Signal 2016 Keynote
Twilio API: Build SMS Text Message Into Web Apps
What Can You Do With Twilio
Twilio Presentation
Twilio Signal 2016 Build Your Own Cloud Enterprise VoIP
Final Twilio Under the Radar 2009 Cloud
Tropo Presentation for TADHack
Cloud Telephony Public
Otra forma de hacer aplicaciones de telefonía
How the Realtime Web is influencing the future of communications
Create an IVR that Keeps Up with Your Customers
Building A Great API - Evan Cooke, Cloudstock, December 2010
Twilio MMS Deep Dive
Twilio Signal 2016 Using Add-ons
Twilio using Groovy Grails
Twilio Signal 2016 Taking Your SMS App Global
Twilio Signal 2016 Best Practices for Debugging Twilio Apps

Similar to 7 Principles of API Design - Waza (20)

PDF
How to Implement Conversational IVR
PPTX
Real time voice call integration - Confoo 2012
PDF
Twilio - Social App Workshop - 2010-07-24
PDF
IoT to Human interactions - Stève Sfartz - Codemotion Milan 2016
PPTX
DevNet @TAG - Spark & Tropo APIs - Milan/Rome May 2016
PPTX
How to Build Advanced Voice Assistants and Chatbots
KEY
Chris Matthieu's Presentation at Emerging Communication Conference & Awards 2...
PPTX
Subscribed 2017: Understanding Zuora’s API Framework
PPT
Astricon 2010: Scaling Asterisk installations
PDF
The Real World - Plugging the Enterprise Into It (nodejs)
PPTX
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
PDF
Look Who's Talking
PPTX
Kamailio World 2014 - Kamailio - The Platform for Interoperable WebRTC
PPT
Expert Days 2011: The VP R&D Open Seminar: Systems Performance Seminar
PDF
Contact Center fundamentals for Kids
PPTX
The Momentum of Collaboration and the Customer Experience
PDF
How serverless changes the cost paradigm
PPTX
SignalR Intro + WPDev integration @ Codetock
KEY
Getting Started with Twilio
PDF
BlackHat Hacking - Hacking VoIP.
How to Implement Conversational IVR
Real time voice call integration - Confoo 2012
Twilio - Social App Workshop - 2010-07-24
IoT to Human interactions - Stève Sfartz - Codemotion Milan 2016
DevNet @TAG - Spark & Tropo APIs - Milan/Rome May 2016
How to Build Advanced Voice Assistants and Chatbots
Chris Matthieu's Presentation at Emerging Communication Conference & Awards 2...
Subscribed 2017: Understanding Zuora’s API Framework
Astricon 2010: Scaling Asterisk installations
The Real World - Plugging the Enterprise Into It (nodejs)
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
Look Who's Talking
Kamailio World 2014 - Kamailio - The Platform for Interoperable WebRTC
Expert Days 2011: The VP R&D Open Seminar: Systems Performance Seminar
Contact Center fundamentals for Kids
The Momentum of Collaboration and the Customer Experience
How serverless changes the cost paradigm
SignalR Intro + WPDev integration @ Codetock
Getting Started with Twilio
BlackHat Hacking - Hacking VoIP.

More from Twilio Inc (20)

PDF
Salesforce’s Andy Kung on the Power of CRM Integrations
PPTX
All Web Leads’ Lorena Lauv on How to Scale a Virtual Call Center
PDF
Why Mobile Messaging Works?
PDF
Understand How Consumers Use Messaging
PDF
How To Track Calls Using Twilio?
PDF
Twilio Signal 2016 WebRTC Reborn
PDF
Twilio Signal 2016 Technical Blogging
PDF
Twilio Signal 2016 Serverless Contact Center
PDF
Twilio Signal 2016 Robots-IoT-Watson-Cognitive + Twilio
PDF
Twilio Signal 2016 Leading An Open Hardware Revolution
PDF
Twilio Signal 2016 IoT Using LittleBits and Twilio SMS
PDF
Twilio Signal 2016 Chaos Patterns
PPTX
Twilio Signal 2016 How to Impact Non-profits
PDF
Twilio Signal 2016 Bringing P2P to the Masses with WebRTC
PDF
Twilio Signal 2016 Listing Services and Lead Generation
PDF
Twilio Signal 2016 Bots
PDF
Twilio Signal 2016 Omni-channel Routing Bots
PDF
Twilio Signal 2016 New Documentation
PDF
Twilio Signal 2016 How to Build Next Generation Speech Analytics
PDF
Twilio Signal 2016 Designing Multi-party Call Flows
Salesforce’s Andy Kung on the Power of CRM Integrations
All Web Leads’ Lorena Lauv on How to Scale a Virtual Call Center
Why Mobile Messaging Works?
Understand How Consumers Use Messaging
How To Track Calls Using Twilio?
Twilio Signal 2016 WebRTC Reborn
Twilio Signal 2016 Technical Blogging
Twilio Signal 2016 Serverless Contact Center
Twilio Signal 2016 Robots-IoT-Watson-Cognitive + Twilio
Twilio Signal 2016 Leading An Open Hardware Revolution
Twilio Signal 2016 IoT Using LittleBits and Twilio SMS
Twilio Signal 2016 Chaos Patterns
Twilio Signal 2016 How to Impact Non-profits
Twilio Signal 2016 Bringing P2P to the Masses with WebRTC
Twilio Signal 2016 Listing Services and Lead Generation
Twilio Signal 2016 Bots
Twilio Signal 2016 Omni-channel Routing Bots
Twilio Signal 2016 New Documentation
Twilio Signal 2016 How to Build Next Generation Speech Analytics
Twilio Signal 2016 Designing Multi-party Call Flows

Recently uploaded (20)

PDF
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
PDF
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
PDF
Comparative analysis of machine learning models for fake news detection in so...
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
PPTX
Custom Battery Pack Design Considerations for Performance and Safety
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PDF
CloudStack 4.21: First Look Webinar slides
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PPTX
TEXTILE technology diploma scope and career opportunities
PDF
Enhancing plagiarism detection using data pre-processing and machine learning...
PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
PDF
“A New Era of 3D Sensing: Transforming Industries and Creating Opportunities,...
PPTX
Internet of Everything -Basic concepts details
PDF
Improvisation in detection of pomegranate leaf disease using transfer learni...
PPTX
Build Your First AI Agent with UiPath.pptx
PPTX
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
PDF
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
Comparative analysis of machine learning models for fake news detection in so...
A review of recent deep learning applications in wood surface defect identifi...
NewMind AI Weekly Chronicles – August ’25 Week III
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
Custom Battery Pack Design Considerations for Performance and Safety
sbt 2.0: go big (Scala Days 2025 edition)
CloudStack 4.21: First Look Webinar slides
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
TEXTILE technology diploma scope and career opportunities
Enhancing plagiarism detection using data pre-processing and machine learning...
Credit Without Borders: AI and Financial Inclusion in Bangladesh
“A New Era of 3D Sensing: Transforming Industries and Creating Opportunities,...
Internet of Everything -Basic concepts details
Improvisation in detection of pomegranate leaf disease using transfer learni...
Build Your First AI Agent with UiPath.pptx
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...

7 Principles of API Design - Waza

  • 1. twilio CLOUD COMMUNICATIONS Designing the Best Telecommunications API Tim Milliron, Director of Engineering @timmilliron
  • 2. Who is twilio? RESTful web APIs to automate Voice & SMS communications Voice SMS Phone Numbers • Inbound • Incoming • PhoneNumber • Outbound • Outgoing Provisioning • Mobile VoIP • Short Codes • ShortCode • Browser VoIP Applications
  • 3. (415) 233-WAZA • Find & buy a number: curl -u $U:$P https://api.twilio.com/2010-04-01/Accounts/AC123/ AvailablePhoneNumbers/US/Local?Contains=415***WAZA curl -u $U:$P -d “PhoneNumber=415233WAZA” https://api.twilio.com/2010-04-01/Accounts/AC123/IncomingPhoneNumbers/ • Make an outgoing call: curl -u $U:$P -d “Url=www.example.com/outgoing.xml” -d “From=4152339292” -d “To=4158675309” https://api.twilio.com/2010-04-01/Accounts/AC123/Calls/ • Receive an incoming call: <Response> <Say>Thanks for calling the Waza Twilio number! Huzzah!</Say> <Sms>Heroku’s Waza Rocks!</Sms> </Response>
  • 5. #1 APIs are for Abstraction Example: DIDs DID  (Direct  Inward  Dial)  —  Inbound-­‐only  phone  number   assigned  to  a  group  of  phone  lines  that  allows  a   phone  system  to  route  to  a  unique  location  or  person.   A  group  of  DIDs  is  often  assigned  to  a  single  trunk   group.  DID  numbers  are  not  sent  out  as  the  ANI  when   the  caller  places  an  outbound  call. Developers don’t give a f*** about DIDs twilio’s API talks PhoneNumbers (they work for incoming & outgoing)
  • 6. #2 What’s the noun? Speak resources: GET api.twilio.com/.../Calls GET api.twilio.com/.../Calls/CA123 POST api.twilio.com/.../Calls Not RPC: GET api.twilio.com/.../GetCalls/ POST api.twilio.com/.../PlaceCall
  • 7. #3 Be RESTful Hypermedia for sub-resource traversal: <Account> <Sid>AC123</Sid> <OwnerAccountSid>AC456</OwnerAccountSid> <FriendlyName>[email protected]'s Account</FriendlyName> <Status>active</Status> ... <Uri> /2010-04-01/Accounts/AC123 </Uri> <SubresourceUris> <AvailablePhoneNumbers> /2010-04-01/Accounts/AC123/AvailablePhoneNumbers </AvailablePhoneNumbers> <Calls> /2010-04-01/Accounts/AC123/Calls </Calls> ... </SubresourceUris> </Account>
  • 8. #3 Be RESTful Hypermedia for list traversal: <SMSMessages page="0" numpages="16" pagesize="50" total="780" start="0" end="49" uri="/2010-04-01/Accounts/AC123/SMS/ Messages" firstpageuri="/2010-04-01/Accounts/AC123/SMS/ Messages?Page=0&PageSize=50" previouspageuri="" nextpageuri="/ 2010-04-01/Accounts/AC123/SMS/Messages?Page=1&PageSize=50" lastpageuri="/2010-04-01/Accounts/AC123/SMS/Messages? Page=15&PageSize=50"> ... </SMSMessages>
  • 9. #4 The API Giveth... ... but the API can’t (usually) taketh away It’s much easier to add something than to remove something ➡ Get it in developers’ hands, see what use cases develop. ➡ Then, aggressively add frequently-requested features
  • 10. #5 The Smallest API Possible... twilio.com/ authorize access_token= xxxyyyzzz /Calls?access_token=xxxyyyzzz /IncomingPhoneNumbers?access_token=xxxyyyzzz ...
  • 11. #5 The Smallest API Possible... twilio.com/ authorize account_sid= AC678 /Calls /IncomingPhoneNumbers ...
  • 12. #6 ...But No Smaller “As close to C as possible, but no closer” - Bjarne Stroustrup, creator of C++ Make the common case easy. This works, and it’s generic: curl api.twilio.com/.../AvailablePhoneNumbers? Contains=510******* But, this is what most developers want: curl api.twilio.com/.../AvailablePhoneNumbers? AreaCode=510
  • 13. #7 Don’t Settle • Late changes are OK • Don’t be afraid to version (with good reason) • Get feedback early, often, & throughout Discuss, spec, write, try it, rewrite discuss it some more, rewrite again
  • 14. Process Perspective Discuss Developers Developers Spec Developers Build
  • 15. twilio CLOUD COMMUNICATIONS Tim Milliron, Director of Engineering @timmilliron