Differentiate between mentioned post and post on w

2019-08-24 05:15发布

When you query the stream table for a fan page wall contents, you get back contents posted on the fanpage wall mentioning the page and also posts from a fan on their own wall which mention the page. Is there a way to distinguish between these two types in the stream response?

For example, here is a fan page http://www.facebook.com/signalhq which pulls a post from a user who has tagged the page in his own post

http://www.facebook.com/jeff.judge/posts/10150356144351153

Is there a way to differentiate this above post from other posts on that wall? I can't find anything in the fql stream api doc to accomplish this.

3条回答
等我变得足够好
2楼-- · 2019-08-24 05:39

When you pull this post in JSON format from the Graph-API, There are "from" and "to" JSON objects in it as well...

They should be able to help you in distinguishing between the two posts

HIH!

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-08-24 05:52

As a slight modification of ifaour's post, you should run this FQL query:

SELECT target_id, post_id, message, actor_id, tagged_ids FROM stream WHERE source_id = PAGEID

The target_id field will allow you to know the object that the Post was made on. If this was the user posting on their own wall (and tagging the Page) then the target_id won't be the Page's ID. If the user posted on the Page wall AND tagged the Page in that post, then the target_id will be the Page ID.

Check out target_id on the stream FQL docs to make this clear: https://developers.facebook.com/docs/reference/fql/stream/

Edit: Clarification of the results you should be seeing:

A Post by the Page on the Pages Wall:

  • target_id = null
  • actor_id = PAGEID

A Post by a user on the Pages Wall:

  • target_id = PAGEID
  • actor_id = USERID

A Post by a user on their own wall that tags the Page:

  • target_id = null
  • actor_id = USERID

Hopefully this should help you to differentiate?

查看更多
对你真心纯属浪费
4楼-- · 2019-08-24 05:56

An easy way would be retrieving the tagged_ids field:

SELECT post_id, message, actor_id, tagged_ids FROM stream WHERE source_id = 'PAGE_ID'

This would return something like:

[
  {
    "post_id": "PAGE_ID_255888737767539",
    "message": "PAGE_NAME test",
    "actor_id": MY_ID,
    "tagged_ids": [
      PAGE_ID
    ]
  },
  {
    "post_id": "PAGE_ID_156571787756776",
    "message": "",
    "actor_id": PAGE_ID,
    "tagged_ids": []
  }
]

If the page ID presents in the tagged_ids field and the actor_id is NOT the page id then the page is mentioned by a user.

查看更多
登录 后发表回答