I have a web application and I would like to enable real time SMS notifications to the users of the applications.
我有一个Web应用程序,我想为应用程序的用户启用实时SMS通知。
Note: I currently cannot use the Twitter API because I live in West Africa, and Twitter doesn't send SMS to my country.
注意:我目前无法使用Twitter API,因为我住在西非,Twitter不会向我的国家发送短信。
Also email2sms is not an option because the mobile operators don't allow that in my country.
此外,email2sms不是一个选项,因为移动运营商不允许在我的国家/地区使用。
7 个解决方案
#1
There are a couple of options.
有几种选择。
- Get some kind of SMS modem or connectivity and use your own cell phone using smslib. I am sorry I don't provide python interfaces but my experience is Java. The downside is that you will pay the full consumer rate. And you will have to put a cell phone on your data center.
- Connect to SMPP gateway. You will have to talk to the mobile operator in order to make this work. There is a library called jsmpp here. Again, I am sorry it is not python.
- If it is too much of a hassle you could use an intermediary, which provides HTTP-SMS gateways, like this one. That's easy because you don't need to use SMPP and your system administrators wont bark at you for putting cell phones in the datacenter.
获取某种短信调制解调器或连接,并使用自己的手机使用smslib。对不起,我不提供python接口,但我的经验是Java。缺点是您将支付全部消费者费率。你必须在你的数据中心放一部手机。
连接到SMPP网关。您必须与移动运营商交谈才能完成这项工作。这里有一个名为jsmpp的库。再次,我很抱歉这不是python。
如果麻烦太多,你可以使用提供HTTP-SMS网关的中介,就像这样。这很简单,因为您不需要使用SMPP,您的系统管理员也不会嘲笑您将手机放入数据中心。
#2
What about using a proper sms gateway. These guys got APIs for several languages:
怎么样使用正确的短信网关。这些家伙获得了多种语言的API:
http://www.clickatell.com/developers/php.php
There is an unofficial Python API too
还有一个非官方的Python API
#3
Another SMS gateway with a Python interface is TextMagic. Their Python API is available from the Google Code project textmagic-sms-api-python. They have libraries available for other languages as well; all wrapping a simple HTTPS API.
另一个带有Python接口的SMS网关是TextMagic。他们的Python API可以从Google Code项目textmagic-sms-api-python中获得。他们也有其他语言的图书馆;所有包装简单的HTTPS API。
Code samples from the project website:
来自项目网站的代码示例:
How to send an SMS:
如何发送短信:
import textmagic.client
client = textmagic.client.TextMagicClient('your_username', 'your_api_password')
result = client.send("Hello, World!", "1234567890")
message_id = result['message_id'].keys()[0]
And retrieve its delivery status:
并检索其交付状态:
response = client.message_status(message_id)
status = response[message_id]['status']
(Full disclosure: I am the author of the Python wrapper library)
(完全披露:我是Python包装器库的作者)
#4
The easiest way to accomplish this is by using a third party API. Some I know that work well are:
最简单的方法是使用第三方API。有些我知道工作得很好:
- restSms.me
- Twilio.com
- Clicatell.com
I have used all of them and they easiest/cheapest one to implement was restSms.me
我已经使用了所有这些,他们最容易/最便宜的实现是restSms.me
Hope that helps.
希望有所帮助。
#5
I don't have any knowledge in this area. But I think you'll have to talk to the mobile operators, and see if they have any API for sending SMS messages. You'll probably have to pay them, or have some scheme for customers to pay them. Alternatively there might be some 3rd party that implements this functionality.
我对这方面没有任何了解。但我认为您必须与移动运营商交谈,看看他们是否有任何用于发送短信的API。您可能需要付款,或者有一些计划让客户付款。或者,可能有一些第三方实现此功能。
#6
Warning: extremely elegant solution ahead! (Android app)
警告:非常优雅的解决方案! (Android应用)
If you want to send SMS to any number in as simple of a manner as sending an e-mail:
如果您希望以发送电子邮件的方式发送短信到任何号码:
mail('configuredEMail@configuredDomain', '0981122334', 'SMS message'); // PHP
or even:
echo 'SMS message' | mail -s '0981234567' configuredEMail@configuredDomain.com
or even from a GUI mail client, then read on.
甚至从GUI邮件客户端,然后阅读。
To skip explanations google Evorion SMS Gateway.
要跳过解释google Evorion SMS Gateway。
What does it do? It forwards e-mail to SMS with a built-in battery saver. In order to send an SMS you simply send an email to 'configuredEMail@configuredDomain.com' with Subject 'phoneNumberToForwardTo'.
它有什么作用?它使用内置电池保护程序将电子邮件转发到SMS。要发送短信,您只需向主题'phoneNumberToForwardTo'发送电子邮件至'configuredEMail@configuredDomain.com'即可。
Code contributions welcome.
代码贡献欢迎。
#7
If your country is in this list, Twilio is an extremely easy API to use :)
如果你的国家在这个列表中,Twilio是一个非常容易使用的API :)
#1
There are a couple of options.
有几种选择。
- Get some kind of SMS modem or connectivity and use your own cell phone using smslib. I am sorry I don't provide python interfaces but my experience is Java. The downside is that you will pay the full consumer rate. And you will have to put a cell phone on your data center.
- Connect to SMPP gateway. You will have to talk to the mobile operator in order to make this work. There is a library called jsmpp here. Again, I am sorry it is not python.
- If it is too much of a hassle you could use an intermediary, which provides HTTP-SMS gateways, like this one. That's easy because you don't need to use SMPP and your system administrators wont bark at you for putting cell phones in the datacenter.
获取某种短信调制解调器或连接,并使用自己的手机使用smslib。对不起,我不提供python接口,但我的经验是Java。缺点是您将支付全部消费者费率。你必须在你的数据中心放一部手机。
连接到SMPP网关。您必须与移动运营商交谈才能完成这项工作。这里有一个名为jsmpp的库。再次,我很抱歉这不是python。
如果麻烦太多,你可以使用提供HTTP-SMS网关的中介,就像这样。这很简单,因为您不需要使用SMPP,您的系统管理员也不会嘲笑您将手机放入数据中心。
#2
What about using a proper sms gateway. These guys got APIs for several languages:
怎么样使用正确的短信网关。这些家伙获得了多种语言的API:
http://www.clickatell.com/developers/php.php
There is an unofficial Python API too
还有一个非官方的Python API
#3
Another SMS gateway with a Python interface is TextMagic. Their Python API is available from the Google Code project textmagic-sms-api-python. They have libraries available for other languages as well; all wrapping a simple HTTPS API.
另一个带有Python接口的SMS网关是TextMagic。他们的Python API可以从Google Code项目textmagic-sms-api-python中获得。他们也有其他语言的图书馆;所有包装简单的HTTPS API。
Code samples from the project website:
来自项目网站的代码示例:
How to send an SMS:
如何发送短信:
import textmagic.client
client = textmagic.client.TextMagicClient('your_username', 'your_api_password')
result = client.send("Hello, World!", "1234567890")
message_id = result['message_id'].keys()[0]
And retrieve its delivery status:
并检索其交付状态:
response = client.message_status(message_id)
status = response[message_id]['status']
(Full disclosure: I am the author of the Python wrapper library)
(完全披露:我是Python包装器库的作者)
#4
The easiest way to accomplish this is by using a third party API. Some I know that work well are:
最简单的方法是使用第三方API。有些我知道工作得很好:
- restSms.me
- Twilio.com
- Clicatell.com
I have used all of them and they easiest/cheapest one to implement was restSms.me
我已经使用了所有这些,他们最容易/最便宜的实现是restSms.me
Hope that helps.
希望有所帮助。
#5
I don't have any knowledge in this area. But I think you'll have to talk to the mobile operators, and see if they have any API for sending SMS messages. You'll probably have to pay them, or have some scheme for customers to pay them. Alternatively there might be some 3rd party that implements this functionality.
我对这方面没有任何了解。但我认为您必须与移动运营商交谈,看看他们是否有任何用于发送短信的API。您可能需要付款,或者有一些计划让客户付款。或者,可能有一些第三方实现此功能。
#6
Warning: extremely elegant solution ahead! (Android app)
警告:非常优雅的解决方案! (Android应用)
If you want to send SMS to any number in as simple of a manner as sending an e-mail:
如果您希望以发送电子邮件的方式发送短信到任何号码:
mail('configuredEMail@configuredDomain', '0981122334', 'SMS message'); // PHP
or even:
echo 'SMS message' | mail -s '0981234567' configuredEMail@configuredDomain.com
or even from a GUI mail client, then read on.
甚至从GUI邮件客户端,然后阅读。
To skip explanations google Evorion SMS Gateway.
要跳过解释google Evorion SMS Gateway。
What does it do? It forwards e-mail to SMS with a built-in battery saver. In order to send an SMS you simply send an email to 'configuredEMail@configuredDomain.com' with Subject 'phoneNumberToForwardTo'.
它有什么作用?它使用内置电池保护程序将电子邮件转发到SMS。要发送短信,您只需向主题'phoneNumberToForwardTo'发送电子邮件至'configuredEMail@configuredDomain.com'即可。
Code contributions welcome.
代码贡献欢迎。
#7
If your country is in this list, Twilio is an extremely easy API to use :)
如果你的国家在这个列表中,Twilio是一个非常容易使用的API :)