Receiving a Text Message with the Telnyx SMS Python SDK
Video - 6 min read

Receiving a Text Message with the Telnyx SMS Python SDK

Messaging engineer, Badal Moradia walks you through how to set up your Telnyx account so you can start receiving text messages using our SMS Python SDK. Watch the video below:
Step 1: Make sure you have Flask and the Telnyx SDK installed, as well as the requests library. More information can be found on the full guide link above.
Step 2: Create a new file called app.py and paste the code found in the full guide. It should look like this:
Step 3: In your Telnyx Mission Control Portal, go to the “Auth” link in the left nav and create a new v2 API key and paste in for “YOURAPIKEY”.
Step 4: In the “Numbers” tab in Mission Control, make sure you have a number available associated with a messaging profile.
Step 5: Set up ngrok, or a similar tunneling service that enables you to receive webhooks from inbound messages to your newly created application on your local webserver.
Step 6: Go to your terminal, and set up your secure tunnel by typing “./ngrok http 8000”. Copy the forwarding domain from ngrok.
Step 7: Head back to your Mission Control Portal, click on “Messaging” and go to your Messaging Profile. Click the edit (pencil) icon and paste the forwarding domain you copied under “Send a webhook to this URL:” with one change: include “/webhooks” at the end of the domain.
So the example above:
1
https://ead8b6b4.ngrok.io
would be
1
https://ead8b6b4.ngrok.io/webhooks
Click save to set up your webhooks in your messaging profile.
Step 8: Head back to your code and change your Flask app “port” from 5000 to 8000.
Run your code, and you should be able to see your Flask app running on localhost:8000. Test by sending a message to the number you associated with your Messaging Profile from your phone, and you should be able to see the message!
Questions about your set up? We’re here to help! Our support team is available in Mission Control 24/7.
Share on Social

Worth checking out

By using the site, you agree to our use of cookies. Accept and close Find out more here.