Twilio

Twilio is a web application programming interface (API) that software developers can use to add communications such as phone calling, messaging, video and two-factor authentication into their Python applications.

Twilio logo.

Why is Twilio a good API choice?

Interacting with the standard telephone networks to send and receive phone calls and text messages without Twilio is extremely difficult if you do not know the unique telecommunications protocols such as Session Initiation Protocol (SIP). Twilio's API abstracts the telecommunications pieces so as a developer you can simply use your favorite programming languages and frameworks in your application. For example, here's how you can send an outbound SMS using a few lines of Python code:

# import the Twilio helper library (installed with pip install twilio)
from twilio.rest import TwilioRestClient

# replace the placeholder strings in the following code line with 
# your Twilio Account SID and Auth Token from the Twilio Console
client = TwilioRestClient("ACxxxxxxxxxxxxxx", "zzzzzzzzzzzzz")

# change the "from_" number to your Twilio number and the "to" number
# to any phone number you want to send the message to 
client.messages.create(to="+19732644152", from_="+12023358536", 
                       body="Hello from Python!")

Learn more about the above code in the How to Send SMS Text Messages with Python tutorial.

How is Twilio's documentation for Python developers?

Twilio is a developer-focused company, rather than a traditional "enterprise company", so their tutorials and documentation are written by developers for fellow developers.

More Twilio resources

Disclaimer

I currently work at Twilio as a Developer Evangelist.

Do you want to know more about integrating or creating APIs?

What are web application programming interfaces (APIs)?

How do I create an API for my web application?

How do I integrate existing web APIs into my application?

Sign up for a monthly email with Full Stack Python tutorials. No spam ever.

Sponsored By

Digital Ocean logo.

Easily deploy your Python web apps to Digital Ocean's reliable cloud computing platform.


Okta logo.

Secure and manage identities in your Python web apps with Okta.


Mapbox logo.

Easily build maps, search and navigation into your Python applications with Mapbox.


Scout logo

Scout monitors the performance of your Python apps, identifying slow queries, memory bloat, and more. Free during Tech Preview.


Real Python logo

Upgrade your Python skills by reading Real Python's awesome programming email newsletter.

Full Stack Python

Full Stack Python is an open book that explains concepts in plain language and provides helpful resources for those topics.
Updates via newsletter, Twitter & Facebook.

Matt Makai 2012-2018