Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

CommCare can generate SMS messages 

  • From the server

  • Directly from the user's phone

Each option has distinct advantages and disadvantages. For a full discussion of server-based SMS messages, see CommCare Messaging The server-based functionality provides automated messages without requiring user interaction, has a rich feature set for scheduling messages and selecting who receives a message and automatically bills the costs of the messages to the project. However, before a user action can trigger and schedule a message, the user needs to have data connectivity and successfully sync with the server.


This experience can be implemented using the Android app callout functionality.

  1. Create a hidden variable named sms_message. Populate it with the text string that should appear in the message body. 

  2. Create a hidden variable named sms_addresses. Populate it with the comma-separated list of phone numbers of the intended recipients.

  3. Insert the SMS-message sending question using the following steps:

    1. Insert an Android App Callout question, by going to Add Question > Advanced > Android App Callout.

    2. Open the form's XForms XML file, by going to the Form Builder Menu > Edit Source XML.

    3. Search for: 'odkx:intent' to find the instance of the Android App Callout question that you added above.

    4. Delete what is there, and replace it to match the example below. The "button-label" and the "data" attributes in particular for the "odkx:intent" element currently can only be set in XML.

    5. Update each of the following variables with content that matches what you would like to use:

      1. "Send SMS" => Change this to the label you would like to see on the SMS Button

      2. /data/sms_addresses => Change this to the full path of the hidden variable that contains a comma-separated list of phone numbers

      3. /data/sms_message => Change this to the full path of the hidden variable that contains the content of the message being sent

Code Block
<odkx:intent xmlns:odkx="" id="send_sms" class="android.intent.action.SENDTO" button-label="Send SMS" data="cc:xpath_key:concat('smsto:', /data/sms_addresses)">
	<extra key="sms_body" ref="/data/sms_message" />