简体   繁体   English

如何在生产环境中使用 twilio webhook 回复短信

[英]how to use twilio webhook to reply to an sms in production

I am new to Twilio services and just started using their api for sms with django .我是 Twilio 服务的新手,刚开始使用他们的 api 与django进行短信。 the sms outbound work well and now i want to make sure to grab the value replied by the person who has received the message.短信出站工作正常,现在我想确保获取收到消息的人回复的值。

Locally, I have used Ngrok as a webhook, I provided the Ngrok URL generated while running my python application locally + backend api endpoint URL in the Twilio SMS settings required for the webhook and it work.在本地,我使用Ngrok作为 webhook,我提供了在本地运行我的 python 应用程序时生成的 Ngrok URL + webhook 所需的 Twilio SMS 设置中的后端 api 端点 URL 并且它可以工作。

Please note that i made sure that the URL the SMS response is supposed to hit is publicly available.请注意,我确保 SMS 响应应该命中的 URL 是公开可用的。

Now my question is how do I make this work in a production environment where i cannot run Ngrok from my computer?现在我的问题是如何在无法从我的计算机运行Ngrok的生产环境中进行这项工作?

I removed the Ngrok URL provided since its not running locally and left the URL of the endpoint but i am not receiving anything back as a response.我删除了提供的 Ngrok URL,因为它没有在本地运行,并保留了端点的 URL,但我没有收到任何回复作为响应。

PS: the endpoint created is publicly accessible to anyone even though it is hosted on AWS. PS:即使托管在 AWS 上,任何人都可以公开访问创建的端点。

Twilio developer evangelist here. Twilio 开发者布道师在这里。

You can use PythonAnywhere!你可以使用 PythonAnywhere! Directions are outlined in this blog post by my coworker Miguel Grinberg . 我的同事 Miguel Grinberg 在这篇博文中概述了方向。 It's easier to use than Heroku (which you could also use), and 100% focused on Python.它比 Heroku(您也可以使用)更容易使用,并且 100% 专注于 Python。

Let me know if this helps at all!让我知道这是否有帮助!

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

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