Twilio is deprecating Node Helper Library 2.x on 8/31/2017 and has made some changes with their 3.x version. I used to get the details of a call with:
client.calls(sid).get(function(err, call) {
if(!err) {
console.log(call);
}
});
With 3.x, the fetch() method replaces get() (and promises are now used). With fetch(), rather than receive a valid JSON response ({"sid": "xxxx", "date_created": "xxxx", "date_updated": "xxxx",...), I'm now getting a CallInstance object:
CallInstance {
_version:
V2010 {
_domain:
Api {
twilio: [Object],
baseUrl: 'https://api.twilio.com',
_v2010: [Circular] },
_version: '2010-04-01',
_accounts: undefined,
_account:
AccountContext {
_version: [Circular],
_solution: [Object],
...
If I piece together the baseUrl plus the uri from the CallInstance (https://api.twilio.com/2010-04-01/Accounts/xxx/Calls/xxx.json), then I can get the old JSON response that I'm looking for.
Question: Is there a way for the Twilio Node Helper Library 3.x to return that old JSON format (instead of a CallInstance) without me having to make an additional request?
via littleK
No comments:
Post a Comment