Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

SMS and MMS Marketing Notifications with Python and Flask (beta)

Are you ready to learn how to you use Twilio to meet your SMS and MMS marketing needs? With this Twilio Kickstart, you can get started as quickly as possible. Once your code is up-and-running, feel free to check out the SMS and MMS Marketing Notifications with Python and Flask tutorial.

Requirements

  • A recent version of Mac OS. We are working on adding Windows and Linux functionality to Kickstarts. Stay tuned!
  • Python 3.6 or higher (we use some new features like types and formatted string literals so older versions won't work.) Check out this tutorial for help!
  • A phone number in your Twilio account. To get your first Twilio phone number, head on over to the console and find a number that meets your needs with SMS capabilities.

Getting Started

Once you've downloaded your .zip file, you can uncompress in whatever directory you've downloaded it in:

unzip <accountsid>-notifications-python.zip

After that, run the Makefile commands to install all dependencies and start the server. This Makefile will create a virtual environment for your Python 3 install and install everything in it (this also makes sure nothing is installed in your global libraries!) For this example below, let's assume your Twilio phone number is +14155551212:

make install number=14155551212

...

make serve

This Kickstart will install ngrok, which lets your personal computer be accessible on the internet via an autogenerated random URL. This lets Twilio reach your personal computer once a text message is received so your application can react via webhook.

Most Twilio services use webhooks to communicate with your application. You can see your phone number configured via the Phone Number Instance page for your number on the Console.

Once your server starts, send a text saying "Hello" to the Twilio phone number. Follow it's instructions to opt-in to notifications.

Finally, use the locally running web interface to send notifications to all who have opted in.

Want to learn more about how this code works?

Dive in deeper with the other Twilio Guides.

Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.