How to forward an SMS to another number with python and twilio
I am learning python and the moment, and working on an app the uses the Twilio SMS api and TwiML. I spent way too long today trying to figure out how to forward incoming SMS messages to another phone number so I am posting it here for anyone coming after me. I am pretty good at SEO so this post should come up if you put in: Twilio SMS Forwarding Python to another number
The gist below explains how to forward an inbound SMS to another phone number. There is currently no way description on the entire internet of how to do this and it really pissed me off, so here you go. If you are reading this, I hope it came in handy for you. You need to replace your SID and AUTH Token on the top where it is in caps. Also replace “+15555555555” with the number you want to forward to. The from_number variable will only work if you aren’t in a sandbox The file needs to be accessible to the outside web and not your local server. I used ngrok because localtunnel didn’t work, but you can have it on heroku, dropbox or any other place to store your file. Just make sure you put that URL into the messaging request URL under Numbers in the twilio dashboard (you have to click the number and it should be POST). This is running on Flask with command: python filename.py