Skip to content

Instantly share code, notes, and snippets.

@dolphinsue319
Last active February 1, 2017 08:13
Show Gist options
  • Save dolphinsue319/cf70acb6fa374db1b6813a03cdb791b2 to your computer and use it in GitHub Desktop.
Save dolphinsue319/cf70acb6fa374db1b6813a03cdb791b2 to your computer and use it in GitHub Desktop.
Check Facebook's webhook request
@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