rachael-portier
7/24/2019 - 4:50 PM

Facebook Messenger Chat

  1. Go to FB settings > Messaging > Add to website
  2. setup
  3. copy code into functions.php
function facebook_messenger() {

    ?>


<!-- Load Facebook SDK for JavaScript -->
      <div id="fb-root"></div>
      <script>
        window.fbAsyncInit = function() {
          FB.init({
            xfbml            : true,
            version          : 'v6.0'
          });
        };

        (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>

      <!-- Your customer chat code -->
      <div class="fb-customerchat"
        attribution=setup_tool
        page_id="110257860640599"
  theme_color="#46b93a"
  logged_in_greeting="Welcome to The Festool Superstore! Let us know if we can help you with anything."
  logged_out_greeting="Welcome to The Festool Superstore! Let us know if we can help you with anything.">
      </div>
	
	 <?php

}
add_action( 'wp_head', 'facebook_messenger' );