-
Notifications
You must be signed in to change notification settings - Fork 225
Examples
Here a few examples on using KalSMS & Reply XML to implement SMS tasks:
While there any number of ways a person in a developed nation can get the weather report, it’s not necessarily so for, say, a farmer in a remote region of a developing nation. Here’s how to easily create an SMS service that’ll provide the weather report via SMS:
- KalSMS is configured to use identifier
weather
and URLhttp://qkhack.appspot.com/weather
- A user texts a message like
weather 10026
to the phone running KalSMS
- KalSMS sends the message contents and sender phone # to that URL, for example http://qkhack.appspot.com/weather?sender=6465551234&msg=Weather+10026
- The URL runs a short python (or any language) script retrieving the weather information for zip 10026 and rendering it in KalSMS’s Reply XML format:
<reply> <sms-to-sender>Cloudy 74F today, Rain 78F tomorrow, Sunny 74F Tuesday</sms-to-sender> </reply>
- Reading the URL’s response, KalSMS texts the weather information back to the user.
A single Android phone with a local SIM card and KalSMS installed can allow users with no web connection to access this information when they need it, for the cost of an SMS message.
A common use for SMS gateways is to relay a message sent by one person to a group of people (for example, HQ communicating with workers in the field). This can be achieved simply using Reply XML’s <sms phone="">
tag:
- HQ users sends an sms like
group msg meeting @ HQ, 1pm tomorrow<code>
- The message is sent via KalSMS to the group hub application, which responds with an XML similar to:
<reply>
<sms phone="5551234">meeting @ HQ, 1pm tomorrow</sms>
<sms phone="5554567">meeting @ HQ, 1pm tomorrow</sms>
<sms phone="5558901">meeting @ HQ, 1pm tomorrow</sms>
<sms phone="5557777">meeting @ HQ, 1pm tomorrow</sms>
<sms-to-sender>Message sent to 5551234, 5554567, 5558901, 5557777</sms-to-sender>
</reply>
Upon getting this reply, the KalSMS-installed phone will send the SMS message to the phone numbers listed.