Use RapidSMS to build a text message Platform (1)

Source: Internet
Author: User

I always wanted to write a python text message platform and use the text message modem as an interface to achieve two-way communication and remote control with the mobile phone. Google recently discovered the RapidSMS framework, it is exactly what I think and need.

The RapidSMS framework mainly integrates Django as the implementation of the Web interface and the management of the background database. The underlying layer uses a library called pygsm to interact with the modem. This library can also be used independently, it is very convenient to send and receive text messages, and also supports the SMS gateway mode.

 

RapidSMS installation:

If pygsm is not installed, install pygsm, https://github.com/rapidsms/pygsm first

The simple easy_install RapidSMS will be OK, and the dependency will be automatically processed, and the dependent libraries and packages will be installed.

 

Install sms modem:

You can refer to the text in the text message development category. There is a lot of information on the Internet, so I will not go into details.

 

RapidSMS Getting Started:

RapidSMS directly imitates Django in many places, such as the command line.

1. Create a new project rapidsms-admin.py startproject myproject

2. You can see that the directory structure and generated file are similar to those of Django. Edit settings. py:

Configure the sms modem and enter "Port" in the connection port of the sms modem:

INSTALLED_BACKENDS = {
"att": {
"ENGINE": "rapidsms.backends.gsm",
"PORT": "com1"
},
#"verizon": {
# "ENGINE": "rapidsms.backends.gsm,
# "PORT": "/dev/ttyUSB1"
#},
"message_tester": {
"ENGINE": "rapidsms.backends.bucket",
}
}

3. Python manage. py syncdb. This is the same as Django. Synchronize the database and enter the user name and password.

4. Python manage. py runrouter starts the router and establishes an interactive loop with the SMS Server.

Python manage. py runserver 8080 starts Django's Web Service

After the above two services are started, the text message service and the Web service will be connected. By sending a text message to the phone number of the text message server, the information will be processed and saved to the database, access the web page to view the received and sent information.

 

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.