Events received from Facebook

async def receive_events(self, request: HttpRequest):
        """
        Events received from Facebook
        """

        body = await request.read()
        s = self.settings()

        try:
            content = ujson.loads(body)
        except ValueError:
            return json_response({
                'error': True,
                'message': 'Cannot decode body'
            }, status=400)

        secret = s['app_secret']
        actual_sig = request.headers['X-Hub-Signature']
        expected_sig = sign_message(body, secret)

        if not hmac.compare_digest(actual_sig, expected_sig):
            return json_response({
                'error': True,
                'message': 'Invalid signature',
            }, status=401)

        for entry in content['entry']:
            for raw_message in entry.get('messaging', []):
                message = FacebookMessage(raw_message, self)
                await self.handle_event(message)

        return json_response({
            'ok': True,
        })