Tropo WebAPI Development Guide Home  |  Frameset Home

  Receiving Text Responses  |  TOC  |  Receiving Text Messages  

Sending with IM


Applications built to send text via SMS messages can easily be used for instant messaging as well. As long as you have user credentials added to your application for the network you want to use, the only piece you'll need to change in the code is the network you want to use and swap the username for the phone number. Tropo supports JABBER, AIM, GTALK, MSN, and YAHOO for outbound messages; TWITTER is also in the same list, but is currently only viable for inbound applications.

To add IM credentials, first log in at the Tropo website, then go to "Your Applications" and expand your application so you can make changes to it. Near the bottom of the application you'll see a section labeled "Instant Message Networks" ; click on the symbol for the IM network you want to use, enter in the credentials then click the "Click to Activate" link to the right of the credential boxes.


Note that screen names need to be referenced the same way they're referenced in a standard IM client - this can vary widely from network to network (and even within a single network). For example, if you log in to Yahoo Messenger as my_account, don't use my_account@yahoo.com when activating the network. If you normally send messages to destination@yahoo.com, don't use just destination as the 'to' in your code. In addition, all networks except for AIM require the user to add your bot to their friend list. This can be done ahead of time or approved when the initial message is received.

require 'tropo-webapi-ruby'
require 'sinatra'

post '/index.json' do
  
  t = Tropo::Generator.new
  
  t.call(:to => "tropocloud2", :network => "AIM")
  t.say(:value => "Tag, you're it!")

  t.response
  
end

var sys = require('sys');
var http = require('http');
var tropo_webapi = require('tropo-webapi');

var server = http.createServer(function (request, response) {
	
	var tropo = new TropoWebAPI();
	
	//to, answerOnMedia, channel, from, headers, name, network, recording, required, timeout
	tropo.call("tropocloud2", null, null, null, null, null, "AIM", null, null, null);
		
	tropo.say("Tag, you're it!!");
	
	response.end(TropoJSON(tropo));
	
}).listen(8000); 
<?php

require 'tropo.class.php';

$tropo = new Tropo();

$tropo->call("tropocloud2", array('network'=>'AIM'));
$tropo->say("Tag, you're it!");

$tropo->RenderJson();
?>
from itty import *
from tropo import Tropo

@post('/index.json')
def index(request):

	t = Tropo()

	t.call(to="tropocloud2", network = "AIM")
	t.say("Tag, you're it!")
	
	return t.RenderJson()

run_itty(server='wsgiref', host='0.0.0.0', port=8888)
{"tropo":[
      {"call":{
         "to":"tropocloud2",
         "network":"AIM"
          }
      },
      {"say":{"value":"Tag, you're it!"}}
]}

Now that you're sending text messages, time to learn how to work with inbound text messages.

Next Step: Receiving Text Messages



  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login
  Receiving Text Responses  |  TOC  |  Receiving Text Messages  

© 2012 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site