我正在使用gmailAPI获取最近的环聊消息/线程。但是我找不到查看收件人地址的方法。payload. header中唯一的字段是“从”
代码:
curl-H'授权:承载者**访问令牌**''https://www.googleapis.com/gmail/v1/users/me/threads/**threadId**? q=is:chat'
回应:
{
"id": "xxx",
"historyId": "1008967",
"messages": [{
"id": "xxx",
"threadId": "xxx",
"labelIds": [
"CHAT"
],
"snippet": "+Harry Howard",
"historyId": "1008953",
"internalDate": "1481641738948",
"payload": {
"partId": "",
"mimeType": "text/html",
"filename": "",
"headers": [{
"name": "From",
"value": "xxx"
}],
"body": {
"size": 13,
"data": "K0hhcnJ5IEhvd2FyZA=="
}
},
"sizeEstimate": 100
}]
}
对于电子邮件,有一个“收件人”字段(有时还有抄送等)。
FYI:我正在使用node-gmail-api npm模块,但只是用curl测试这个
使用User. thread:list
查找线程中的所有用户。在这里看一个例子。
HTTP请求
GET https://www.googleapis.com/gmail/v1/users/userId/threads
此请求需要至少具有以下范围之一的授权
回应
如果成功,此方法返回具有以下结构的响应正文:
{
"threads": [
users.threads Resource
],
"nextPageToken": string,
"resultSizeEstimate": unsigned integer
}