facebookfacebook-customer-chat

Facebook Messenger Customer Chat not showing


I'm trying to include Facebook Messenger Customer Chat Plugin in my website, but the plugin is not showing. It was working fine couple days ago but suddenly it stopped working.

I'm getting two types of errors:

1- When I'm not logged in to facebook, I'm getting this error in console:

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.facebook.com') does not match the recipient window's origin ('https://web.facebook.com').

I used FB.CustomerChat.show() in the console, and the dialog appears but the error is repeated, and the bubble isn't shown.

2- When I'm logged in to facebook, I'm not getting any errors and the plugin still doesn't appear. I used FB.CustomerChat.show() in the console, and the dialog appears but and the bubble isn't shown, but this time an Error link is displayed within the bubble's iframe saying:

this plugin requires the use of the Javascript SDK and XFBML

I tried changing the version of the sdk, changing the settings in the facebook app (developers.facebook.com), whitelisting the domain in my facebook page, tried adding #xfbml=1&version=v2.12&autoLogAppEvents=1 after the url for the sdk.. no luck at all.

      window.fbAsyncInit = function () {
        FB.init({
          appId: app_id,
          autoLogAppEvents: true,
          xfbml: true,
          version: 'v2.12'
        });
      };

      (function (d, s, id) {
        var js;
        var fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) {return;}
        js = d.createElement(s); js.id = id;
        js.src = 'https://connect.facebook.net/'+localization+'/sdk/xfbml.customerchat.js';
        fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk'));

Solution

  • Changing the version for Facebook JS SDK to v3.3 and making sure that the Facebook SDK and Facebook MCC SDK are both loaded exactly after the body tag solves the issue.

    Update: There is a bug within the Facebook JS SDK that causes this problem, you can track the issue here: https://developers.facebook.com/support/bugs/470869643489449/