Skip to content

Instantly share code, notes, and snippets.

@homebysix
Last active April 28, 2020 22:40
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save homebysix/1438d58047e49181fade to your computer and use it in GitHub Desktop.
Save homebysix/1438d58047e49181fade to your computer and use it in GitHub Desktop.
send_imessage.sh
#!/bin/bash
RECIPIENT="+14155551212"
MESSAGE="Hello world"
cat << EOF > /tmp/send_imessage.scpt
tell application "Messages"
set serviceID to get id of first service
set theRecipient to buddy "${RECIPIENT}" of service id serviceID
send "${MESSAGE}" to theRecipient
end tell
EOF
osascript /tmp/send_imessage.scpt
rm -f /tmp/send_imessage.scpt
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment