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

January 29th, 2010 by Jason Goecke

Another of the multi-modal features we added to Tropo, is the ability to capture the first text a user send via SMS or Instant Message. Previously, when a user would send a message to an SMS/IM application you had written, you had no way to capture that first message. Instead you would have to send a prompt/ask back to the user to start receiving input, having lost that first message.

With the new release, this is no longer the case. With the hosted API, the initial text message is stored in the call object available at the start of your script. You may obtain the initial text string as follows (depending on the language):

$currentCall.initialText

# or

currentCall.initialText

If you are using the new Tropo Web API, then you may find the ‘initialText’ value in the session JSON string you first receive with each new session, as follows:

{ "session": { "initialText": "Hello, I would like to ask you about your app." } }

Enjoy.

Related posts:

  1. Free-form Text Capture via SMS, Capturing an Address
  2. New Tropo Web API, Conferencing and more

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


One Response to “Fetch the Initial Text of Any SMS or Instant Message on Tropo”

  1. Jonathan says:

    Important note: You can also access the initial message by using “ask” or “prompt”.

    The initial SMS / IM message is also queued up and will be supplied as input to that initial ask/prompt.

    ie if you just do

    answer();

    result=ask( “What can I do for you?”, {choices:”[any]“} );

    The initial inbound SMS / IM will be supplied as the input to the ask.

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