Facebook Graph API {id}/feed?limit=x - restrict to messages since a certain message id

I have a small problem, I am working on an aggregation application that is collecting messages from pages in realtime.

This is working fine, but I get the same message on every call and then filter out the messages that I have already seen manually.

This means that a large amount of data is being transferred every time I make a call to the graph api.

Is there a way to limit the message as messages since this message id?

currently using the c# Facebook SDK

        var fb = new FacebookClient("access_token");
        dynamic parameters = new ExpandoObject();
        parameters.limit = _facebookMessagesToRetrieveAtATime.ToString(CultureInfo.InvariantCulture);

        //Want to add a new param here to say messages since this id.

        var facebookUrl = String.Format("{0}/feed", "Page ID");
        dynamic resp = fb.Get(facebookUrl, parameters);

Thanks in advance.

Answers


You can use the since url parameter in your calls, as described at https://developers.facebook.com/docs/graph-api/using-graph-api/v2.1#paging

This would make it necessary that you store somewhere in your application the timestamp when you last requested the respective feed

This would yield in

var facebookUrl = String.Format("{0}/feed?since={last_update_timestamp}", "Page ID"); 

where {last_update_timestamp} is the timestamp (unixtime in seconds) of the last update.


Need Your Help