Receive an SMS with Python
In this post, we'll show you how to receive SMS messages on your Vonage virtual number.
To receive inbound SMS, you need to create a publicly-accessible webhook and configure your Vonage account to use it. We'll cover that process in this post and you can find the source code on Github.
Prerequisites
You'll use Python 3 and Flask to write your webhook. You can install flask
with the pip3 package manager:
pip3 install flask
Lastly, you'll need to install our CLI. You will use this to purchase a Vonage virtual number (if you haven't already got one) and to send a test SMS.
Vonage API Account
To complete this tutorial, you will need a Vonage API account. If you don’t have one already, you can sign up today and start building with free credit. Once you have an account, you can find your API Key and API Secret at the top of the Vonage API Dashboard.
This tutorial also uses a virtual phone number. To purchase one, go to Numbers > Buy Numbers and search for one that meets your needs.