Created
February 8, 2024 02:27
-
-
Save mseeks/4078d11e5d0111b12ef080e4fd2ee85f to your computer and use it in GitHub Desktop.
Python Flask app code snippet for handling MMS recorded via Twilio webhook, extracting the Media URL.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request | |
app = Flask(__name__) | |
@app.route('/webhook', methods=['POST']) | |
def webhook(): | |
# Assuming the incoming request is a form with 'MediaUrl0' for the first media item | |
media_url = request.form.get('MediaUrl0') | |
print(f'Media URL: {media_url}') | |
# Process the media as needed | |
# For an audio file, you might download it or pass it to another function for processing | |
return 'OK', 200 | |
if __name__ == '__main__': | |
app.run(debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment