Solution
@app.route("/twilio", methods=["POST"])
def inbound_sms():
response = MessagingResponse()
inbound_message = request.form.get("Body")
if inbound_message == "Hello":
response.message("Hello back to you!")
else:
response.message("Hi! Not quite sure what you meant, but okay.")
return Response(str(response), mimetype="application/xml"), 200
$ http --form POST http://127.0.0.1:5000/twilio Body=Hello
HTTP/1.0 200 OK
Content-Length: 96
Content-Type: application/xml; charset=utf-8
Date: Fri, 26 Feb 2021 12:15:30 GMT
Server: Werkzeug/1.0.1 Python/3.6.9
Hello back to you!