We have a chatbot on Facebook Messenger Platform, we want to provide the admins an URL to chat with a specific user, for example: https://facebook.com/<page-id>/u/<user-psid>
Currently when opening a chatting thread in a Facebook page URL is https://www.facebook.com/<page-id>/inbox/?mailbox_id=<page-id>&selected_item_id=<user-id>
when we tried replacing the user-id
with the PSID it didn't work.
Is there a way to achieve this? we just want a URL to redirect to Facebook page chatting with a user who already talked to the bot and we have his/her PSID.
You can not go to inbox using PSID. You would need ASID. You can get ASID from PSID by following this process: https://developers.facebook.com/docs/messenger-platform/identity/id-matching/ . After that, you would need read_page_mailboxes permission. It is going to deprecate from December, 2019. Read about it here: https://developers.facebook.com/docs/facebook-login/permissions/
Given the PSID, you can use Page conversation API to query the conversations of Page.
GET /v7.0/{page-id}/conversations?user_id={PSID}
Host: graph.facebook.com
This API returns Page conversations and links that you can use to open in your browser:
{
"data": [
{
"id": "t_10523963545045c18",
"link": "/My-PAGEXXX/inbox/119226229829XXXX/",
"updated_time": "2020-06-21T23:XX:XX+0000"
}
]
}
Ref: https://developers.facebook.com/docs/graph-api/reference/page/conversations/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With