Tropo is part of CiscoLearn More

Capturing Incoming Text

What if you wanted an application to answer differently depending on what was sent? Check out this example; it makes use of the currentCall.initialText property, which contains the message sent to the application. When a text is received, Tropo interprets the value of currentCall.initialText and tailors the response accordingly:

if(currentCall.initialText == "Yes")
    {
   say("Awesome, I totally agree.");
    }
else if(currentCall.initialText == "No")
    {
   say("Well that's just too bad");
    }
else
    {
   say("That wasn't an option, sorry");
    }
if $currentCall.initialText == "Yes"
   say "Awesome, I totally agree."
elsif $currentCall.initialText == "No"
   say "Well that's just too bad"
else
   say "That wasn't an option, sorry"
end
<?php
if($currentCall->initialText=="Yes") {
   say("Awesome, I totally agree.");
}
elseif($currentCall->initialText=="No") {
   say("Well that's just too bad");
}
else {
   say("That wasn't an option, sorry");
}
?>
if(currentCall.initialText == "Yes") :
   say("Awesome, I totally agree.")
elif(currentCall.initialText == "No") :
   say("Well that's just too bad")
else :
   say("That wasn't an option, sorry")
if(currentCall.initialText == "Yes")
    {
   say("Awesome, I totally agree.")
    }
else if(currentCall.initialText == "No")
    {
   say("Well that's just too bad")
    }
else
    {
   say("That wasn't an option, sorry")
    }