Skip to content

gmail watch serve: Add --history-types flag to filter notification types #165

@niemesrw

Description

@niemesrw

Problem

When using gog gmail watch serve with a webhook integration, all Gmail history events are forwarded:

  • messagesAdded
  • messagesDeleted
  • labelsAdded
  • labelsRemoved

For most use cases (e.g., processing new emails), only messagesAdded events are relevant. Receiving notifications for deletions, archive operations, and label changes creates unnecessary webhook traffic and processing overhead.

Proposed Solution

Add a --history-types flag to gog gmail watch serve:

gog gmail watch serve \
  --history-types messagesAdded \
  --hook-url http://localhost:18789/hooks/gmail \
  ...

The Gmail API's history.list endpoint already supports filtering via the historyTypes parameter. This would just expose that capability.

Supported values: messageAdded, messageDeleted, labelAdded, labelRemoved

Default behavior: All types (current behavior, for backwards compatibility)

Use Case

Integrating with OpenClaw for AI-assisted email processing - only want to process new incoming emails, not deletions/archives.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions