我使用了以下函数并尝试使用curl运行来自邮递员的HTTP请求,但没有成功
exports.handler = function(context, event, callback) {
const client = context.getTwilioClient();
const new_fallback_url = 'http://your_twilio_function_url.com/webhooks/twilio_voice_fallback'; // Replace with your actual Twilio Function URL
// Fetch all phone numbers and update them
client.incomingPhoneNumbers.list()
.then(phoneNumbers => {
const updates = phoneNumbers.map(number => {
return client.incomingPhoneNumbers(number.sid)
.update({ voiceFallbackUrl: new_fallback_url });
});
return Promise.all(updates);
})
.then(results => {
callback(null, `Fallback URL updated for ${results.length} numbers`);
})
.catch(error => {
callback(error);
});
};
我希望运行代码后我所有的 twilio 号码都会自动更新
请附上您的邮递员/ cURL 请求的输出,以便其他人可以看到实际的错误/问题是什么。除此之外,还有一些事情需要记住。
谢谢你,我找到了解决方案