Search…

X3 Photo Gallery Support Forums

Search…
 
User avatar
GGANG
Experienced
Topic Author
Posts: 122
Joined: 02 Feb 2012, 11:01

Facebook Messenger Chat plugin Code

31 May 2021, 17:08

Hello Karl,

Please help for this code to put into the Custom Javascript. What is wrong?
Code
function x3_load_page(){
      var chatbox = document.getElementById('fb-customer-chat');
      chatbox.setAttribute("page_id", "262984240902464");
      chatbox.setAttribute("attribution", "biz_inbox");
      window.fbAsyncInit = function() {
        FB.init({
          xfbml            : true,
          version          : 'v10.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/th_TH/sdk/xfbml.customerchat.js';
        fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk')); 
      }
and I added this code to the Content Appened. Its not show a chat box. I want the position below right corner. Where should I add this code?
Code
<!-- Messenger Chat plugin Code -->
    <div id="fb-root"></div>

    <!-- Your Chat plugin code -->
    <div id="fb-customer-chat" class="fb-customerchat">
    </div>
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: Facebook Messenger Chat plugin Code

01 Jun 2021, 01:10

You want it on all pages? If so, it shouldn't go inside x3_load_page() because that triggers on all pages. Furthermore, since this Facebook script is non-jQuery and doesn't use anything inside X3, it doesn't have to go inside any function ... Just place it in custom Javascript.

As for positioning, I don't know. First you need to get it to work. Then, I will need a link to see what it does and find a solution for position.
 
User avatar
InoculateIT
Experienced
Posts: 85
Joined: 08 Jun 2010, 15:04

Re: Facebook Messenger Chat plugin Code

06 Nov 2021, 06:25

Use this code and put it on your footer, then it works :)

Goto your business fb page, then settings then create a chat bot :)

Code
<!-- Messenger Chatplugin Code -->
    <div id="fb-root"></div>

    <!-- Your Chatplugin code -->
    <div id="fb-customer-chat" class="fb-customerchat">
    </div>

    <script>
      var chatbox = document.getElementById('fb-customer-chat');
      chatbox.setAttribute("page_id", "YourIDhere");
      chatbox.setAttribute("attribution", "biz_inbox");

      window.fbAsyncInit = function() {
        FB.init({
          xfbml            : true,
          version          : 'v12.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/da_DK/sdk/xfbml.customerchat.js';
        fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk'));
    </script>
The spelling mistakes has been inserted automatically of consideration to the people who find a great pleasure to search for it...
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: Facebook Messenger Chat plugin Code

07 Nov 2021, 00:51