Demo of Two Way SMS Gateway on a USB Stick with Drupal Integration


6 min read

The release of the “SMS Framework 1.0”:, along with the “road map for a 1.1 version”:, is making Drupal a more attractive platform for organizations that need powerful, decentralized data collection tools. This recent work shows that using Drupal can give you a serious foundation to integrate sms applications and tools with a website. I want to expand on “Will’s recent post about building a two way SMS Gateway on a USB drive”: and show how Drupal can act as a data hub for collecting data and messaging via sms.

We are interested in this because tools that can integrate with sms like this will be especially helpful for international development agencies with on the ground operations. For example, this functionality could allow an election monitoring organization to use sms to track reports from observers at polling stations or help a public heath organization to monitor when patients take medicine via sms messages sent from personal or public cell phones. It could even assist a disaster response organization to track the status of its team on the ground team through their handsets.

Proof of concept: Let’s look at the election monitoring example to put this in more concrete terms. Will pulled together a screencast to accompany this post that shows how it all works, riffing specifically on how an integrated solution could help field workers like election monitors.

Situation Example: Your organization is monitoring an election in a developing country in Africa. You have local election observers with cell phones at polling stations, a centralized headquarters to coordinate the the staff on the ground, and a Drupal site set up to collect reports in a centralized space where people from around the world can track the election turnout. To really get a sense of how the data can move, there are three main areas I want to point out:

  • (1) the set up of the hub creating a relay point
  • (2) sending messages to field workers
  • (3) collecting data from field workers


1. Hub Setup First we need to set up an sms gateway that will allow people in the field to coordinate with the headquarters. This gateway formw a bridge to the main website that’s set up to store all communication updates. Lets say I’m here at the election monitoring headquarters in Uganda, and that I have the three tools you need to set this up — a computer, a cell phone, and a USB drive. The USB drive has gnokii and a processing daemon on it — this lets us turn the cell phone into an sms gateway and connect it with our Drupal website. It follows the set up “Will described recently”: Now our communication bridge is up and running.

2. Blasting Field Operatives With the gateway in place, program people from anywhere in the world authorized to access the website can login and send out text messages to the field staff with just a few clicks. In short, this gives us a centralized blasting hub we can use to ping people to submit their data and check in on how they’re doing. Here are two common user stories we have heard from people that work in the field:

  • a. A person has not checked in in X amount of time. The website can detect when it last received an update from an election observers and can send her an auto sms asking her to check in.
  • b. If there’s an emergency situation, you can send a message asking election observers to give updates on their status and safety.

3. Collecting the Data So, we’ve sent out an sms asking people to report election results via their cell phones. Now election monitors just need to hit reply to the sms, add their data, and hit send. The text message is then sent to the cell phone of the hub operator, read by the daemon on the usb drive (this happens when gnokii checks the phone for messages, takes the messages in the queue, and processes them via the daemon to be sent to the centralized server), and then shown on the hub website. This takes about a minute, depending on how often you have it set to check the message queue and the volume of sms messages. To address a high volume of messages, security, or redundancy, you could run multiple hub centers with several USB drives and phones and run a decentralized hub network off of this. With this setup, you could have the daemons programmed to send data to the same centralized site so it can all be collected in one place.

Here is a break down of the data flow:


The Power of Drupal In real life, we’d want to parse the message out into a few different custom fields. With this data nicely organized, we could graph the data in real time as it’s coming in. Also, since we would know where election observers are based (since we have the address and GPS coordinates of the polling station), we could monitor who has checked in and show volume of turn out across the country with a map (think heat map). All of this extra functionality like graphing and mapping becomes a lot more practical and obtainable since our website is running on Drupal :).

Conclusion While this example focuses on the new functionality via the custom gnokii and daemon code that “Will has posted in his sandbox”:, the real foundation of this is the SMS framework. This example shows the strength of the framework in that Will only needed to make a custom module that hooks into the SMS Framework to allow Drupal to act as the end point of collecting and sending sms messages. It is even more impressive how this very modular setup allows third party (non- Drupal) tools like gnokii and a custom python daemon (that lives on the USB drive) to manage the process of sending and receiving messages on the Drupal side.

While this is just a proof of concept and there is a lot more work to go into the 1.1 SMS framework release, I hope the potential application of this will get people interested in testing and expanding this foundation. It’s amazing how long people have been talking about the potential of SMS data collection and dissemination yet how unattainable it remains for many organizations since the glue needed to integrate sms with other systems has been lacking. Hopefully, this is changing. After all, Obama is announcing the next vice president of the United States via sms. Hopefully this is a sign that this old and restrictive technology will get a new set of legs, and more tools like the sms framework will be built.

(We credit the inspiration of this experiment to “NDI’s”: Ian Schuler and his recent article “SMS As a Tool in Election Observation”:

What we're doing.