【发布时间】:2020-08-12 11:43:28
【问题描述】:
我刚开始使用 twilio 进行创业。我们需要在预约前 15 分钟向我们的客户发送短信。约会可以是每天1-5个。我有约会的时间和日期,以及相应客户的姓名和更多信息,保存在 csv 文件中。
如何让 twilio 在所需时间从 csv 发送短信?
请注意,我只在 python 中编码(我的水平是初级到中级)。我找到了这个例子:
from twilio.rest import Client
customer_num = '+15558675310'
account_sid = 'AC56382b8b1ac86598d9a775851c9652dc'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)
message = client.messages \
.create(
body="Join Earth's mightiest heroes. Like Kevin Bacon.",
from_='+15017122661',
to=customer_num)
)
print(message.sid)
如果我可以包含类似我编写的函数之类的东西,并且如果有一个 client.message.create 参数用于何时发送消息,那就太好了,例如:
def send_time_func(phone_num, other_parameters):
'''Some function I write on my own that goes through the csv
and sends the sms to the customer at the defined time in the csv'''
return(send_time)
message = client.messages.create(
....
send_time=send_time_func(customer_num, other_parameters))
python 有没有简单的解决方案?如果没有,是否有 twilio 的替代品可以做到这一点?你还能给出什么其他建议?天呐
【问题讨论】:
标签: python twilio sms sms-gateway