Get the oldest email in inbox using GMail API (First In- First Out) - gmail-api

I want to get the oldest email in GMail inbox. What is the best way to do this action?
Using the API I cannot find any option that allows me to get the most oldest using the way FIFO: First In- First Out
Thanks you,

Related

Query Gmail by internalDate in API?

I am attempting to use the Gmail API to download all the messages inside of an account. I would like to be able to allow this process to pick up where it left off in the event that it stops or has to be run again in order to find newer messages.
At first glance it looks like what I need to do is keep track of the internalDate on the messages that I am retrieving and then use that in the q variable when I call the users.messages.list endpoint. However, I am having trouble finding a way to use that when I query the API.
Does anyone know of a way to query Gmail for all messages that have an internalDate greater or less than a specific value? Or is there a better way to download all messages inside of a Gmail account?

Is there a way to run email to/from search via the Google Email API?

I haven't been able to find any information on an API that allows to perform an email API log search on G-Suite. For security, we want to be able to have to run a search for, say, all emails originating from user#ourgsuitedomain.com and all emails coming to. While this is possible in admin.google.com, I want to know if it's possible via an API.
All I found about this is outdated threads right here on SO.
The only option to audit emails is to create an email monitor with the Email Audit API, in the case that you may want to implement ver singular search criteria, consider that the API may not fit your requirements completely. You can find the documentation at https://developers.google.com/admin-sdk/email-audit/

Order not found after secure3d

I am trying to use the API to buy using my secure3d Mastercard.
Once I have committed the buy using the API, I then redirect the user to the secure3d page using the data returned by the Coinbase API (secure3d_verification field). After the user completes the secure3d process it returns to the Coinbase buy confirmation page correctly, but it then fails stating that it can't find the order.
What is the correct process that should be followed when using secure3d?
Thanks!

Getting history events for just new messages?

I'd like to monitor a users gmail account for new messages and take an appropriate action. Is there a way to fetch the history events for just new messages but NOT for things like starring an email or changing its labels, etc.?
So I ended up using messages.list and storing the timestamp of the most recent message. Then on subsequent calls to messages.list I'd supply a query of "after:theMostRecentTimestampIKnowOf" to find new messages since the last time we synced.
Another route I've seen done, is if you have the ability to add a filter (e.g. user's can do that, or use the Google Admin SDK for Google Apps users, or do it through HTML/DOM hacking) then you can simply setup a filter to apply a label to all new messages. Then just messages.list(labelId=THAT_LABEL) when you do your polling (and remove it after you process them).
There is not any ability now to filter history based on change type, though it's something that would be nice to provide at some point.

How to implement Facebook Post Type objects in GAE?

I a new programmer and trying to implement a facebook type "feed" in my application. Like Whenever a user do some changes in his profile his linked profiles will get to know that in the form of news feed.
But I am stuck on that as I thought whenever any user saves any data (like "News", "Blog", "Event" or any "Comment") just send the id of the respective classes to the linked profiles and they will see it. Since the id is not generated before the object is saved , the problem is how can I send them. I thought of following workarounds but each have some problem.
Whenever a user posts a news .... a Post object will be made and added to User's Post Collection.
But How do the other users will knew about it.....
1) Send them the id .... but when the id is not created how can you send them the id.
2) Send them the post message and when ever they will click them ... the latest post to them from the particular user will be shown.. but if more than 3 messages then which will be shown?? Shown by the post creation Date no post greater than that date is shownn....but he needs to be shown newer posts..
3) Save the post in all followers feed. the data will be much larger then
4) all the followers on login will check all the persons they are following and save their feed after the time stamp? How to implement this as the Post is saved in User's Profile so I would have to check all the following person and then just check the feed and show them on his feed box; I think I would have to use batch Processes. Processing will take much longer.
I am using objectify-appengine to do operations on GAE.
Any help is appreciated
Are you wanting to update the page with posts in real time like on Facebook and Twitter? To achieve this on Google App Engine you can use the Channel API, which works in conjunction with Javascript to listen for new data and update the DOM.
This talk at Google I/O 2009 by Brett Slatkin describes exactly the pattern you should use for this.

Resources