The Twilio module provides standalone integration with the Twilio cloud communication provider. It was born out of a need for a simple SMS integration solution for Drupal 7 but has evolved to encapsulate the wide array of features available specifically to the Twilio platform.

Dependencies

Libraries API

Installation

  1. Install the Twilio module as per usual (http://drupal.org/node/895232/)
  2. Download the 4.x Twilio php library from (https://github.com/twilio/twilio-php/archive/4.11.0.tar.gz) and extract the zip file into your sites/all/libraries folder.
  3. Rename the extracted folder from 'twilio-php-latest' to 'twilio'.
  4. Go to admin/reports/status report and ensure that the 4.x Twilio php library was installed correctly (the 'Twilio library' line will show in green). If it is not green, make sure you changed the Twilio library folder name to 'twilio' and uploaded the 4.x version.
  5. Visit 'admin/config/system/twilio' and enter your Twilio account SID, Auth Token, and Phone number found on the Twilio dashboard

Integration

Rules - Adds rules events and actions for SMS messages

Basic Rules Integration Instructions

  1. Install the Rules module as per usual (http://drupal.org/node/895232/)

Option 1. Send SMS Message Based on Drupal Event

  1. Visit 'admin/config/workflow/rules', click 'Add new rule', and enter a name for the rule.
  2. Select event to react on from 'React on Event' drop-down menu.
  3. For example, to react on when an article is created, select 'After saving new content' and then restrict by type 'Article'.
  4. You can add conditions that restrict when your SMS will be sent by selecting 'Add condition' under 'Conditions'.
  5. Finally, select 'Add action' under 'Actions' to configure sending an SMS message. For 'Select the action to add', you can choose to send the message to a specific number, a user, or a group of users using the drop-down menu.

Option 2. Execute Drupal Event based on a Received SMS Message

  1. Visit 'admin/config/system/twilio' and copy the SMS request URL, which is located under 'Module Callbacks'. Then go to 'Manage Active Phone Numbers' in your Twilio account console. Click the desired phone number and paste the SMS request URL into the box next to 'A message comes in'. Configure with 'Webhooks/TwiML' and select 'Webhook' and 'HTTP Post' in the two drop-down boxes.
  2. Visit 'admin/config/workflow/rules', click 'Add new rule', and enter a name for the rule.
  3. In the 'React on event' drop-down menu, select 'Drupal receives an SMS'.
  4. You can add conditions that restrict how your site will react to received SMS messages by selecting 'Add condition' under 'Conditions'.
  5. Finally, select 'Add action' under 'Actions' to perform the desired event that the received SMS message triggers. For example, to create a new article node, select 'Create a new entity' in the 'Select the action to add' drop-down menu. Then for the entity type value, select 'node' and for the content type value, select 'article'. Enter the desired title and author. You can also change additional fields as needed by adding more actions via 'Add action'.

How-To Screencasts

Alternatives

Some alternatives for integrating Twilio into your Drupal site include the following: