AppleScript iMessage Group Message  (Script)

Contributed by: Jace Jenkins

Overview

This simple script demonstrates how to send iMessage notifications to a Group. This is useful if there are multiple people in the household that get notified on an event that requires action.

Ex: Garage door left open notifications when no one is home

Installation

  1. Make sure iMessage is using a different account then your own
  2. Create contacts for each person you want to be notified.
  3. In the script replace "Contact Name" with the exact name of the Contact
  4. In the contact ensure only the information iMessage needs to send the message is part of the contact (ex: iPhone #)
  5. iMessage needs to be running, hence the activate command in the script

Usage

Copy and Paste the following script into the Embedded AppleScript window in the Action Tab

if value of variable "Garage_Double_Open" = "true" then
        set theMessage to "The double garage door is open and no one is home"
end if

if value of variable "Garage_Single_Open" = "true" then
    set theMessage to "The single garage door is open and no one is home"
end if

if (value of variable "Garage_Double_Open" = "true") and (value of variable "Garage_Single_Open" = "true") then
    set theMessage to "Both garage doors are open and no one is home"
end if

tell application "Messages"

    activate

    set theBuddy1 to buddy "Contact Name"
    set theBuddy2 to buddy "Contact Name"

    set thisChat to make new text chat with properties {participants:{theBuddy1, theBuddy2}}
    set thisMessage to send theMessage to thisChat

end tell