def post(self, request, hook_id):
        """
        Process Telegram webhook.
            1. Serialize Telegram message
            2. Get an enabled Telegram bot
            3. Create :class:`Update <permabots.models.telegram_api.Update>`
            5. Delay processing to a task      
            6. Response provider
        """
        serializer = UpdateSerializer(data=request.data)
        if serializer.is_valid():
            try:
                bot = caching.get_or_set(TelegramBot, hook_id)
            except TelegramBot.DoesNotExist:
                logger.warning("Hook id %s not associated to an bot" % hook_id)
                return Response(serializer.errors, status=status.HTTP_404_NOT_FOUND)
            try:
                update = self.create_update(serializer, bot)
                if bot.enabled:
                    logger.debug("Telegram Bot %s attending request %s" % (bot.token, request.data))
                    handle_update.delay(update.id, bot.id)
                else:
                    logger.error("Update %s ignored by disabled bot %s" % (update, bot.token))
            except OnlyTextMessages:
                logger.warning("Not text message %s for bot %s" % (request.data, hook_id))
                return Response(status=status.HTTP_200_OK)
            except:
                exc_info = sys.exc_info()
                traceback.print_exception(*exc_info)                
                logger.error("Error processing %s for bot %s" % (request.data, hook_id))
                return Response(serializer.errors, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
            else:
                return Response(serializer.data, status=status.HTTP_200_OK)
        logger.error("Validation error: %s from message %s" % (serializer.errors, request.data))
        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
def post ( self , request , hook_id ) : serializer = UpdateSerializer ( data = request . data ) if serializer . is_valid ( ) : try : bot = caching . get_or_set ( TelegramBot , hook_id ) except TelegramBot . DoesNotExist : logger . warning ( "Hook id %s not associated to an bot" % hook_id ) return Response ( serializer . errors , status = status . HTTP_404_NOT_FOUND ) try : update = self . create_update ( serializer , bot ) if bot . enabled : logger . debug ( "Telegram Bot %s attending request %s" % ( bot . token , request . data ) ) handle_update . delay ( update . id , bot . id ) else : logger . error ( "Update %s ignored by disabled bot %s" % ( update , bot . token ) ) except OnlyTextMessages : logger . warning ( "Not text message %s for bot %s" % ( request . data , hook_id ) ) return Response ( status = status . HTTP_200_OK ) except : exc_info = sys . exc_info ( ) traceback . print_exception ( * exc_info ) logger . error ( "Error processing %s for bot %s" % ( request . data , hook_id ) ) return Response ( serializer . errors , status = status . HTTP_500_INTERNAL_SERVER_ERROR ) else : return Response ( serializer . data , status = status . HTTP_200_OK ) logger . error ( "Validation error: %s from message %s" % ( serializer . errors , request . data ) ) return Response ( serializer . errors , status = status . HTTP_400_BAD_REQUEST )
Process Telegram webhook.
            1. Serialize Telegram message
            2. Get an enabled Telegram bot
            3. Create :class:`Update <permabots.models.telegram_api.Update>`
            5. Delay processing to a task      
            6. Response provider