如何解决Twilio Python:如何通过 twilio 调用多个调用
我想通过 Twilio 在 python 上呼叫多部手机 我刚看到 Twilio 博客,但我什么都不懂 这是我的脚本
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client
account_sid = "AC723c6c38e7c58a572ce011a652540a42"
auth_token = "REDACTED"
client = Client(account_sid,auth_token)
# Your Account Sid and Auth Token from twilio.com/console
# and set the environment variables. See http://twil.io/secure
call = client.calls.create(
)
print(call.sid)
你能告诉我该怎么做吗
解决方法
Twilio 开发者布道者在这里。
您应该创建一个要呼叫的电话号码数组,然后遍历该数组,调用 calls.create
方法来调用作为参数传递给 calls.create
的数组中的每个号码。
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client
account_sid = "AC723c6c38e7c58a572ce011a652540a42"
auth_token = "REDACTED"
client = Client(account_sid,auth_token)
# Your Account Sid and Auth Token from twilio.com/console
# and set the environment variables. See http://twil.io/secure
arr = ['INSERT-NUMBER-TO-CALL','INSERT-OTHER-NUMBER-TO-CALL'...]
for num in arr:
call = client.api.account.calls.create(
to=num,from_='YOUR-TWILIO-NUMBER',url = 'http://demo.twilio.com/docs/classic.mp3'
)
print(call.sid)
或者,您也可以使用 url
来播放消息,而不是包含指向要在手机上播放的文件的链接的 twiml='<Response><Say>INSERT MESSAGE HERE</Say></Response>',
。您可以使用不同的 Amazon Polly 语音来自定义朗读消息的语音 --more on that here。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。