0

I'd like to get the PSID of the user, without using Messenger Extensions in a browser.

I'm working on a messenger bot, that lets you buy things. For the payment part, the user is redirected to an online payment site. For whatever reason, the payment web view is opened in a new tab (I guess there's something related to iframes, but that site is out of my reach).

When the payment is done, the user is redirected to mydomain.com/results.html. In results.html I need to get the PSID of the current user, but messenger extensions gives me this error:

2071011 Messenger Extensions are not enabled - could be "messenger_extensions" was not set on a url, the domain was not whitelisted or this is an outdated version of Messenger client.

The described problem only occurs on desktops, everything works fine from phones.

There's already a similar question: Get the facebook PSID without messenger extensions, but using query parameters here is not an option as I can't ask the payment site to include the PSID in the redirect parameters.

Bence Gedai
  • 1,461
  • 2
  • 13
  • 25

1 Answers1

0

Set messenger_extensions: true in the URL button and point the URL to a page you control that redirects to the 3rd party payment site. That way you can call MessengerExtensions.getContext() or pass the PSID from the chat to your site before the payment flow is initiated.

amuramoto
  • 2,838
  • 1
  • 11
  • 15