How to: IM and Text/SMS Your VoiceXML Applications!

August 27th, 2009 by mthompson

As Dan York mentioned in one of his recent blogs, you can now add SMS and instant messaging (IM) to your applications! Today’s blog will give you step-by-step instructions on how to do this with our Evolution Developer Portal!

IMing Your Application

1. Create a simple VoiceXML application. For illustrative purposes, here is a VXML application with a very simple grammar using SISR returns:

<?xml version="1.0"?>
<vxml version="2.1">

 <form>

  <field name="F_1">

	<nomatch>
	<prompt>
	  I'm sorry, but I did not recognize that sandwich.  It must not be THAT good!
	</prompt>
	</nomatch>

	<nomatch count="3">
	<prompt>
	  You must not be up to speed on your sandwich trivia!  Please try again when your taste in food changes.
	</prompt>
	<disconnect/>
	</nomatch>

	<noinput>
	<prompt>You must be busy eating a delicious sandwich!  I'll wait for you to finish chewing... </prompt>
	</noinput>

	<noinput count="3">
	<prompt>  I'm sorry, you must have gone off to eat a delicious sandwich!  Please try me again later when you're ready to dominate sandwich trivia! </prompt>
	<disconnect/>
	</noinput>

      <prompt> Hello there! Please tell me, what is the best sandwich ever created? </prompt>

			  <grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en-US"
								root = "MYRULE">

				  <rule id="MYRULE">
					<one-of>
					  <item> pulled pork <tag>out.F_1="a pulled pork sandwich";</tag> </item>
					  <item> pbj <tag>out.F_1="peanut butter and jelly";</tag> </item>
					  <item> peanut butter and jelly <tag>out.F_1="peanut butter and jelly";</tag> </item>
					  <item> turkey <tag>out.F_1="a Turkey sandwich";</tag> </item>
					  <item> club <tag>out.F_1="a Club sandwich";</tag> </item>
					  <item> hot pastrami <tag>out.F_1="a hot pastrami sandwich";</tag> </item>
					  <item> ham and cheese <tag>out.F_1="ham and cheese";</tag> </item>
					</one-of>
				  </rule>
				</grammar>

					  <filled>

					  <prompt> you selected <value expr="F_1"/>.  I couldn't agree more! </prompt>

					  </filled>

   </field>

 </form>

</vxml>

2. Create a VoiceXML 2.1 application mapping in staging

3. Select “Both” in the radio button that says: What forms of communication will this application support?

4. Choose “Staging: Prophecy 10.0 – VoiceXML 2.1 w/ SMS” from the drop down menu that is created after step 3

5. Map the URL associated with your VoiceXML application to the Messaging URL field (The Voice URL does not have to match, but it can if you would like).

After all of the above steps are completed, your application manager should look like this:

app_manager

6. Go to the contact methods tab and scroll down to Instant Messaging Networks. This is where you create the IM bot to interface with your VoiceXML application. I used Jabber in my testing, but you’re welcome to use whatever you want. For illustrative purposes, let’s use Jabber. Type whatever username you want in the blank field and click “Activate Jabber”. I used the name simple_grammar_tester.

7. Open up whatever IM client you are using for Jabber and add the contact simple_grammar_tester@bot.im, or whatever username you chose @bot.im. Accept the authorization request, and you should then see the bot online.

8. Open an IM window and start talking to your Bot. A simple “hello” will suffice. At that moment, the bot will load up your VoiceXML application and spit back whatever TTS you have defined in your application. Using my above application, you will see: What is the best sandwich ever created?

Note: Any <log> statement in your application will not be picked up by the IM Bot. You will need to use <prompt>, as that is what the IM/SMS API is looking for.

9. Respond to the IM with whatever you see listed in the grammar above. For illustrative purposes, let’s say Turkey.

10. The IM bot responds with “You selected Turkey. I couldn’t agree more!”

Texting Your Application

Once you have the ”’Messaging Application Type”’ and ”’Messaging URL”’ setup properly, simply go to your ”’Contact Methods”’ tab and choose your new SMS capable number via the ”’Add new SMS-enabled number”’. You can call this number as well, so there’s no need to map a plain DID in addition to an SMS DID.

sms_number

Now all you have to do is text something like “Hello” to your SMS enabled number, and you should receive a text back with your first prompt, then interact with the application as needed.

For those of you interested in doing this with Tropo, we also have a blog post generated for such a purpose here.

If you have any questions at all surrounding this, please leave a comment and let us know!

Enjoy!

Mike Thompson
Voxeo Corporation

Related posts:

  1. Code Walk: Listening to Identi.ca (OSCON 2008 Demo #2: VoiceXML)

Want to learn how Voxeo can help unlock your communications and deliver a better customer experience? Please contact us!

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


2 Tweets

3 Responses to “How to: IM and Text/SMS Your VoiceXML Applications!”

  1. voxeo Says:

    How to: IM and Text/SMS Your VoiceXML Applications! http://bit.ly/sfP6t

    This comment was originally posted on Twitter

  2. The Tropo Blog » Blog Archive » Messaging with Tropo Says:

    [...] for support of SMS and Instant Messaging at SpeechTek this week, I would like to build upon Mike Thompson’s post for building Messaging into your Tropo applications. To get started all you need is the same Tropo [...]

  3. ….::: VOX POPULI :::…. » Blog Archive » Next Steps in the Evolution of Multimodal Applications Says:

    [...] for almost any developer to build one. Even more compelling, Voxeo’s platform lets you re-purpose applications developed for one specific modality (i.e., phone) for others (SMS, or [...]

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