Update Facebook service to latest Facebook Graph API version v18.0 and change field from engagement to og_object #186
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current Facebook Graph API version v18.0 has been released on September 12, 2023, see https://developers.facebook.com/docs/graph-api/changelog.
According to the changelog, there have not been any breaking changes regarding sharing counts, see https://developers.facebook.com/docs/graph-api/changelog/version18.0, so theoretically only the version number would have to be increased with this PR here.
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 :
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
tofields=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: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.