Tatango SMS Gateway
Here at Tatango, the engineering team is always keeping busy. Not only by implementing new features for the tatango website like voice and rss, but also by writing tools for other developers to be able to use our services.
There are two public back-end services that we have been working on lately. One is the Tatango REST API, which allows developers to programatically interact directly with Tatango’s group infrastructure. The other, is the Tatango SMS Gateway, which allows developers to interface directly with our text-message sending capabilities. We recently released documentation for both these services at http://tatango.com/developers.
As a simple example of what can easily be done with the Tatango SMS Gateway I wrote an aviation weather tool. The tool responds with the current weather conditionsĀ for the requested airportĀ in METAR format (metar tutorial here).
For example, try sending “METAR KBLI” to our shortcode 68398. METAR tells Tatango to route your message to the aviation weather tool, and KBLI is the ICAO code for the Bellingham International Airport. You can find the ICAO code for the airport nearest you by checking this list of international airports. The weather data comes from NOAA, so I’m not sure if it works for all international airports, but METARs for the Canadian airports seem to work for me.
The code I used to interface with the Tatango SMS Gateway will be released as a rubygem soon, so keep your eyes open. Here is the basics of aviation weather tool:
1 require 'rubygems' 2 require 'tatango_sms' 3 require 'aviation_weather' 4 5 # setup a mobile terminated object with our 6 # Tatango SMS Gateway key and password 7 mt = TatangoSMS::MT.new('key','password') 8 9 # class that fetches weather info for us 10 av = AviationWeather.new 11 12 # run a server to accept incoming messages from Tatango 13 server = TatangoSMS::MO.server('0.0.0.0', 'XXXX') 14 TatangoSMS::MO.receive(server, '/') do |phone_number, content| 15 # only do anything if it looks like an ICAO airport code 16 if content =~ /([A-Z]{4})/i 17 metar = av.metar $1.upcase 18 mt.send(phone_number, metar) # send the METAR info back 19 end 20 end 21 server.run.join