how to add facebook live chat in a website

One of the main difficulty most of the developers faced is to add live chat in a website. Nowadays thousand of online chat are available most of them have their on draw backs.But Facebook come up with new chat frame , it is one of the easiest and  light weight live chat .here we are discuss how we can add fb chat in a website

 

1) After <body> tag add this code

 <!-- Load Facebook SDK for JavaScript -->
<div id="fb-root"></div>
<script>(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#xfbml=1&version=v2.12&autoLogAppEvents=1';
 fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<!-- Your customer chat code -->
<div class="fb-customerchat"
 attribution="setup_tool"
 page_id="281874699030661">
</div>

2) Replace page id ( now:281874699030661)

3) In FB page setting > Messenger platform add White-listed domains

facebook-live-chat-into-websites

Leave a Reply

Your email address will not be published. Required fields are marked *