首页 > 解决方案 > Google Gmail API 订阅为每封新邮件或已发送电子邮件发布两个 Webhook 响应

问题描述

  1. 调用 watch() 并订阅收件箱
    watch_request = Google::Apis::GmailV1::WatchRequest.new
    watch_request.topic_name = GMAIL_SUBSCRIPTION_TOPIC_NAME
    watch_response = gmail_client.service.watch_user(google_user_id, watch_request)
  1. 将测试电子邮件发送到该收件箱或从该收件箱
  2. 通过 webhook 接收两个不同的推送通知,每个通知的历史 ID 略有不同。第二条消息在第一条消息之后几秒钟到达。

gmail 帐户似乎是标准的。我想知道这是否是预期的。我开始认为这是因为labelFilterActionlabelIds被忽略,并且多个标签与收件箱中的新未读电子邮件相匹配UNREADINBOX。最近在 2019 年 2 月的其他 StackOverflow 问题中记录了它。

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

标签: gmailgmail-apiwebhooks

解决方案


推荐阅读