Parse Cloud 中的 twilio 模块缺少最新的 API

The twilio module in Parse Cloud is missing latest APIs

根据 twilio.com 上的 API 文档,twilio.availablePhoneNumbers('COUNTRY_CODE').mobile.get() 应该存在。我应该可以在下面这样调用:

twilio.availablePhoneNumbers('US').mobile.get({
    smsEnabled: true
}).then(function(searchResults) {
    ....
});

但是当我使用 Parse 云代码中提供的 twilio 模块时,twilio.availablePhoneNumbers('COUNTRY_CODE').localtwilio.availablePhoneNumbers('COUNTRY_CODE').tollFree 可用。

我错了吗?

我需要以编程方式在云代码中获取一个 phone 号码。如果 twilio on Parse 云代码受限,如何使用最新的 twilio APIs?

这里是 Twilio 开发人员布道者。

Parse 上的 Twilio 模块确实已经过时了。我目前正在与他们的团队合作,为像您这样的开发人员提供更新版本。

与此同时,您可以在没有 Twilio 模块的情况下使用 Parse 上的普通 HTTP 请求来进行您想要的调用。像这样的东西现在可能有用:

var accountSid = 'AC123...'; // your account SID
var authToken = 'xyzabc...'; // your auth token
var countryCode = 'US'; // the country code you want to search within

var url = 'https://';
url += accountSid + ':' + authToken + '@'; // add auth to URL
url += 'api.twilio.com/2010-04-01/Accounts/';
url += accountSid;
url += '/AvailablePhoneNumbers/';
url += countryCode;
url += '/Mobile.json';

Parse.Cloud.httpRequest({
  url: url,
}).then(function(httpResponse) {
  // success
  console.log(httpResponse.text);
  // httpResponse.data is the parsed JSON response
},function(httpResponse) {
  // error
  console.error('Request failed with response code ' + httpResponse.status);
});

您可能需要查看 Parse Parse.Cloud.httpRequest 的文档。可在此处获得:https://parse.com/docs/cloudcode/guide#cloud-code-advanced