When I try to use Twilio's outgoing caller ids API with the Node.js library function to verify a phone number to a subaccount I get a "resource was not found" error. I am calling the function like so:
client.outgoingCallerIds('SubAccountSid').post({ PhoneNumber: "###" }, function(){ });
It appears the Node.js library makes the call with the format '/2010-04-01/Accounts/{AccountSid}/OutgoingCallerIds/{SubAccountSid}'.
I can use the format '/2010-04-01/Accounts/{SubAccountSid}/OutgoingCallerIds/' to verify the number and everything works fine. Is this a bug in the Node.js library or is this not the correct way to use outgoingCallerIds?
Twilio developer evangelist here.
The Node.js libary, like most of the official libraries, assumes that you are using the main account when making API calls. The following code is effectively the same:
client = require("twilio")(ACCOUNT_SID, AUTH_TOKEN);
client.outGoingCallerIds.list()
and
client.accounts(ACCOUNT_SID).outGoingCallerIds.list()
To use a subaccount, you should set up your client as normal then pick the subaccount using the accounts resource and make API calls based on the account object.
client = require("twilio")(ACCOUNT_SID, AUTH_TOKEN);
subAccount = client.accounts(SUB_ACCOUNT_SID);
subAccount.outgoingCallerIds().post({ PhoneNumber: "###" }, function(){ });
Let me know if that helps.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments