Check Whether an End User Accessed a Service

You may want to check whether an end user has previously accessed your service for a variety of reasons. For example, you might want to build:

  • Competition or vote services that allow only one entry per mobile number
  • Content services that check whether a user has already selected an option previously

In each case, a custom user variable is created that the service can check. For example, to limit end users from voting twice:

  1. Start the service with the Branch on Expression handler. Use this handler to check whether the custom user variable has a value entered (in this example, user.Vote). The expression ${empty user.Vote} returns true if the end user does not have a value for the variable, and false otherwise.
  2. On the true branch, create the custom variable user.Vote. In this example, the value is the message with the keyword removed (request.message.strippedMessage).
  3. On the true branch, create the service variables to gather the user's vote. E.g. a talent show might expect votes like "Tim" or "Julie" which you could check the message for, then count using variables like service.tim and service.julie. Create any further handlers you need to gather information from the end users, or to send back a confirmation to the user.
  4. On the false branch, you can add a Send SMS message to tell the end user that they have previously voted and that their vote will not be counted.