« ztv - an astronomical image viewer for Python | Main | Update to: SSH/SSL & making security non-onerous »
Tuesday
Mar312015

Sending iMessages from the command line

I have servers that send me emails when something is awry, but wanted to upgrade to more instantaneous iMessages in some cases. (I often only open my email a few times a day and wish I could reduce that to <=1.)

These servers use a different iCloud account than my personal account. I put the most basic contact info for myself into that iCloud account's contacts (just FirstName LastName and phone number +1-(###)-###-####).

Then the following command line will send me a message:

osascript -e 'tell application "Messages" to send "Howdy there" to buddy "1##########" of (1st service whose service type = iMessage)'

(replace the #'s with your ten digit phone number)

Be sure to use this only for good.