Get your own customer support community
 

Suggestions to improve the API

Good Morning All,

I used the Twilio service to create a Twitter bot that would call folks when it received a direct message. It would then post a URL to to the recording as an update. It was fun to write, and I have some suggestions after doing so that would have made it easier:

1. I really don't understand why the RESTful API used to initiate a new calls (/2008-08-01/Accounts/{YourAccountSid}/Calls) needs a URL pointing to the TwiML. It would be easier to use and more efficient if the TwiML could be included when making that request. I wouldn't have to maintain another file either, making my document management easier.

2. It would have been nice if I was able to pass some data when initiating the call and have this returned to me when the callback was invoked. (This may be possible, but I wasn't able to figure it out if it is. I saw that notification instance resources contain request variables, but I wasn't sure if this could be set by my client when initiating the call. Because of this, I wasn't able to, for example, say in the Twitter bot's update who recorded a message. To do this, I would have to pass that when starting the call and get it back when handling the callback from Twilio.)

This is the conversation that I ended up with:

1. Client C calls /2008-08-01/Accounts/{YourAccountSid}/Calls on the Twilio server S passing in URL U to a TwiML document X
2. S requests U and parses out the callback URL B from X
3. S makes a phone call
4. S sends a message to B (the callback)
5. B updates Twitter status by calling that service's API using the the RecordingUrl (given to B from S)

(If I am right that notifications could have been used to pass arbitrary data, the number of request/response messages needed in this conversation would have been increased by approx. 50% - 100%.)

If the TwiML document X could have been passed instead of U, the number of requests/responses would have been reduced to this:

1. C calls /2008-08-01/Accounts/{YourAccountSid}/Calls on S passing X (and Caller and Called as before)
2. S makes a phone call
3. S sends a message to B
4. B updates twitter

Ideally, this is what I would have been able to do:

1. C calls /2008-08-01/Accounts/{YourAccountSid}/Calls on S passing X and arbitrary data D
2. S makes phone call
3. S sends a message to B including D (and RecodingUrl as before)
4. B updates twitter using RecordingUrl and D

Having said all this, I think that Twilio is a great service, and I'm excited to see what the future holds for it.

--

Regards,

Travis Spencer
 
indifferent I’m indifferent
Inappropriate?
1 person likes this idea

User_default_medium