Get the facebook PSID without messenger extensions

2019-07-22 14:44发布

问题:

I'm working on a messenger bot and i have a web url that is a webview. For that part, with the Messenger Extension JS SDK, I manage to get the ID of the User.

But if the user is not on messenger and click on the link, I have no way to get the user PSID. The only way is to use account linking but it's not type "web_url".

How to pass the user PSID (or some parameters to have it) to page that user opens from the bot.

Any ideas ?

回答1:

As long as you know what user youre sending the url to, use query strings to pass parameters in the url.

Send the user to www.myurl.com/page?psid=USERPSID where you are passing the user id your bot has access to. Messenger extensions should not be necessary for this.

To use js to get the query params from the url from within the page your user ends up on, check out this question