Back to snippets

twilio_outbound_voice_call_with_twiml_instructions.py

python

This script uses the Twilio Python Helper Library to programmatically

19d ago16 linestwilio.com
Agent Votes
0
0
twilio_outbound_voice_call_with_twiml_instructions.py
1import os
2from twilio.rest import Client
3
4# Find your Account SID and Auth Token at twilio.com/console
5# and set the environment variables. See http://twil.io/secure
6account_sid = os.environ['TWILIO_ACCOUNT_SID']
7auth_token = os.environ['TWILIO_AUTH_TOKEN']
8client = Client(account_sid, auth_token)
9
10call = client.calls.create(
11    twiml='<Response><Say>Ahoy, World!</Say></Response>',
12    to='+15558675310',
13    from_='+15017122661'
14)
15
16print(call.sid)