Schedule iMessage, SMS, and WhatsApp messages from .txt
files from your Mac.
- Clone this repo to your computer.
- Open
SETTINGS.txt
and replace the number aftermyself=...
to an iMessage capable phone number. - Open your terminal to this project directory and run these commands in order
virtualenv venv
source activate.sh
pip install -r requirements.txt
python send_scheduled_messages.py
- 💬 If everything went well, you should receive an iMessage text that says "Hello from iMessage!", an SMS text that says "Hello from SMS!", and a WhatsApp message that says "Hello from WhatsApp".
The script parses files in the scheduled_messages
directory that follow this filename format: {Message|SMS|WhatsApp} {person} {datetime}.txt
. You can set this directory in the SETTINGS.txt file. Every file with a {datetime}
after your system's current datetime will be sent immediately*.
- The first word in the filename must be either
Message
to send via iMessage, orSMS
to send via SMS, orWhatsApp
to send via WhatsApp. - The second word,
{person}
must be the persons identifier. This is set in SETTINGS.txt, e.g.,bob=1234567890
would setbob
's phone number to1234567890
. - Everything following the name, before the .txt, is considered the
{datetime}
. Many formats may work, but this is the only one I have tested:Month D, YYYY HH:MM(AM|PM)
, for exampleMarch 9, 2024 7:25AM
. You can also use the keywordnow
orasap
as thedatetime
to send texts immediately. - After a text is sent, it will move the file to the
sent
folder in yourscheduled_texts
directory.
*Will only send texts with {datetime}
less than MAX_OVERTIME_MINS, 30 minutes by default. This is to prevent accidentally sending really old messages. For example, if you had this script running on a cron that failed then restarted a week later, you probably don't want those week-old messages to send.
A GUI is provided if you are willing to add another dependency via
pip install PyQt5
This allows you to interface a little more easily. Although non-obvious, the timing boxes at the bottom of the GUI are scrollable. Although not as visually appealing as the iPhone alarm/countdown timer scheduler, it works roughly the same. If you wish to send now, simply don't change the time...it always defaults to the current time. On top of this, adding/changing numbers can also be driven through the GUI. Examples below.
You can easily add new contacts with form contact=number
as shown below.
You can also change someone's number with the same syntax. Note that this will be automatically overwritten. If you wish for this to throw an error instead, change the overwrite
default behavior in gui.py
.
Below is a summary of the side effects. The second screenshot is there to simply show that the GUI ONLY writes text files; it does not run the send_scheduled_message.py
script.
If you wish to have both where the GUI can flip a flag where you might want to send messages, then I would suggest adding the function outlined in bash_shortcut.sh
to your bashrc
(or whatever shell you use) file. stxt
will not send messages, and stxt 1
will go ahead and send all queued messages.
To add a new dependency to requirements.txt, run
python3 -m pipreqs.pipreqs .
Please create a GitHub issue if you have feedback or need help. Thanks!
Made by Reid JS on March 9, 2024