Find timestamp for hangout and chat messages retrieved with gmail api

我怕爱的太早我们不能终老 提交于 2019-12-22 04:36:34

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!