Skip to content

Instantly share code, notes, and snippets.

@futureshocked
Created June 10, 2020 03:59
Show Gist options
  • Save futureshocked/1810d1bec426d7a41994ee093a6b36b4 to your computer and use it in GitHub Desktop.
Save futureshocked/1810d1bec426d7a41994ee093a6b36b4 to your computer and use it in GitHub Desktop.
send_sms.py from Raspberry Pi Full Stack
# Written by Billy Hare.
# This script is part of the extension of the Raspberry Pi Full Stack project.
# With this extension, your Raspberry Pu Full Stack application will be capable
# of sending and receiving text messages via the Twilio service.
# More information: https://techexplorations.com/so/rpifs/
import os
from twilio.rest import Client
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
my_twilio_phone_number = os.environ["TWILIO_PHONE_NUMBER"]
receive_phone_number = os.environ["MY_PHONE_NUMBER"]
test_text = "Hello from my Raspberry Pi!"
client = Client(account_sid, auth_token)
client.messages.create(to = receive_phone_number,
from_ = my_twilio_phone_number,
body = test_text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment