如何从django twilio发起短信
问题描述:
所有使用django-twilio发送短信的例子都假定这是通过首先接收一个来启动的,即我的应用程序通过发送另一个短消息来响应传入的短消息。如何从django twilio发起短信
但我该如何发起短信呼叫?我需要发送一条短信通知特定用户已经有新的预约。
这就是我想要做的,但我得到的仅仅是twilio需要的XML。缺失的步骤是什么?
@login_required @user_passes_test(is_webmaster)@twilio_view高清 send_test_sms(请求):
r = twiml.Response() r.message('Test SMS from my app', to="+nnnnnnnn") return r
答
Twilio devangel在这里,我也要保持django-twilio库:)
您可以发送出站短信并使用其他API启动出站语音呼叫,如下所示:
# 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'
您可以在Twilio-Python中的REST API客户端上阅读更多内容over here
完美地工作。非常感谢。 – PhoebeB 2014-10-16 11:14:09