pdebruic / Tropo
About Tropo
Tropo is shutting down. Use twilio.com instead here: https://github.com/newapplesho/twilio-smalltalk
Interface to Tropo.com With tropo.com you can have users interact with your smalltalk application using their telephones or SMS messages. See the wiki for more details and the Tropo WebAPI docs and examples at: http://www.tropo.com/docs/webapi/
Squeaksource wiki page:
Relies on:
KomHTTPServer
XMLSupport
JSON
ZincHTTPComponents
I've only used this in Pharo 1.1.1. Tropo can also interact with twitter, AIM, GChat, Skype, MSN Messenger, SIP Phones, Yahoo Messenger, jabber IM servers. They have good docs and examples. They are geared to the languages they support, but its really just receiving some JSON from them as a POST request, deciding what to do, and sending other JSON back as the response. Getting Started
Create an account at tropo.com. Their developer accounts are free to use and are full featured. They start billing once you go into production.
In your tropo.com account create a WebAPI application.
Set a URL where tropo.com can POST JSON objects to the Smalltalk API interface. They can be the same URL but it is easier for me (mentally) to have them separated and run two Kom servers on different ports in one image, and have a proxy send the requests to the correct port.
Click Add A New Phone Number . I don't think it matters what area code you choose. You need a number to make and receive calls and sms messages.
Load the ConfigurationOfTropo from this repository.
Tropo uses tokens to identify which application to run when you want to make calls or send SMS messages. So you need to copy each token into the #tropoToken method in TPSmsService and TPCallService respectively.
Send an SMS
In a workspace run
TPKomWaitForSms startOn: 8080
(or whatever port you're proxying the URL you specified on tropo.com for sms apps)
In a workspace run
TPSendSmsJson to: 'YourCellPhoneNumber' withMessage:'This came from Pharo'.
Replace YourCellPhoneNumber with your cell phone number or one where you want to send an SMS message. The phone number doesn't need to be prefixed by +1 (the USA country code) but in all the examples on tropo.com that's how they do it. Receive an SMS
If its not already running and waiting in a workspace run
TPKomWaitForSms startOn: 8080
(or whatever port you're proxying the URL you specified on tropo.com for sms apps)
Open a transcript
Send an SMS to the number Tropo assigned your app.
look at the transcript.
To actually do something useful with the text message you'd have to make some changes in TPKomWaitForSms class>>handleRequest: Make a telephone call
In a workspace run
TPKomWaitForCall startOn: 8081
(or whatever port you're proxying the URL you specified on tropo.com for voice apps)
In a workspace run
TPMakeCallJson to: 'NumberYouWantToCall' withMessage:'This came from Pharo'.
Replace NumberYouWantToCall with the number you want to call. The phone number doesn't need to be prefixed by +1 (the USA country code) but in all the examples on tropo.com that's how they do it. You can set options for the voice, they will call anywhere, the voices can speak several languages. Receive a call
I don't know what to do as I haven't tried it yet. I think it'd go like this:
In a workspace run
TPKomWaitForCall startOn: 8081
(or whatever port you're proxying the URL you specified on tropo.com for voice apps)
Should be similar to receiving a text except that I think you explicity have to tell tropo to answer the call, hangup, how to respond, etc. Have a SMS or Phone conversation
Change findNextResponse: to return something meaningful to the receiver. Its in TPSmsService and TPCallService.
