-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwhatsapp.py
32 lines (22 loc) · 901 Bytes
/
whatsapp.py
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
from twilio.rest import Client
import os
account_sid = os.environ.get('TWILIO_ACCOUNT_SID')
auth_token = os.environ.get('TWILIO_AUTH_TOKEN')
flow_id = 'FW82751984a3114708b0ccfcf7b7d5a9ce'
msg_id = 'whatsapp:+17372010046'
## this file was used only on tests. As I am using Twilio Flow, all WhatsApp configuration is now avaiable on Twillio Console
client = Client(account_sid, auth_token)
class Sandbox():
def response(chat_sid, message):
client.conversations \
.v1 \
.conversations(chat_sid) \
.messages \
.create(author='system', body = message)
class Prd():
def send_template(contact):
client.messages.create(
content_sid='HX3b06ffbe042cc634617ae08ff3675c89',
from_=msg_id,
to=contact
)