forked from qodo-ai/pr-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Overview
Add Gmail integration via Cloud Pub/Sub for email-triggered actions.
Push Notifications via Pub/Sub
Gmail uses Google Cloud Pub/Sub (not traditional webhooks):
Setup
- Create Pub/Sub topic
- Grant
gmail-api-push@system.gserviceaccount.compublish rights - Call
users.watch()to start notifications - Watch expires after 7 days (refresh daily)
Payload Structure
{
"message": {
"data": "base64_encoded_data",
"messageId": "xxx",
"publishTime": "2024-01-01T00:00:00Z"
},
"subscription": "projects/xxx/subscriptions/xxx"
}Decoded Data
{
"emailAddress": "user@example.com",
"historyId": "123456789"
}Polling via History API
Efficient incremental sync:
GET /gmail/v1/users/me/history?startHistoryId=xxx- Filter by
historyTypes:messageAdded,labelAdded - Store
historyIdbetween polls
OAuth Scopes
gmail.readonly- Read onlygmail.modify- Read + modify labelsgmail.send- Send emails
Tasks
- Implement
GmailPollerusing History API - Add Pub/Sub webhook handler
- OAuth 2.0 flow for Gmail access
- Watch for PR notification emails
- Extract PR URLs from emails
Use Cases
- Email Triggers: Process PR review request emails
- Digest: Summarize PR emails into daily digest
- Auto-Reply: Draft PR review responses
- Notifications: Email summaries of PR activity
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request