8

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)?

Kalina
  • 315
  • 3
  • 10

3 Answers3

2

Hangout chats show up in the Gmail API is a known issue, using the Gmail API for Hangout chats is not supported.

Arthur Thompson
  • 9,087
  • 4
  • 29
  • 33
1

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.

stevenup7
  • 11
  • 2
  • Not sure this adds to the selected answer. This could probably be a comment instead of an answer. – mins May 06 '15 at 19:13
  • Agreed: but ... I don't have the required reputation to make a comment but thought I would save others the searching – stevenup7 May 06 '15 at 19:20
0

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

Eric D
  • 6,901
  • 1
  • 15
  • 26