Get inbox messages from a date onwards - facebook

Using the Graph API Explorer, and using GET /me/inbox, I can get a list of messages.
I was wondering how to limit them to messages from the past day, for example?

You can use time based paging this way:
me/inbox?since=1372395600
It relies on the updated_time (unix timestamp) parameter of an inbox thread. This way you could get all the threads updated with a message at a time since yesterday, for example.

Related

Facebook Conversions API - Invalid Timestamp errors

I am receiving a handful of errors regarding the event timestamp. I have confirmed that I am sending a UNIX timestamp in seconds. This is what I have implemented in the front-end of our code to get the UNIX timestamp in seconds: Math.round(Date.now() / 1000)
Also, it looks like less then 1% of the events are affected for each event created, so that's why I'm a bit confused and not sure how to resolve these errors.
Error message:
The timestamp for the InitiateCheckout events sent from your server is in the future. Timestamps are metadata sent alongside each event you send from your server and they represent the time of day when an event actually occurred. For example: the time that a customer made a purchase on your website. All timestamps should represent a point in time that occurred within the last 7 days"
Click here to see a screenshot of the errors
Has anyone encountered these type of errors? If so, any advice on how to resolve them?
I am not sure how to go about this

Getting Message History

I am trying to use PowerShell to get the date of the last message submitted to a Team's chat.
Looking around, I found this blog post, which indicates that I should be able to use the LastModifiedTime property (using Get-UnifiedGroup and Get-MailboxFolderStatistics), but in my case, that value does not represent the date of the last post (it is off by more than a year).
How can I actually get this data?
I discovered the -IncludeOldestAndNewestItems parameter in Get-EXOMailboxFolderStatistics cmdlet. That seems to be reporting the correct data (in NewestItemReceivedDate).
Can you try calling List channel messages graph API. This should return the list of messages in the channel with timestamp.
You can pick the latest message from the list. Usually the first one in the list is the most recent one.

What time does the Graph's Insights API refresh the attributes with day as the aggregation period?

For example,
https://developers.facebook.com/docs/graph-api/reference/v2.11/insights
For the aggregation period 'day', Does anyone know at what time does Facebook refresh that value?
I remember reading it to be around 8am, but I can't remember if it was accurate or where I read it.
When you check out the endtime you get inside the values (Graph API Explorer request for me?fields=insights.metric(page_stories); supply your own page access token), for all three periods (day/wekk/days_28) it is of the form
2018-02-19T08:00:00+0000
Same time portion in each case.

PostgreSQL REST API Pagination

I'm following Pagination Done the Right Way, which orders by date for news.
I want to order by created_at (a timestamp) for posts (like Facebook posts).
According to PostgreSQL Date/Time Types, timestamp has a resolution of 1 microsecond.
The API's clients, however, only need (to display) whole seconds.
So, should I just round created_at to whole seconds (with CURRENT_TIMESTAMP(0)) by default when inserting new posts?
That way, to get the next page, the client can simply send back to the REST API server the created_at timestamp (in whole seconds) of the last post it received.
Otherwise, the client would have to know the exact created_at timestamp (down to the microseconds) of the last post it received.
Is there any reason to store the exact microseconds in the database (especially if they're never sent to the clients)? Isn't a whole second enough precision for something like Facebook (or Instagram) posts?

Extract significant near future local events exact location and time using Facebook Graph Search api

I am looking for a way to extract significant (number of attendees > threshold) near future (within the next week) local events exact location and time using Facebook Graph Search api.
If local cannot be done, i could just specify a city (Athens, GR for example) instead.
It would be absolutely great if the info could be extracted with one query, but i think this is too much to hope for.
What i have tried so far is:
search?fields=location,events,name&limit=300&q=athens&type=place
This produces a set of events with name relative to "athens" as well as exact location, but not the time or number of attendees or event name.
{event_ID}?fields=attending.limit(1).summary(true)
This produces the number of attendees for a specific event_ID.
The total number of significant (let's assume more than 300 attendees) event for a week's span in Athens, GR should not be very high, therefore i could manually query the API as a last resort solution.
Does anyone have any idea if/how what i am asking can be achieved?
Thank you very much in advance.
You can't do this just in one query although you can probably batch some requests (https://developers.facebook.com/docs/graph-api/making-multiple-requests).
What I would do is:
Geo query to place: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.3#search
GET graph.facebook.com
/search?
q=coffee&
type=place&
center=37.76,-122.427&
distance=1000
Get the page_id and query for public events (batch): https://developers.facebook.com/docs/graph-api/reference/page/events
Get attendants for those events (batch): https://developers.facebook.com/docs/graph-api/reference/v2.3/event/attending
I hope it helps.