Last active
September 28, 2017 20:43
-
-
Save JudeMolloy/ff1bf5fa0a7eb88b7aeb15b4d7188da1 to your computer and use it in GitHub Desktop.
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
def get(self, request, *args, **kwargs): | |
if self.request.GET['hub.verify_token'] == '7221896199': | |
return HttpResponse(self.request.GET['hub.challenge']) | |
else: | |
return HttpResponse('Error, invalid token') | |
@method_decorator(csrf_exempt) | |
def dispatch(self, request, *args, **kwargs): | |
return generic.View.dispatch(self, request, *args, **kwargs) | |
# POST function to handle Facebook messages | |
def post(self, request, *args, **kwargs): | |
# Converts the text payload into a python dictionary | |
incoming_message = json.loads(self.request.body.decode('utf-8')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment