I would like to show the latest N Facebook posts on my website.
I am using this simple code:
var FB = require('fb')
FB.api('/flourandfire/posts', 'get', { fields: [ 'message', 'picture' ], access_token: '1694494XXXXXXXX|1ba36298123bbf9689942fXXXXXXXXXX' },
function (res) {
if (!res || res.error) {
console.log(!res ? 'error occurred' : res.error)
return
}
console.log(res)
})
However, I need to be able to have some kind of filtering, since there is "noise" in the feed due to the direct link with Instagram (which results in short posts with a picture, that I do NOT want to include in the website's feed)
I basically need to somehow "differentiate" specific posts, which will then placed on the site.
I could fetch 100 posts and filter myself based on a specific tag (like #pub
; however, there is the risk of having lots of Instagram posts, more than 100, and end up with ZERO posts on the website.
How would you solve this issue?
There is no official filtering, i would do it like this:
Just an idea though, you could also increase the initial limit - but it would usually result in a slower API call so be careful with that.