-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_call.py
More file actions
34 lines (27 loc) · 874 Bytes
/
make_call.py
File metadata and controls
34 lines (27 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client
from dotenv import load_dotenv
import os
def make_call(to, zip):
# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables
load_dotenv()
account_sid = os.environ['ACCOUNT_SID']
auth_token = os.environ['AUTH_TOKEN']
server = os.environ['SERVER']
client = Client(account_sid, auth_token)
action = f"{server}/choose_option"
instructions = f'''
<Response>
<Say voice="alice">Thank you for calling Global News.</Say>
<Redirect method="GET">
{server}/choose_option?Digits=Begin
</Redirect>
</Response>
'''
call = client.calls.create(
twiml=instructions,
to=to,
from_='+18449504572'
)
print(call.sid)