简体   繁体   中英

How to get the recipient ID on Facebook API v2.4 and newer (RestFB/Facebook4J)

I'm trying to send messages to customers who want to know the current state of their order. Now I know that you can only send messages to someone who sent you a message because you need to have the specific recipient ID. The problem with this is that if I want to get the recipient ID I need to read my mailbox and therefore need the permission: read_mailbox. But read_mailbox is deprecated as of Facebook API v2.4 and newer. I don't think that it is impossible to do it though. Question beeing, how to do it with v2.4 or newer?

Edit: Thanks CBroe for the answer Last problem now is that when I get a specific message it only gives me the created_time and the id back. Same thing when I try it with the GraphAPI Explorer

This:

JsonObject message = getFacebookClient().fetchObject("m_mid.1467893842385:ae7475981839704062", JsonObject.class);

Gives this:

{
  "created_time": "2016-07-07T12:17:22+0000",
  "id": "m_mid.1467893842385:ae7475981839704062"
}

What am I doing wrong? Am I missing a parameter or a permission?

No, this doesn't need read_mailbox permission.

https://developers.facebook.com/docs/graph-api/reference/page/conversations#read :

A page access token with read_page_mailboxes permission is required.

So you have to ask for that permission, plus manage_pages of course (because you need the latter to get a page access token.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM