Check Email
Purpose
Scan the monitored inbox for incoming messages that have not yet been recorded in the processed-message log.
Instructions
- •Call
poll_inboxto retrieve messages received since the last poll timestamp - •For each message, check whether its ID exists in the processed-message log
- •If the ID is already recorded, skip the message entirely — take no action
- •For each new message, create a Task entry with status Pending and log the receipt
- •Determine whether the message is a client email or a feedback item:
- •If the subject matches the configured feedback label pattern → route to
categorize-feedback - •Otherwise → route to
respond-to-client
- •If the subject matches the configured feedback label pattern → route to
- •Return the list of new Task IDs for downstream processing
Error Handling
- •If the inbox is unreachable: log a warning with full error context and skip this cycle
- •If credentials are expired: emit a Critical alert immediately via AlertService
- •If the API rate-limits the request: wait 30 seconds and retry once; if still rate-limited, skip this cycle and log a warning
Expected Output
A list of Task IDs (may be empty if no new messages arrived).