Twilio: Update the Voice (or Message) URL via API?

南楼画角 提交于 2020-01-03 08:59:40

问题


I've been using Twilio for quite some time, think its a slick service, and would like to use Twilio to power text/voice capability to/from my home automation server (an old mac-mini).

The problem is, if my home IP address changes, then my Twilio number's SMS and Voice URLs would be pointing at the wrong IP, which would obviously prevent my webserver (Node.js) from doing ... well, anything.

My plan was to periodically grab the mac-mini's external IP and update my number's Voice/SMS URLs by POSTing it to the Twilio API, but it doesn't seem that the Twilio API supports this functionality.

Can anyone confirm that it is / is NOT possible to update a number's Voice/SMS URLs via the Twilio API? Otherwise, I'll have to webdrive this ... thank you!


回答1:


Twilio evangelist here.

You absolutely change the Voice and Message Request URLS for your phone numbers via the REST API. Thats basically whats happening when you do it in the portal.

To do it you make a POST request to the IncomingPhoneNumbers instance resource and include the VoiceUrl and SmsUrl parameters. Here is an example.

You can also look at setting the Fallback URL's for you phone numbers as an additional layer of reliability. Fallback URL's let you tell Twilio a second URL to use in case the request to the primary URL fails. You do however have to set fallback URLS via the portal, not the REST API.



来源:https://stackoverflow.com/questions/24924557/twilio-update-the-voice-or-message-url-via-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!