James Fator

Sending Mass Texts using Applescript

08 December 2014

Here’s a quick way to send a batch message to multiple people quickly. The following is an Applescript which will send a custom message to a list of phone numbers.

set phoneNumbersList to {"XXXXXXXXXXX", "XXXXXXXXXXX", "XXXXXXXXXXX"}
set messageText to "Test message"

tell application "System Events"
    tell application "Messages" to activate
end tell

tell application "Messages"
    set targetService to first service whose service type = iMessage

    repeat with phoneIndex from 1 to count of phoneNumbersList
        set phoneNumber to item phoneIndex of phoneNumbersList
        set targetBuddy to buddy phoneNumber of targetService
    send messageText to targetBuddy
    end repeat
end tell

The first line is where we define the list of phone numbers, which is an 11 digit phone number (starting with the country code and area code). This can be a list of only 1 phone number, or 100 phone numbers, but each phone number needs to be wrapped in quotation marks and separated by commas inside the curly braces.

The second line is where we define the message to send out. This is what will actually be sent as a text message to the various phone numbers.

Applescripts can be run using the program “Script Editor”. This is a system utility that is pre-installed on OS X and can be found here: “/Applications/Utilities/Script Editor.app”. Once launched, the script from above can be copied and pasted into the editor window. Remember to replace the phoneNumbersList and the messageText.

From here, the script can be run by pressing the triangle button in the upper left corner of the window. WARNING: Obviously this will send out messages to each phone number in the list, so make sure you know what you’re doing.

If there is a need to send out the occasional mass message to the same list of phone numbers, this script can be saved, then opened at a later time to send any additional messages.