Skip to content

Instantly share code, notes, and snippets.

@prichey
Created August 24, 2017 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prichey/2624d1e4283d690e638fa73e1134304a to your computer and use it in GitHub Desktop.
Save prichey/2624d1e4283d690e638fa73e1134304a to your computer and use it in GitHub Desktop.
Create Twilio Subaccount with Node
// The documentation on the Twilio site is wrong. (https://www.twilio.com/docs/api/rest/subaccounts#example)
// It looks like client.accounts.create() was deprecated so you have to use the old API.
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = require('twilio')(accountSid, authToken);
client.api.v2010.accounts.create(
{
friendlyName: 'Subaccount'
},
(err, account) => {
process.stdout.write(account.sid);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment