Skip to content

Instantly share code, notes, and snippets.

@PandaWhoCodes
Created May 21, 2017 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PandaWhoCodes/9a81ca9cd5b426db343ac3f162115b02 to your computer and use it in GitHub Desktop.
Save PandaWhoCodes/9a81ca9cd5b426db343ac3f162115b02 to your computer and use it in GitHub Desktop.
Facebook checks to see if the endpoint provided is valid or not.
@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