First, get yourself an account with Twilio. This a free online service that allows you to send SMS from your Pi to a registered phone. Once you have registered with Twilio you get an AccountSid and Auth Token to use the Twilio REST. Keep these numbers private.
Next step is to boot up your Pi and connect to the Internet. In the LX Terminal type:
sudo apt-get update
sudo apt-get upgrade
sudo easy_install twilio
Once installed you are ready to play with the Twilio API. I found that this only worked in Python 2.
Here is my first 'Hello World' program.
#Send SMS from Twilio account #Needs to use Python 2 from twilio.rest import TwilioRestClient account_sid = "YOUR ACCOUNT SID HERE" auth_token = "YOUR AUTH TOKEN HERE" client = TwilioRestClient(account_sid, auth_token) while True: message = raw_input("Enter your SMS message\n-->") message = client.messages.create(to="NUMBER TO TEXT", from_="YOUR NEW TWILIO NUMBER", body=message) print(message.sid) print("Message sent.")...And the results...
|Messages sent from my Pi to my Lumia 950. The possibilities for custom SMS-based alerts from Pi are now limitless.|
|Sending SMS from your Windows 10 PC.|