我应该向 Gmail API 请求什么来获取电子邮件统计信息?

What should I request the Gmail API to get email statistics?

我想知道当天发送和接收的电子邮件数量(在优先收件箱中)。仅此而已。

在 Google 应用程序脚本中使用 REST API。

GET https://www.googleapis.com/gmail/v1/users/your_email%40gmail.com/messages?labelIds=SENT&q=newer_than%3A1d&key={YOUR_API_KEY}

要获取过去 24 小时内的消息数 received/sent,您可以使用 gmail.users.messages.list API. You must specify the following query: newer_than:1d to only get a list of emails that were recieved/sent in the past 24 hours. You must also specify which label to query in (INBOX or SENT). Please refer to the following screenshot. You can test it out for yourself here.