Building simple SMS interactivity with AppleScript (and PHP)

SMS applications, where you send an SMS message and let it trigger events has great potential. The following suggestions are mostly for demonstration purposes, and will only deal with incoming SMSs.

Building blocks:

BluePhoneElite can pass details from an incoming SMS to an AppleScript, like the following.

on newSMS(smsRecord)

set t to urlencode(message of smsRecord)
set u to "http://domain.org/sms.php?t=" & t

tell application "Safari"
open location u
end tell

end newSMS

Being an AppleScript novice, I borrowed the urlencode function.

The other properties, like phone number, that BluePhoneElite passes in the smsRecord are listed in the documentation to BluePhoneElite.

Of course you could do much more AppleScripting, but I have the impression that most people would rather program the interactivity for all input channels (sms, email, web, wap) with the same script language, like php. A simple php script that takes the message part of the sms and writes to a file could look like this:

<?php
$handle = fopen ("sms.txt", 'a');
fwrite ($handle, $t);
fclose ($handle);
?>

To investigate further:

  • How to make BluePhoneElite respond to AppleScript events so that it can send SMS triggered by other applications?
  • Would it be possible to use the scripting in AddressBook to do things similar to what I have done?

My name is Simon Winter. I am a cognitive scientist, interaction designer and teach (mobile) usability at Växjö University. Comments are very welcome by email to simon@simonwinter.se.