Incoming SMS Phonenumber on Twilio

63 views Asked by At

How do I retrieve the phone number of an incoming SMS sender? I'd like to fetch old records that this SMS sender has sent in the past.

I'm currently doing this on my flask application webhook for Twilio:

@app.route("/")
def hello():

    return "Home'!"

@app.route("/sms", methods=['GET','POST'])
def sms_reply():

    # Fetch the message
    msg = request.form.get('Body')
    # Fetch the phone number?? How to do this?   

    return str(resp)
1

There are 1 answers

1
Pri Mar On

Found the answer:

incoming_number = request.form.get('From')