Keywords Tutorial - Create a Keyword to Report Daily Activity

We'll now setup a keyword to report the daily activity for each user.  To collect data, we first need a form that contains the questions we want to capture.  This is similar to an SMS Survey (that is not actually used in any application but is only used by Messaging).  

Setup the SMS Application

We need to add a new application to the existing project.  This application will contain all the form that represents the data to be collected by each data collector.  

  1. Add a new application to the project by going to the Applications tab and choosing New Application -> Blank Application.  

  2. Update the first module and set the name to Data Reporter Surveys

  3. And then set the case type to data_reporter

Add the Daily Activity Form

We'll add a daily activity form that is used by the data collector to report their work.  This form will also contain a last_reported_date hidden value that will be saved to the case.  We'll use this date to trigger alert reminders to the supervisor. 

  1. Rename the Untitled Form to Daily Report and add questions so it resembles the following:

  2. Save the form and configure the case management for the form.  This form will be setup to update or close cases.  We'll only save the case property last_reported_date.  When we setup the missed data collection reminder, we can use this case property to determine if the person was late to report data by more than a day.  

Configure the Data Collection Keyword

  1. To setup the data collection keyword, go the Messaging tab, then on the left side choose Keywords.  Then click on the down arrow to choose Add Structured Keyword. This will add a keyword that is used for structured data collection (one SMS will provide multiple pieces of data).  

  2. We can now configure the basics of the keyword.   A structured keyword will allow a user to answer all the questions in a given survey in a single SMS (by sending in a specially formatted SMS).  For example, to report stock on hand, a user might send in SOH 65 12 to indicate they have 65 ORS packages and 12 zinc tablet packages on hand.  

    • Keyword: This is the word that the user must send into the system to trigger the keyword.  For this tutorial, we'll use the keyword REPORT

    • Description: A quick description for what the keyword does.  For this tutorial, we can set the description to "Allows a data collector to report on their daily activity". 

    • Survey: This is the survey that contains the questions to be answered.  For this, we'll choose SMS Surveys - Data Collector Surveys - Daily Report

    • Delimiters: This allows you to choose a different character to separate each answer in the message.  For example, instead of sending SOH 65 12, some projects may prefer to send SOH-65-12.  For this tutorial, we'll just use the default delimiter (a space). 

    • Use Named Answers: This allows you to specify a name for each answer (useful if you want to allow users to skip particular answers).  For example, instead of sending in SOH 65 12, a project may prefer to send in something like SOH o65 z12.  This would then allow users to just send SOH z12 or SOH o65.   

      • For this tutorial, we'll setup named answers to make it easier for users.  We'll use h for houses visited, and p for number of participants.  

      • The xpath refers to the question in the form that each named answer is mapped to.  This is just the path of that question when writing logic in the form.  For example, a question with the ID number_participants would have the xpath of /data/number_participants.  

    • Example Structured Message: Based on the options you've chosen, you'll see a sample of the message that should be sent by a user. 

  3. In the Response section, we can configure a message that goes back to the sender or someone else when we receive the keyword.  For this keyword, we can just send a message to the sender (the data collector) to let them know that we've received their report.  

  4. The advanced section will let you configure who can send in keywords (cases, mobile worker or both).  There is also a setting to configure if they keyword will override any existing surveys.  For example, if the user uses the word REPORT in a response to an SMS survey, this option will close that survey and trigger the REPORT keyword instead.