Skip to content

Instantly share code, notes, and snippets.

@ritik1009
Created October 13, 2022 16:47
Show Gist options
  • Save ritik1009/f814b5c91d96158ab0c1fd08921bfa5e to your computer and use it in GitHub Desktop.
Save ritik1009/f814b5c91d96158ab0c1fd08921bfa5e to your computer and use it in GitHub Desktop.
from flask import Flask,request
app = Flask(__name__)
@app.route('/messenger_listner',methods=['POST','GET'])
def listner():
if request.method == 'POST':
print("\n recived_data",request.json)
return 'success', 200
elif request.method == 'GET':
print("\n received data: ", request.json)
challenge = request.args.get('hub.challenge')
print("\n Challenge",challenge)
if challenge == None:
return '',200
else:
return challenge
else:
return '',200
if __name__ == '__main__':
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment