我在使用twilio-api for node时遇到了问题。
我写了这段代码:
let typeArray = ['caller-name','carrier'];
this.client.phoneNumbers(phoneNumberToCheck).get({
type: typeArray
}, (error, number) => {
// working on the number data results
// ...
});问题是我没有得到它们中的任何一个(承运商/调用者名称)-尽管在其他语言(php,c#..)中将数组传递给参数'type‘是这样做的。但它在node.js上不起作用,相反,我得到的结果是:
// -> get
{
"caller_name":null,
"country_code":"US",
"phone_number":"+123456789",
"national_format":"(248) 123-456",
"carrier":null,
"add_ons":null,
"url":"https://lookups.twilio.com/v1/PhoneNumbers/+123456789",
"callerName":null,
"countryCode":"US",
"phoneNumber":"+123456789",
"nationalFormat":"(248) 123-456",
"addOns":null
}注意:如果我分别发送每个邮件(仅限承运商或仅限呼叫者姓名)-我将获得每个邮件的部分信息。
在node.js中,如何在一个请求中同时获取这两个请求?
发布于 2017-07-11 17:25:00
Twilio开发者的布道者在这里。
您应该这样调用Node中的Lookups API:
client.lookups.phoneNumbers.get(phoneNumber)
.fetch({
type: ['carrier', 'caller-name']
},
function(err, result) {
// do something
}
)这些文档在Lookups documentation上的Node.js中有一点不足,我将与团队一起提出这个问题。
https://stackoverflow.com/questions/45029189
复制相似问题