How to automatically open the chat window when a customer visits my page?

Open Settings on your fanpage, choose Messenger. In its Start conversation section, tick ON for  Automatically open the chat window.

However, this feature can’t be used on every fanpage. In order to automatically open the chat window, your page must respond to messages quickly and actively. Therefore, you should integrate the page with Fchat chatbot for Facebook to open this feature for your fanpage.