TLDR :)= You can find full project on github – https://github.com/jaronphillips/MotivationalTexter
This has been a fun project. It could easily be turned into some kind of fun prank. What started out as a joke from my sister-in-law has turned into something quite fun for me. My wife and her sister asked me to help with some fitness goals. Normally I would pay no attention to such a request, but this one gave me a fun idea. I wanted to randomly text them throughout the day to remind them to focus on fitness. I also wanted to automate it. I figured it would be a good python project.
First I needed to figure out if this was possible. I googled something like “python text message.” There is plenty of stuff that popped up, but most of it was for Twilio, and you had to purchase a phone number. Well, I was not that invested in this project. I did not want to pay for a new phone number… especially when google offers free ones with google voice. I googled something like “python google voice sms” and found this wonderful blog by Motion Design https://motiondesigntechnology.wordpress.com/2014/01/24/mass-texting-sms-messaging-via-google-voice-and-python/
Now we are off to the races! The googlevoice function made this pretty easy. You can send a text from python with just a few lines of code:
from googlevoice import Voice
gv.send_sms("7204369797","Hey there tubby")
Now we read from a list of phone numbers and we can send everyone on that list a text:
ListOfNumbers="PhoneNumbers.txt" PhoneList=open(ListOfNumbers, "r") PhoneNumbers=PhoneList.read().splitlines() for PhoneNumber in PhoneNumbers: gv.send_sms("7204369797","Hey there tubby")