Created
August 24, 2017 17:48
-
-
Save prichey/2624d1e4283d690e638fa73e1134304a to your computer and use it in GitHub Desktop.
Create Twilio Subaccount with Node
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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