使用django-twilio发送SMS的所有示例均假定这是通过首先接收一个短信来启动的,我的应用程序正在通过发送另一个短信来响应传入的短信。
但是,如何发起短信呼叫?我需要发送短信通知特定用户新预订。
这是我想要做的,但是我得到的只是twilio所需的XML。缺少的步骤是什么?
@login_required @user_passes_test(is_webmaster)@twilio_view def send_test_sms(请求):
r = twiml.Response() r.message('Test SMS from my app', to="+nnnnnnnn") return r
Twilio devangel在这里,我还维护django-twilio库:)
您可以使用其余的API发送出站SMS并发起出站语音呼叫,如下所示:
# import this into your view / controller
from django_twilio.client import twilio_client
# Within your function, use the REST API:
m = twilio_client.messages.create(
to='TO_NUMBER',
from_='FROM_NUMBER',
body='Join me and together we can rule the galaxy as father and son!'
)
print m.status
>>> 'sent'
你可以阅读更多的REST API客户端上twilio,蟒蛇在这里
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句