John's Blog: Text Messaging Event Notifications

September 23, 2013

One of the things on my Rumpus 8 "to do" list is adding support for recently added/expanded Apple technologies for message sending and notification. Namely, I'd like Rumpus to support the Notification Center and be able to send notices via iMessage. Automated robots sending messages to cell phones and other devices is pretty tightly controlled, understandably, due to the threat of misuse (spam, to put a name to it), so I'm not sure yet how this is going to evolve. In the meantime, I did get Rumpus to notify me via Messages, which you can use to get notices on any up-to-date iOS device or Mac. Here's how:

Messages

We're going to use an AppleScript Event Notice in Rumpus to tell the Mac OS Messages app to send the message. This means the server will need OS X 10.8 or later, and Messages will need to be running.

You'll need a dedicated AppleID for your Rumpus server, so go to Apple's Web site and create a new account. You don't need to supply credit card information; a basic AppleID other than your own is fine. On the server, launch Messages and set it up using your new Rumpus-server AppleID and password. Go ahead and test to make sure you can send messages back and forth to and from yourself using your desktop Mac or iOS device configured with your own AppleID and Messages running on the server.

The Event Notice Script

Create an Event Notice script called "Text Me" or something along those lines, and make it an AppleScript notice type. Your script will look like this:

tell application "Messages"
  set theBuddy to buddy "E:recipient@domain.com" of service "E:rumpusserver@domain.com"
  send "Received file from '<USERNAME>': <FILENAME>" to theBuddy
end tell

In this script, replace "recipient@domain.com" and "rumpusserver@domain.com" with the your Apple ID and the Apple ID you created for Rumpus, respectively. You can also edit the message as you see fit.

Watch out for copy/pasting into Rumpus' Event Notice "AppleScript" text box. It can be finicky about accepting copy/pasted returns, so you may need to either type the entire script or delete the copy/pasted returns and press the return key yourself to get the script to save properly.

The End

Now just assign the notice as an upload trigger normally. When the notice is triggered, you'll get the message no matter where you are.

If I had better scripting skills, I could probably make this script more flexible and reliable. For example, I suspect it's possible to pull the "buddy" from the Contacts list on the server, so you could define message recipients in Contacts and simplify the script. If anyone plays around with this, and has success extending my basic script here, let me know via e-mail to "support@maxum.com".

© Copyright 2018, Maxum Development Corp.