feat(imap): added support for imap trigger#2663
Merged
waleedlatif1 merged 4 commits intostagingfrom Jan 2, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryAdds IMAP trigger support enabling workflows to start when new emails arrive via IMAP protocol (Gmail, Outlook, Yahoo, etc.). Implements polling service with multi-mailbox monitoring, configurable search criteria, attachment handling, and proper concurrency control. Key changes:
Implementation highlights:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Cron as Cron Job
participant API as /api/webhooks/poll/imap
participant Redis as Redis Lock
participant Service as ImapPollingService
participant IMAP as IMAP Server
participant DB as Database
participant Webhook as /api/webhooks/trigger
Cron->>API: GET (every 1 minute)
API->>API: Verify cron auth
API->>Redis: Acquire lock (180s TTL)
alt Lock acquired
API->>Service: pollImapWebhooks()
Service->>DB: Fetch active webhooks
loop For each webhook (concurrency: 5)
Service->>IMAP: Connect & authenticate
loop For each mailbox
Service->>IMAP: Search emails (criteria + UID filter)
IMAP-->>Service: UIDs matching criteria
Service->>IMAP: Fetch email data (envelope, body, attachments)
IMAP-->>Service: Email content
loop For each email
Service->>Service: Check idempotency
Service->>Webhook: POST email payload
Webhook-->>Service: Response
alt markAsRead enabled
Service->>IMAP: Add \Seen flag
end
end
end
Service->>IMAP: Logout
Service->>DB: Update lastProcessedUidByMailbox
Service->>DB: Update webhook success/failure count
end
Service-->>API: Poll results
API->>Redis: Release lock
API-->>Cron: Success response
else Lock not acquired
API-->>Cron: 202 Skipped (polling in progress)
end
|
Collaborator
Author
|
@greptile |
Collaborator
Author
|
@greptile |
This was referenced Jan 2, 2026
waleedlatif1
added a commit
that referenced
this pull request
Jan 3, 2026
…ext menu (#2672) * feat(logs-context-menu): consolidated logs utils and types, added logs record context menu (#2659) * feat(email): welcome email; improvement(emails): ui/ux (#2658) * feat(email): welcome email; improvement(emails): ui/ux * improvement(emails): links, accounts, preview * refactor(emails): file structure and wrapper components * added envvar for personal emails sent, added isHosted gate * fixed failing tests, added env mock * fix: removed comment --------- Co-authored-by: waleed <walif6@gmail.com> * fix(logging): hitl + trigger dev crash protection (#2664) * hitl gaps * deal with trigger worker crashes * cleanup import strcuture * feat(imap): added support for imap trigger (#2663) * feat(tools): added support for imap trigger * feat(imap): added parity, tested * ack PR comments * final cleanup * feat(i18n): update translations (#2665) Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com> * fix(grain): updated grain trigger to auto-establish trigger (#2666) Co-authored-by: aadamgough <adam@sim.ai> * feat(admin): routes to manage deployments (#2667) * feat(admin): routes to manage deployments * fix naming fo deployed by * feat(time-picker): added timepicker emcn component, added to playground, added searchable prop for dropdown, added more timezones for schedule, updated license and notice date (#2668) * feat(time-picker): added timepicker emcn component, added to playground, added searchable prop for dropdown, added more timezones for schedule, updated license and notice date * removed unused params, cleaned up redundant utils * improvement(invite): aligned styling (#2669) * improvement(invite): aligned with rest of app * fix(invite): error handling * fix: addressed comments --------- Co-authored-by: Emir Karabeg <78010029+emir-karabeg@users.noreply.github.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com> Co-authored-by: Adam Gough <77861281+aadamgough@users.noreply.github.com> Co-authored-by: aadamgough <adam@sim.ai>
waleedlatif1
added a commit
that referenced
this pull request
Jan 8, 2026
* feat(tools): added support for imap trigger * feat(imap): added parity, tested * ack PR comments * final cleanup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fixes #2660
Type of Change
Testing
Tested manually
Checklist