Drupal SMS Service

To promote its project and to invite users to the monthly events, the local Council wants to send 40,000 text messages at a time to registered subscribers, this figure is expected to double the following year and will continue to increment.

I built a custom module for sending bulk SMS from a Drupal site hosted on a virtual cloud server which connects to a database with currently 40,000 subscribers hosted by the local council. Only the client has access to the cloud server which has security measures and an SSL certificate.

The system relies on the contributed module SMS Framework and its sub-module SMS Blast to do the validation and message sending, etc. and TxtLocal acts as a gateway to match data with the API of the SMS service provider which was chosen by the client.

Challenges:

  1. Ensured the server is capable of sending 200,000 messages in short time.
  2. Ported the TxtLocal module to Drupal 7.
  3. Because the client will be charged for messages not reaching the recipient, I added a validation handler to From API using a PHP script authored by John Gardner.
  4. Added a mechanism to compare the database with the delivery report which will be retrieved from Txtlocal after each transaction, and to instruct SMS Blaster to send messages to valid numbers only. No extra charge!
  5. Because there is extra charge for a message exceeding 160 characters, I used the contributed module maxlength.

Additional validation was added to check for valid UK numbers using John Gardner's script which uses regular expression match. The script can also be used for forcing the client to input a UK mobile number.

Although SMS Framework and SMS Blaster are responsible for all the text messaging job, Drupal core provided the user registration system, PDO schema, form API, access permissions and of course security which play a major part in this project.

Drupal for Mass SMS Service

There are several UK providers offering different SMS systems for different purposes. Clickatell and TextLocal are well known for providing UK schools and hospitals with mass SMS service, the first one is international and the latter is UK-based. Drupal supports both of them and any SMS provider that provides an API. There are contributed modules to support various providers, see the list on this page.

If your SMS provider is not on the list, It is possible to build a small custom module to make it work with the contributed SMS framework which is well documented and describes the steps for developing modules to use its PHP classes.

Category