【发布时间】:2021-03-17 19:14:59
【问题描述】:
我正在尝试在 Python 中创建疫苗预约调度程序。我目前正在从具有时隙和电话号码的 Excel 表中读取数据,并将文本发送为:
import csv
from twilio.rest import Client
account_sid = ''
auth_token = ''
client = Client(account_sid, auth_token)
name='Test'
f = open(name+'.csv')
csv_f = csv.reader(f)
data = []
for row in csv_f:
data.append(row)
f.close()
for row in data:
if (data):
firstname = row[0]
phone_number = row[3]
print(phone_number)
time = row[5]
confirmation = row[6]
print(confirmation)
nl = '\n'
message = client.messages \
.create(
body=f"{firstname},\n\nCOVID Vaccine appointment confirmation on March 17th, {time} at .\n\nYour confirmation number is {confirmation}. Please show this message at your arrival.\n\nWe have LIMITED parking, please show up on time.\n\nYou MUST register using the form below before your appointment.\n\n\n ",
from_='+1',
to=f'+1{phone_number}'
)
print(message.sid)
#print (firstname,lastname,phone_number,time)
现在,我想要一个功能,我可以要求用户发送 1 确认,发送 2 取消。我该如何做到这一点?任何文档或代码 sn-ps 都会有所帮助。
【问题讨论】:
标签: python twilio twilio-api twilio-twiml twilio-programmable-chat