Is there any way to set webhook url for Twilio number by python code??
something as: client.number('MY_TWILIO_NUMBER').update(webhook='ngrok.io')
??? I want make automate update when i start new ngrok instance
Twilio developer evangelist here. You can accomplish this via the Twilio CLI as well as with Python using Twilio Incoming Phone Numbers , That Python code would look something like this (replacing the variables with your own account SID, auth token: and the phone number SID you'd like to use which can be found in the Console or via the CLI):
import os
from twilio.rest import Client
# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_AUTH_TOKEN']
client = Client(account_sid, auth_token)
incoming_phone_number = client \
.incoming_phone_numbers('PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
.update(voice_url='https://www.your-new-voice-url.com/example')
print(incoming_phone_number.friendly_name)
Let me know if this helps at all!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.