dafian dafian - 13 days ago 10
Javascript Question

Messenger Extensions Javascript SDK Error 2071011

I'm trying to create a Messenger Web View (https://developers.facebook.com/docs/messenger-platform/messenger-extension) by using the Messenger Extensions Javascript SDK.

The page opened by the Web View has the following JS code



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





And the result is an Alert with the following message "Messenger Extension Error: 2071011". So the method "getUserID" goes in error. What "2071011" error code means? And how to solve it? I've searched a lot but nothing has been found about it.

Any help is really appreciated!!

PS: the guide says to whitelist the site of the URL and I've done that too.

Answer

How are you trying to open the webview? I was facing the same issue but then messenger extensions only work on iOS and Android as per the documentation. This code works for me on iOS and throws the same error on desktop messenger app. I hope this helps.