It’s official, Skype for Mac allows for the sending of SMS - the beta version at least. The system is cheap, convenient, seems relatively reliable and, if I had not my doubts about that whole Skype thing overall, I would say it appears to be a clear winner. The best part? AppleScript integration!

Small businesses on the web, like design agencies, small hosts or site developers struggle to develop a tight business relationship with their clients. In a great many ways, SMS is the only way to reach people on the go. And on the web, you sometimes need to. Sure, there is email but, at least in Europe, a great many people do not have email capabilities enabled on their phone, because receiving them comes up at a higher cost than the free SMS.

Be careful however, maybe more than email, SMS is not to be abused. Whenever you send one, you actually cause a device to ring, vibrate or otherwise bug the hell out of people. We all have had it with that poor Japanese girl screaming that it is “Her Moto” at 7 AM in a crowded commuter train. Across the globe, you need to pay attention to time zones too - I receive about 15 SMS per night from various servers and sometimes get killing urges. Finally, SMS are expensive to send when you only send a few, a lot more so than email. Yet, their very instantaneity makes them an ideal medium for emergency or technical communications. For example:

  1. The client’s site or service went live
  2. The package is arriving to their door
  3. Their server is down and you are bringing it up
  4. You renewed their yearly billing

So, may you ask, what are you to do? Let’s say you have performed emergency maintenance on a server and need to contact people hosted on a machine named “Tarsier”. As luck has it, you store that information in your address book in the note field of every card, along with other client information.

The script below will ask you for the name of the server that experienced an issue, then pull all cards from your Address book containing that name. From these cards, it extracts the first name of the client, for that extra touch, as well as the first mobile phone number that it can find. It then composes an SMS message and sends it its merry way.

For this trick to work, you will need the latest version of Tiger, the latest beta version of Skype with SMS capability, sufficient SkypeOut credit and, of course, a phone capable of receiving SMS. Please note I am not a developer, just a French dude. The code below comes with no warranty whatsoever, neither expressed nor implied. Use it at your own and sole risk. This code will cost you money to test since it will use some SkypeOut credit. It may fail horribly with unintended consequences so I suggest you test on a machine with an Address Book containing only cards for you and/or willing beta testers. Abusing this system may break the Skype Terms and Conditions, the law of your country and all codes of good conduct. Before testing, make sure you and your testers are not charged per SMS received - an uncommon situation but, heh, this is the Internet.

Add “Server : Tarsier” to the address book cards you wish to test with. Then, change cards to save the note. Make sure phone numbers contain no spaces, dots or dashes and are written with their full country code - for example, +33800046046.

This being said, it seems to work from where I stand.

tell application "Skype" to set theServerName to (text returned) of (display dialog "Please enter a server name:" with icon 1 default answer "")

tell application "Address Book"
	set allPeopleToContact to ((people whose note contains (("Server: " & theServerName) as string)) as list)
	repeat with thePersonWeAreContacting in allPeopleToContact
		set theFirstName to (first name of thePersonWeAreContacting)
		set thePhone to (value of ((first phone of thePersonWeAreContacting) whose label = "mobile"))

		set theSMSText to "Dear " & theFirstName & ", this little note to inform you that your server \"" & theServerName & "\" suffered a short outage today. Things are now back to normal."
		tell application "Skype"
			set TheSMS to (word 2 of (send command ("CREATE SMS OUTGOING " & thePhone) script name "Notifier") as text)
			send command (("SET SMS " & TheSMS & " BODY " & theSMSText) as string) script name "Notifier"
			send command (("ALTER SMS " & TheSMS & " SEND") as string) script name "Notifier"
		end tell
	end repeat
end tell