我想在python上打电话给Twilio的多个电话我刚看了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)所以你能告诉我该怎么做吗
发布于 2021-01-21 03:14:21
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)或者,你也可以使用twiml='<Response><Say>INSERT MESSAGE HERE</Say></Response>',来播放一条消息,而不是包含你想要在手机上播放的文件的链接的url。您可以使用不同的Amazon Polly声音来自定义发出消息的声音--more on that here。
https://stackoverflow.com/questions/65805485
复制相似问题