Fetch the Initial Text of Any SMS or Instant Message on Tropo
January 29th, 2010 by Jason GoeckeAnother 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:
If you found this post interesting or helpful, please consider either subscribing via RSS,or following us on Twitter.


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.