kogany
kogany

Reputation: 33

Facebook Messenger Extensions Javascript Error 2071011

I am trying to use Facebook Messenger Extensions on my bot but after I've added attached html & javascript code, I receive error 2071011 (I tried this on Android phone).

<!DOCTYPE HTML>
<head>
</head>
<body> 
<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 = "//connect.facebook.com/en_US/messenger.Extensions.js";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'Messenger'));

window.extAsyncInit = function () {
    // the Messenger Extensions JS SDK is done loading
    MessengerExtensions.getUserID(function success(uids) {
        var psid = uids.psid;
        alert(psid);
    }, function error(err) {
        alert("Messenger Extension Error: " + err);
    });
};
</script>  
<h2>Test</h2>
</body>

In "messenger.Extensions.js" SDK file I found the following explanation for the error:

"JavaScript bridge does not exist - Please make sure you are in latest version of Facebook or Messenger App."

What does that mean someone can explain what is the problem?

Upvotes: 2

Views: 2864

Answers (1)

OmriToptix
OmriToptix

Reputation: 1309

I had the same problem. I fixed it by:

  1. Make sure you have the latest version of messenger
  2. Make sure your webview is opened with messenger_extensions: true
  3. Make sure you whitelist your domains :https://developers.facebook.com/docs/messenger-platform/thread-settings/domain-whitelisting

Upvotes: 2

Related Questions