Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Facebook service to latest Facebook Graph API version v13.0 and change field from engagement to og_object #179

Conversation

richard67
Copy link
Contributor

Current Facebook Graph API version v13.0 has been released on February 8, 2022, see https://developers.facebook.com/docs/graph-api/changelog.

The changelog for version 13 seems not to be ready, but the blog post here doesn't show any breaking changes: https://developers.facebook.com/blog/post/2022/02/08/introducing-facebook-graph-marketing-api-v13

But there is something which has been noted in the release notes of version v10.0 which has an impact on getting the share counters, see section "URL" https://developers.facebook.com/docs/graph-api/changelog/version10.0 :

URL

Applies to v10.0+. Will apply to all versions on May 25, 2021.

Engagement
- Due to privacy concerns, counts returned by a "GET /?id={url}/engagement" request may not match raw counts. 
- Requests for the "GET /?id={url}/engagement" field for the same URL will be limited to 10 requests per hour.

The first point seems to be the reason that the counters in the answer are all zero when using the existing code with just the version number changed, like I have done it many times with PR, the last one is #169 .

But if I change fields=engagement to fields=og_object{engagement} (or to be precise, fields=og_object%7Bengagement%7D with the curly brasckets encoded), then it works, and the response looks like:

{
   "og_object": {
      "engagement": {
         "count": 43,
         "social_sentence": "43 people like this."
      },
      "id": "132647790271874"
   },
   "id": "http://www.richard-fath.de/de/music/recordings/htlv-iii.html"
}

The count is the total of the 3 counts which are received with the current code without this PR.

This PR here makes the necessary changes to work that way. I also works with previous API versions in that way.

The second point mentioned in their change log could make it necessary to re-consider something like suggested in issue #148 .

But it could also be that the restriction doesn't apply with the change in this PR. The docs are not clear to me about this.

How to test: Code review should be sufficient, but if necessary, check if Facebook counts still work with this PR applied and if the result is the same as without this PR applied. Of course I've tested this on my website, as usual.

Reason for this PR:

As already elaborated in PR #128, Shariff backend will not get any result for an app_id if the app has been created with a newer Graph API version than the one which Shariff backend uses in the URL for getting the counts, because a Facebook app is limited to the minimum Graph API version which was current when the app has been created.

In addition, it could be necessary soon to get this PR merged due to the statement Applies to v10.0+. Will apply to all versions on May 25, 2021. in their change log.

@richard67
Copy link
Contributor Author

Closing in favour of #186 .

@richard67 richard67 closed this Jun 12, 2022
@richard67 richard67 deleted the update-fb-graph-api-13.0-and-change-field branch October 21, 2023 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant