Facebook Messenger Extension getContext 2018154 error on iOS and Android

46 Views Asked by At

https://developers.facebook.com/community/threads/779314080662130/

We followed the guide to set up white-listed domains, included the JS SDK, and then called getContext(). However, we encountered a 2018154 error on iOS Facebook Messenger. What could be the issue? I've been stuck on this problem for a long time

Here is sample code:

var isSupported = MessengerExtensions.isInExtension();
  console.log(`the Messenger Extensions JS SDK is done loading: ${isSupported}`)

  if (isSupported) {
    MessengerExtensions.getSupportedFeatures(function success(result) {
      let features = result.supported_features;
      if (features.indexOf("context") != -1) {
        MessengerExtensions.getContext('671494588502527',
          function success(thread_context) {
            // success
            console.log(`user psid ${thread_context.psid}`)
            // document.getElementById("psid").value = thread_context.psid;
            // More code to follow
          },
          function error(err, errMsg) {
            console.log(`${err} ${JSON.stringify(errMsg)}`);
          }
        );
      }
    }, function error(err) {
      console.log(err);
    });
  }
};

And i add messenger_extensions: true in persistent menu to open it.

how to call getContext() and retreive psid normally

0

There are 0 best solutions below