AWS Builder Center
InboxTriage

InboxTriage

That initial pass is automated by InboxTriage. This little serverless application connects to your mailbox, reads all of your unread messages, and then uses an AI model to classify them into four buckets: Urgent, Action Needed, FYI, or Ignore. Each bucket includes a one-line explanation and a recommended course of action.

Vision & What the App Does
Opening the inbox, scrolling through a mountain of unread messages, and carefully selecting which ones are truly important is how every morning begins. Even though the majority of that mail isn't urgent it's a newsletter, an automated alert, or a just circling back figuring that out still requires ten or fifteen minutes of concentration before the workday even starts.
That initial pass is automated by InboxTriage. This little serverless program connects to your inbox, analyzes all of your unread messages, and then uses an AI model to classify them into four categories: Urgent, Action Needed, FYI, or Ignore. It also provides a one line explanation and a recommended course of action.
All of it is combined into a single digest email, so you can check one table and know exactly where to focus your attention rather than opening twenty letters. The tedious process it resolves isn't reading emails; rather, it's the tedious triage decision that must be made twenty times before you reach something that truly requires your input.
How I Built It
I began by jotting down my personal definition of good triage: A message is classified as action needed if it requires a response but is not urgent; it is classified as urgent if it is time-sensitive and requires a response from a real person the same day, everything else is either noise or informational. The majority of the work involved turning that logic into a clear prompt. In the first few passes, the model marked newsletters as Action Needed because they included a click here link. I tightened the prompt with specific examples of each category and instructed it to disregard call-to-action language in marketing mail. In keeping with the challenge, I purposefully kept it minimal architecturally: a single Lambda function that does three tasks when activated on a timetable retrieve, categorize, and alert.
Making the Bedrock call dependable enough to function without supervision was the most difficult aspect. Models sometimes include a throwaway sentence before the JSON object or wrap JSON with markdown fences, which ruined my first parser. In order to prevent a single faulty response from crashing the entire run, I implemented a small amount of defensive parsing (stripping fences, falling back to a safe default category if parsing fails). In the worst scenario, one email is marked "FYI, needs manual review" rather than losing the digest completely. IMAP works with any mail service that supports IMAP, not just one vendor, which felt more helpful for other builders wanting to remix this, which is another reason I selected it over a provider-specific API (like the Gmail API).
AWS Services Used
The Lambda function is triggered on a repeating schedule using Amazon EventBridge Scheduler, which may be set to run on a daily or hourly basis. The app's key component is AWS Lambda. transmits the digest, writes history, coordinates classification, and establishes an IMAP connection. Every email is categorized into a priority category by Amazon Bedrock (Nova Lite), along with a one-line explanation and recommended course of action.
Amazon DynamoDB records every triage choice as a history log, so past decisions are searchable later. The final HTML digest email is sent by Amazon SES. IMAP credentials are stored by AWS Secrets Manager, ensuring that no sensitive information is stored in unencrypted environment variables or code. Since everything is defined as a single AWS SAM template, the function, the DynamoDB table, the IAM role, and the EventBridge rule are all provided in one go by using the  sam deploy  command.
What I Learned
More important than prompt length is prompt specificity. When I included specific instances of each category rather than simply generic descriptions, the classifier became considerably more accurate. Unattended AI calls require defensive parsing. The backup path (default category + reason) proved to be just as crucial as the happy path because a scheduled Lambda lacks a person in the loop to detect a faulty response.
For brief categorization tasks, Nova Lite works well. It's quick and so cheap that operating it several dozen times per hour costs fractions of a cent, which is significant for a background utility that operates all day. IMAP remains the most portable method of accessing "any inbox." Using a For Gmail, a provider-specific API would have been a little easier. particularly, but IMAP allows anyone who forks this to point it at Fastmail, Outlook, or a self-hosted mail server without altering the logic for triage at all.
Link to App / Repo
The Source Code with instructions are available at:  https://github.com/adi271001/Inbox-Triage-App.git 
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article