gpt4 book ai didi

twilio - Twilio 出站用户创建

转载 作者:行者123 更新时间:2023-12-01 15:22:07 27 4
gpt4 key购买 nike

我需要将用户添加为出站调用者 ID。通过使用以下代码

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

实际上我的要求是向不同的用户发送语音调用。所以我需要将用户添加到我的出站调用者 ID 中。

最佳答案

这似乎很有可能,特别是如果您执行了全新的 npm install twilio,您将安装最新的 3.x 版本的 node helper library .您链接到上面的页面仍然默认为 2.x 版本代码。可以点击沙盒右上角的3.x找到:

client.api.accounts(accountSid)
.outgoingCallerIds('OutgoingCallerIdSid')
.fetch()
.then((callerId) => console.log(callerId.phoneNumber));

关于twilio - Twilio 出站用户创建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45627815/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com