小编Yar*_*yak的帖子

Gmail API users.watch - 没有historyId的详细信息

我已成功设置Google Pub/Sub以使用Gmail API监视功能,如下所述:https://developers.google.com/gmail/api/guides/push在我的Gmail帐户中观看INBOX标签.

一旦收到新消息,我立即以有效格式获得推送通知,如:

{ message: 
    { data: '.......',
    attributes: {},
    message_id: '1248700053943' },
subscription: '.....' }
Run Code Online (Sandbox Code Playgroud)

在我base64decode数据后,我收到电子邮件和historyId.然后,按照建议,我请求gmail.users.history.list API(通过API控制台),并将startHistoryId设置为推送通知中的historyId.然后在没有任何细节的情况下获得空响应:

GET https://www.googleapis.com/gmail/v1/users/me/history?startHistoryId=4658879&key={YOUR_API_KEY}
200 OK
- Show headers 
{
 "historyId": "4658894"
}
Run Code Online (Sandbox Code Playgroud)

因此,来自通知的historyId似乎无效.似乎Gmail users.watch API工作不正常,发送错误的historyId,或者我只是遗漏了什么?

google-api gmail-api google-cloud-pubsub

10
推荐指数
1
解决办法
2600
查看次数