Twilio Twillio outbount用户创建
我需要使用以下代码将用户添加为出站呼叫者IDTwilio Twillio outbount用户创建,twilio,twilio-api,Twilio,Twilio Api,我需要使用以下代码将用户添加为出站呼叫者ID const accountSid = 'ACeae3abf5038c91052c27aa2a04969457'; const authToken = 'AUTH_TOKEN'; const client = require('twilio')(accountSid, authToken); client.outgoingCallerIds .create({ friendlyName: '918606488880', phoneNumber: '+
const accountSid = 'ACeae3abf5038c91052c27aa2a04969457';
const authToken = 'AUTH_TOKEN';
const client = require('twilio')(accountSid, authToken);
client.outgoingCallerIds
.create({
friendlyName: '918606488880',
phoneNumber: '+919020044692',
})
.then((callerId) => process.stdout.write(callerId.sid));
然后我得到如下错误消息
.create({
^
TypeError: client.outgoingCallerIds.create is not a function
at Object.<anonymous> (/home/jose/test/twillio/callerid.js:6:4)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:390:7)
at startup (bootstrap_node.js:150:9)
at bootstrap_node.js:505:3
。创建({
^
TypeError:client.outgoingCallerIds.create不是函数
反对
实际上,我的要求是向不同的用户发送语音呼叫。因此,我需要将用户添加到我的出站呼叫者ID中。似乎很有可能,特别是如果您安装了全新的npm安装twilio
,您将安装最新的3.x版本。您上面链接的页面仍然默认为2.x版本代码。您可以单击沙盒右上角的3.x以查找:
client.api.accounts(accountSid)
.outgoingCallerIds('OutgoingCallerIdSid')
.fetch()
.then((callerId) => console.log(callerId.phoneNumber));
您使用的是什么版本的Twilio Node module?Node version 6.9.4 Twilio npm module的版本是什么?更新Node版本后一切正常。