update processResponse function for cloud code