0

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)
Pri Mar
  • 105
  • 1
  • 6

1 Answers1

0

Found the answer:

incoming_number = request.form.get('From')
Pri Mar
  • 105
  • 1
  • 6
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 17 '22 at 20:45