Twillio outbount用户创建
问题描述:
我需要将用户添加为出站呼叫者ID。通过下面的代码Twillio outbount用户创建
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
上面的代码是从twillio twilio
的文档了Actualy我的要求是发送语音通话给不同的用户。所以我需要将用户添加到我的出站呼叫者ID中。
答
看起来很有可能,特别是如果你做了一个新的npm install twilio
,你会安装node helper library的最新3.x版本。您上面链接的页面仍默认为2.x版本代码。您可以单击沙盒右上方的3.x来查找:
client.api.accounts(accountSid)
.outgoingCallerIds('OutgoingCallerIdSid')
.fetch()
.then((callerId) => console.log(callerId.phoneNumber));
+0
一切工作正常,更新节点版本。 – jjamt
您使用的是什么版本的Twilio Node模块? – philnash
节点版本6.9.4 – jjamt
Twilio npm模块的版本是什么? – philnash