private function sendMessages($messages, $attributes = [], $lead = null)
    {
        $accessToken = Config::get('access_token');

        if ($accessToken === null && $lead !== null) {
            $instance = $lead->instance()->first();
            
            if ($instance !== null) {
                Config::set($instance->meta);
            }
        }

        $batch = [];
        
        foreach ($messages as $message) {
            $message = $this->prepareMessage($message, $attributes, $lead);
            
            if ( ! empty($message)) {
                $batch[] = $message;
            }
        }
        
        $batch = array_values(array_filter($batch));
        
        $this->driver->sendMessages($batch);
    }