- TwiML: Both sides must understand TwiML documents: the client to generate the appropriate and valid callback XML, and twilio's callback client to be able to parse and interpret them.
- Call flow state machine: yourserver.com must understand all possible state transitions for the Dial action and the Calls creation action.
- Calls creation request form:
- yourserver.com must understand the Calls creation response data structure, including the names and values of all relevant components.
- yourserver.com must know the Calls creation URL
- yourserver.com must understand the names and values of the Calls creation URL parameters
- callback request forms:
- yourserver.com must understand the names and values of the Calls callback request parameters
- yourserver.com must understand the names and values of the Dial callback request parameters
- both sides must agree regarding the name and value of the AccountSid
- both sides must agree on the method, occurrances, and content of authentication.
- Twilio need not understand any yourserver.com logic or state, save for:
- the Calls
Url
parameter will contain an endpoint which understands the Calls callback request parameters - the Dial
action
parameter will contain an endpoint which understands the Dial callback request parameters - both will respond with xml, specifically TwiML.
- the Calls
https://github.com/twilio/twilio-ruby
Twilio ships a client library to ease the use of their API. This allows client developers to set up global state, handle global error conditions and global retry semantics which are consistent across requests, and to hide the url structure and request formats of the endpoints of their API. Their library does not rely on any particular response formatting concerns beyond the global error format. The Twilio library provides limited support for generating appropriate callback endpoints. Specifically, a very thin builder wrapper for constructing TwiML the wrapper is not aware of any url structure, nor does it assist in verifying the structure of the TwiML generated. No support is given for parsing callback requests.
Twilio's API can evolve independently of clients by adding new endpoints, and by adding additional response data, or adding optional parameters to existing endpoints. Individual calls are locked in their required request parameters. Any change to existing URLs, authentication, AccountSids, or increase in the required parameter set for any call will require a whole API/Client library bump.
With the addition of the client library: If they were to require all clients to use their libraries they could slowly deprecate API versions. By shipping a new version of their API client library, and deprecating older library versions, they can transparently transfer new and existing (upgraded) clients to different URLs and URL structures, as long as the baseline functionality is unchanged. They can even implement new request flows and authentication methods, as long as the new flows are congruent to the existing functionality; i.e. as long as the input parameters to the library methods and responses from the library methods do not change.