简体   繁体   English

我可以从 python 程序中自动化这个 twilio 验证电话号码列表吗

[英]can i automate this twilio verified phone numbers list from a python program

想从 python 程序中自动填充这个列表(已验证的电话号码)

from twilio.rest import Client
import os
account_sid = 'ACXXXXXXXXXXXXXX'
auth_token = 'XXXXXXXXXXXXXXXXX' 
client = Client(account_sid, auth_token)

mob = 'XXXXXXXXXX'

verify = client.verify.services('VAXXXXXXXXXXXXXXXXX')
verify.verifications.create(to=mob, channel='sms')

n = int(input('enter code: '))
result = verify.verification_checks.create(to=mob, code=n)
print(result.status)

after verifying the phone number i want to add that phone number to my twilio verified phone numbers lisI.验证电话号码后,我想将该电话号码添加到我的 twilio 验证电话号码 lisI。 I want to know if it is possible or not..我想知道这是否可能.. 在此处输入图像描述

Yes you can do this by using the Twilio Voice API :是的,您可以使用Twilio 语音 API来做到这一点:

import os
from twilio.rest import Client
client = Client(account_sid, auth_token)
validation_request = client.validation_requests \
                           .create(
                               friendly_name='A friendly name',
                               phone_number='+1234567890'
                           )
print(validation_request.validation_code)

Taken and adapted from the Twilio documentation here .取自 Twilio 文档并改编自此处

Note:笔记:

This will create a new CallerID validation request within Twilio, which initiates a call to the phone number provided and listens for a validation code.这将在 Twilio 中创建一个新的 CallerID 验证请求,该请求会启动对提供的电话号码的呼叫并侦听验证码。

And:和:

Adding an Outgoing Caller ID via the API has the same result as verifying a number via the Twilio console.通过 API 添加拨出呼叫者 ID 与通过 Twilio 控制台验证号码的结果相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM