Last active
February 1, 2017 08:13
-
-
Save dolphinsue319/cf70acb6fa374db1b6813a03cdb791b2 to your computer and use it in GitHub Desktop.
Check Facebook's webhook request
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
@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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment