有什么方法可以得到消息的发送日期吗?
目标:从google获取所有消息(电子邮件和外挂),以及发送的日期。
和一样:我使用的是Gmail,messages.get()端点。当我用query:in:!chats --也就是电子邮件消息获取这个端点时,一切都很好。但是,如果我使用query:in:chats (hangouts )调用它,端点返回的信息将比普通消息少,不幸的是它不会在日期发送。
有什么办法从约会信息中得到日期的信息吗?
发布于 2015-07-19 15:07:21
我建议您列出与threads.list()的全部聊天会话。
query = in:chat
GET https://www.googleapis.com/gmail/v1/users/me/threads?q=in%3Achat&access_token={YOUR_API_KEY}响应:
{
"threads": [
{
"id": "14786647099d3243",
"snippet": "until I ...",
"historyId": "147978"
}, ...
]
}然后,只需在每个聊天会话上发出一个thread.get()-request,显式地请求internalDate-parameter,在聊天中发送每条消息时,您就会得到它。
fields = messages(id,internalDate)
GET https://www.googleapis.com/gmail/v1/users/me/threads/14786647099d3243?fields=messages(id%2CinternalDate)&key={YOUR_API_KEY}响应:
{
"messages": [
{
"id": "14786647099d3243", // The Id of the chat message.
"internalDate": "1406709035161" // Time in ms when the message was created.
},
{
"id": "14786650de543fa8",
"internalDate": "1406709075429"
}, ...
]
}https://stackoverflow.com/questions/28985497
复制相似问题