- let { pageID, lang } = theme.messenger
- lang = theme.comments.use && theme.comments.use.includes('Facebook Comments') ? theme.facebook_comments.lang : lang

#fb-customer-chat.fb-customerchat(page_id=pageID attribution='biz_inbox')

script.
  document.getElementById('fb-root') ? '' : document.body.insertAdjacentHTML('afterend', '<div id="fb-root"></div>')

  window.fbAsyncInit = function() {
    FB.init({
      xfbml: true,
      version: 'v15.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/!{lang}/sdk/xfbml.customerchat.js';
    fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));

  if (!{theme.chat_btn}) {
    var chatBtnFn = () => {
      var chatBtn = document.getElementById("chat_btn")
      chatBtn.addEventListener("click", function(){
        FB.CustomerChat.show();
      });
    }
    chatBtnFn()
  } else {
    if (!{theme.chat_hide_show}) {
      function chatBtnHide () {
        FB.CustomerChat.hide()
      }
      function chatBtnShow () {
        FB.CustomerChat.show(false)
      }
    }
  }

