To send a message after a triggering event do the following - change <user_name>
to your OS X short username and <telephone_number>
to an appropriate telephone number below:
Create a dir and change to it:
mkdir ~/.soundmeter
cd ~/.soundmeter
Create an AppleScript:
nano sendMessage.applescript
with the content:
on run {targetBuddyPhone, targetMessage}
tell application "Messages"
set targetService to 1st service whose service type = iMessage
set targetBuddy to buddy targetBuddyPhone of targetService
send targetMessage to targetBuddy
end tell
end run
Create a shell script:
nano sendMessage.sh
with the content:
#!/bin/bash
osascript /Users/<user_name>/.soundmeter/sendMessage.applescript <telephone_number> "Another Arabica bean died"
and change the permissions:
chmod 755 sendMessage.sh
This should send a message to your (iPhone) telephone number. Please note that you can't send an iMessage to yourself. Sending it to an alias may work. Other similar (Apple)scripts are available here: How to send an imessage text with applescript, only in provided service?