Skip to content

Instantly share code, notes, and snippets.

@manniru
Forked from laurenorsini/twiliotemp2.py
Last active December 13, 2016 09:27
Show Gist options
  • Save manniru/11397033 to your computer and use it in GitHub Desktop.
Save manniru/11397033 to your computer and use it in GitHub Desktop.
from twilio.rest import TwilioRestClient
class TwilioSMS:
def __init__(self):
self.account_sid = "AC0b56c1b6b1ff87e0caaf2c41ee5a7380"
self.auth_token = "d788a0bac58674a4efdd8fdb86c201a6"
def viewsms(self):
client = TwilioRestClient(self.account_sid, self.auth_token)
sms = client.sms.messages.get("SM0aa437df1e14e2fbbc385ee2988c1cdb")
return sms.body
def makeCall(self):
client = TwilioRestClient(self.account_sid, self.auth_token)
call = client.calls.create(to="+2348033099431",
from_="+14242851118",
url="http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient")
return call.sid
def sendSMS(self, phone, message):
client = TwilioRestClient(self.account_sid, self.auth_token)
message = client.messages.create(to = phone, from_="+14242851118", body=message)
return message
twilio = TwilioSMS()
#print twilio.viewsms()
#print twilio.makeCall()
print twilio.sendSMS('+2348033099431', 'Twilio SMS Test from Google Appengine from Python')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment