Created
May 21, 2017 10:15
-
-
Save PandaWhoCodes/9a81ca9cd5b426db343ac3f162115b02 to your computer and use it in GitHub Desktop.
Facebook checks to see if the endpoint provided is valid or not.
This file contains hidden or 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
@app.route('/', methods=['GET']) | |
def verify(): | |
# when the endpoint is registered as a webhook, it must echo back | |
# the 'hub.challenge' value it receives in the query arguments | |
if request.args.get("hub.mode") == "subscribe" and request.args.get("hub.challenge"): | |
if not request.args.get("hub.verify_token") == os.environ["VERIFY_TOKEN"]: | |
return "Verification token mismatch", 403 | |
return request.args["hub.challenge"], 200 | |
return "Hello world", 200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment