Free-form Text Capture via SMS, Capturing an Address
January 28th, 2010 by Jason GoeckeA feature we recently added to Tropo is the ability to capture free-form text from a user when using one of the messaging channels, such as SMS or Instant Messaging. Previously it was required that you prompt the user for input based on a grammar:
answer
ask 'Please enter your ten digit account number.', { :choices => '[10 DIGITS]', :repeat => 3 }
hangup
This restricted the ability to capture details that are better served by free-form text, such as an address, without having to build complex grammars which are needed when doing voice recognition. While you may still use the power of grammars for voice and text, you may now obtain free-form text by passing ‘[ANY]‘ to the choices option as follows:
answer
result = ask 'Please enter your street address.', { :choices => '[ANY]', :repeat => 3 }
log result.value
hangup
Sending an SMS or Instant Message to the above script will result in this line in your log based on the user’s input (in this case ‘1234 Brewster St’):
00122 00-1 11:40:04 PM Call[14157044517->13314659919] : 1234 Brewer St
This scenario will work with both the hosted API and the Tropo Web API. Enjoy!
Related posts:
If you found this post interesting or helpful, please consider either subscribing via RSS,or following us on Twitter.


i have a tiny drop of tear in my eye
We strive to bring tears of joy to the eyes of our developers…