I can't find how to set up or change the Webhook through API. Is it possible to change it, set it when I am buying a number, or select one Webhook URL for all numbers?
I tried to find this info in the documentation but there was helpful to me
I can't find how to set up or change the Webhook through API. Is it possible to change it, set it when I am buying a number, or select one Webhook URL for all numbers?
I tried to find this info in the documentation but there was helpful to me
You will have to log into your Twilio console.
From the Develop tab, select Phone Numbers, then Manage > Active Numbers.
You can set the default Webhook (and back-up alternate Webhook) by clicking on the desired number and entering it under the respective Phone or (if available) SMS fields. You will likely have to set the Webhook (takes 2 seconds) for each phone number purchased as the default is the Twilio Demo URL (replies back with Hi or something)
The nature of a Webhook should allow any change in functionality to be done externally (on your end) through your Webhook script's functionality and thus dynamically changing the Webhook URL through the API on a case-by-case basis is discouraged and frankly should not be necessary. Someone may correct me if mistaken.
Yes, you can do that with the following command from the CLI:
or with Node
You can find other snippets in the docs (scroll to "Example 2 Update IncomingPhoneNumber to use a new Voice URL").
PS: If you want to reuse the same configuration for multiple phone numbers, you might want to see whether TwiML Apps can help you too.