This script allows you to send multiple iMessages to a list of phone numbers using AppleScript and the Messages
app on macOS. You can optionally include an image or video file along with the messages. The phone numbers should be stored in a CSV file.
- macOS system with the
Messages
app. - Python 3 installed.
pandas
package installed.-
To install
pandas
, use the following command:pip install pandas
-
-
CSV File: You need a CSV file (
phone-numbers.csv
) that contains a column namedPhone
where each row includes a phone number in international format (e.g.,+16505551234
). -
Optional Image/Video: If you'd like to send an image or video, ensure the file is available locally, and update the path in the script. The path should be absolute (full path).
-
Messages Array: Modify the array
messages_to_send
in the script to include the messages you'd like to send. Each message will be sent one by one in sequence.
-
Clone or Download the Script:
Save the script to your local machine.
-
Prepare the CSV File:
Create a CSV file named
phone-numbers.csv
in the same directory as the script. It should have a column labeledPhone
with the recipient phone numbers.Example CSV:
Phone +16505551234 +14405556789 +13105554321
-
Optional: Add Image/Video:
- If you want to send an image or video, specify the absolute path to the file by editing the
image_file
variable. - If no file should be sent, comment out or set
image_file
toNone
.
image_file = os.path.abspath("./your-image.png") # Use None to disable image sending
- If you want to send an image or video, specify the absolute path to the file by editing the
-
Edit Messages:
Update the
messages_to_send
array with the messages you'd like to send.Example:
messages_to_send = [ "Hi! You've been invited to join the Beta Program.", "We'd love your feedback on our app.", "The app helps with booking, reminders, and more.", "Reply to this message to get started!" ]
-
Run the Script:
Open Terminal, navigate to the directory where the script is saved, and run:
python3 script.py
- The script uses
pandas
to load the CSV file containing phone numbers. - For each phone number, it sends the messages (and optionally, an image/video) using AppleScript, which controls the macOS
Messages
app. - Messages are sent sequentially, and there is a slight delay between each message to allow for proper processing.
-
Image/Video Sending: If you'd like to disable image/video sending, comment out the line where
image_file
is defined or set it toNone
:image_file = None
-
Message Delays: The delays in sending messages can be adjusted by modifying the
delay
values in theapplescript
portion of the script. The delays ensure that the messages are sent properly without glitches.
If any error occurs while sending messages, the script will print an error message and continue to the next phone number. Ensure your phone numbers are in the correct format and that the image/video path is correct if you are sending media.
This project is open-source and available under the MIT License.