Free-form Text Capture via SMS, Capturing an Address

January 28th, 2010 by Jason Goecke

A 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:

  1. Fetch the Initial Text of Any SMS or Instant Message on Tropo

If you found this post interesting or helpful, please consider either subscribing via RSS,or following us on Twitter.


2 Responses to “Free-form Text Capture via SMS, Capturing an Address”

  1. zlu says:

    i have a tiny drop of tear in my eye

  2. Jason Goecke says:

    We strive to bring tears of joy to the eyes of our developers… ;)

Leave a Reply

Please note: By submitting a comment you agree to comply with our Comment Policy. We welcome all comments, positive or negative, but do reserve the right to remove all or part of blog comments that do not comply with our policy.

Additionally, the first time you leave a comment on this blog, it will be held for moderation. After that first comment has been approved, future comments will be posted without delay.

Additional comments powered by BackType