Cross-posted from the Google App Engine blog
Have you ever wanted to integrate SMS or voice communications into your app? We’ve been working with our friends over at Twilio to make it easier to do so. Today we’re announcing native Python and Java libraries for working with Twilio APIs onto Google Cloud Platform.
Lots of apps on App Engine have already been built with phone functionality. Check out the sample code for a group messaging app and the sample code for an app that dispatches voicemails and SMS messages to PagerDuty. Learn how to send business cards via sms through this step by step guide.
You can start building voice and SMS features into your App Engine apps today. Together with Twilio, we’ll help you get started with 2,000 free text message or voice minutes.
Ready to get started?
- Sign up for App Engine.
- Get your Twilio account and 2,000 free text message or voice minutes.
- Check out our guide on how to integrate Twilio services into your app.
Here’s a quick peek at how easy it can be to send a text message from App Engine using Python. After installing the Twilio library, it just takes a few lines of code to send an SMS.
import webapp2
from twilio import twiml
from twilio.rest import TwilioRestClient
class SendSMS(webapp2.RequestHandler):
def get(self):
# replace with your credentials from: https://www.twilio.com/user/account
account_sid = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
auth_token = "xxxxxxxxxxxxxxxxxxxxxxxxxx"
client = TwilioRestClient(account_sid, auth_token)
# replace "to" and "from_" with real numbers
rv = client.sms.messages.create(to="+14155551212",
from_="+14085551212",
body="Hello Monkey!")
self.response.write(str(rv))
app = webapp2.WSGIApplication([('/send_sms', SendSMS)],
debug=True)
Posted by Ashleigh Rentz, Editor Emerita