问题
While fiddling with the Gmail API, I noticed that if I don't use any filters, the Users.messages: list method also returns messages sent and received through Google Hangout or Gmail Chat. Which is very nice.
The json object for a Hangout message is structured like an email (with payload, headers etc), but the only header provided is the sender. There's no information about the time the message is sent. I've looked through all other Gmail API methods (threads, history...) but none of them provides datetime information for chat messages.
Any idea if/how I could lookup a timestamp for chat/hangout messages (from within a backend process)?
回答1:
Hangout chats show up in the Gmail API is a known issue, using the Gmail API for Hangout chats is not supported.
回答2:
As mentioned by kroikie it is a known issue all you can do it filter them outusing "NOT is:chat" in the search query:
eg q=from:x@y.com%20NOT%20is:chats
Just to save time I searched the docs (https://developers.google.com/gmail/api/overview) and as far as I can see you can not get the data from the history or tread list calls either.
回答3:
While hangouts and chats are not what the Gmail API is intended for, Gmail API now does expose an "internalDate" timestamp field on all Message objects (including chats and hangouts), so you can likely get what you want from there: https://developers.google.com/gmail/api/release-notes#2015-06-18
来源:https://stackoverflow.com/questions/25316138/find-timestamp-for-hangout-and-chat-messages-retrieved-with-gmail-api