Integrate messenger experience directly in osclass websites and allow user or visitors to interact with you directly from the messenger. A useful option if you have a facebook page for your osclass site, an option that will get more interaction with your business.
First, we have to create an application in facebook developer on developers facebook , if you don't have an account just follow the steps to create one, after you land of that page.
Set a name for the app => Create app => Settings => Basic => Set Privacy Policy URL => Set Terms of Service URL => Click on-off status to activate => Select a category and activate
Copy the app id in the following code:
<script> window.fbAsyncInit = function() { FB.init({ appId : '', autoLogAppEvents : true, xfbml : true, version : 'v3.2' }); }; (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script>
Add the above code in the page that you want to display the chat plugin after the body tag if you want to display this chat in all pages when you have to add the code in all pages after the body tag. This is different in each theme, some themes the body start in file header.php and this file is included in all pages so you have to add only one time this code in the header after body, but in other themes the structure is different and you have to add this code in each file.
Add this code in the footer, make sure that you include the id of your page in this code and not the id of your app:
<!-- Your customer chat code --> <div class="fb-customerchat" attribution="setup_tool" page_id=""> </div>
Next step is in page settings. Go on facebook, click on your page and after that settings tab. Here you will find Messenger Platform where you have to Whitelist your Domain and click save after you enter the domain.
Now you should see Facebook chat plugin on your site. Enjoy!