【问题标题】:Gmail push notifications not triggered when inbox changes收件箱更改时未触发 Gmail 推送通知
【发布时间】:2022-02-12 08:39:20
【问题描述】:

我有一个 webhook,它通过订阅接收从主题发布的消息。

我还将“Pub/Sub Publisher”角色授予 gmail-api-push@system.gserviceaccount.com

我希望这足以为新邮件设置通知。

我错过了什么吗?

【问题讨论】:

    标签: push-notification gmail


    【解决方案1】:

    确实,我有一个功能性的订阅者(我的 webhook)。因此,一旦消息可用,我就会收到通知。问题是我没有要求手表。

    https://developers.google.com/gmail/api/reference/rest/v1/users/watch

    此时我还有 2 个问题:

    1. 按照上述示例请求手表需要 oAuth 身份验证。

    2. 推送通知仅包含电子邮件的 historyId。不是获取内容所需的电子邮件 ID。

    邮件内容可以通过https://developers.google.com/gmail/api/reference/rest/v1/users.messages/get获取

    我找到了一个解决方案,可以为我的服务分配域范围的权限。现在我可以阅读自己的电子邮件,而无需使用 oAuth 弹出窗口来验证我的用户。

    Client is unauthorized to retrieve access tokens using this method Gmail API C#

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-17
      • 1970-01-01
      • 2019-03-01
      • 2017-08-25
      • 1970-01-01
      • 2018-09-20
      • 2021-12-06
      相关资源
      最近更新 更多