Skip to main content

InboxLens (Office 365 Inbox Summarizer)

📝 Introduction

InboxLens helps users quickly understand what matters in their Microsoft 365 Outlook inbox.

Instead of scrolling through individual emails, the agent:

  • Fetches and cleans the 50 most recent messages from Outlook
  • Groups them into threads, picks the latest in each
  • Applies role-aware scoring (To / Cc / Bcc / mentions)
  • Generates a color-coded HTML summary with suggested next actions

Goal: Reduce inbox noise and highlight the threads that genuinely need attention.

Target Audience:
Anyone who manages a busy inbox (account managers, leadership, service managers, finance/billing, etc.) and needs a quick view of what to handle first.


⚙️ Features

The InboxLens agent provides the following key functionalities:

🔹 Inbox Snapshot (50 Latest Emails)

  • Retrieves up to 50 emails from the user’s Office 365 mailbox
  • Sorted newest first
  • Normalizes fields such as sender, sender_company, subject, text content, flags, importance, and attachments

🔹 VIP & Excluded Senders

Configured in the O365 Clean Response v3 node:

  • VIP Email Addresses

    • Specific addresses (for example ceo@client.com, billing@vendor.com)
    • Messages from these senders receive higher attention scores
  • VIP Domains

    • Entire email domains (for example @keyclient.com)
    • Useful for all users at a key customer or vendor
  • Excluded Email Addresses

    • Messages from these senders are ignored and not shown in the summary

🔹 Role-Aware Attention Scoring

InboxLens uses the user identity from user_info:

{
"user_info": {
"ms_user_name": "<user email address>"
}
}
```text
`ms_user_name` is treated as the **canonical user email**.

For each message, InboxLens checks whether this email appears in the **To**, **Cc**, or **Bcc** fields, or is mentioned in the subject/body, and adjusts scoring accordingly:

- **In To** → treated as directly actionable
- **Only in Cc** → usually lower priority, unless the user is clearly involved
- **In Cc but mentioned / requested** → upgraded closer to To priority
- **In Bcc** → treated as monitoring; only escalated if explicit action is expected
- **Not in To/Cc/Bcc but mentioned** → still treated as involving the user (common for forwards, shared mailboxes, aliases, and distribution lists)

This prevents pure FYI Cc traffic from outranking emails where the user is responsible.

### 🔹 Configurable Scoring via `attention_config`

InboxLens uses an `attention_config` object for all scoring.
No numeric weights are hard-coded in the prompt.

Key fields include:

- `attention_sent_to_user` – score when the user is in **To**
- `attention_vip_known_sender` – score when the sender is VIP (email or domain)
- `attention_contains_question` – score when the message contains a question or explicit request
- `attention_mentions_date` – score when the message references a date or deadline
- `attention_has_attachments` – score if attachments are present
- `attention_high_importance` – score for Outlook “High importance”
- `attention_flagged` – score when the email is flagged
- `attention_already_read_penalty` – penalty applied if the message is already read
- `attention_no_reply_penalty` – penalty for no-reply / promotional / bulk messages
- `attention_critical_finance_service` – score when finance or service-risk terms appear (for example “past due”, “final notice”, “service interruption”)
- `attention_min` / `attention_max` – clamp bounds for final scores
- `attention_vip_threshold` – threads at or above this score are treated as top-priority
- `attention_stack_email_and_domain` – controls whether VIP **email + domain** scores can stack

### 🔹 Thread Grouping & Inclusion

InboxLens groups related emails into threads:

- Uses `internet_message_id` and `in_reply_to_header` when available
- Falls back to **normalized subject matching** (removing “Re:, “Fwd:, punctuation, and case differences)

For each thread, the agent:

- Selects the **latest message** for scoring and display
- Includes the thread if:
- Any message is **unread**, or
- The latest message is VIP, flagged, high importance, contains a question, or indicates **financial/service urgency**

Threads that are fully read, unflagged, low-priority FYI, and not risky are excluded.

### 🔹 Categorization

Each included thread is assigned to one category:

- **Needs Reply** – user is expected to respond
- **Waiting on Others** – someone else owes the next step
- **Calendar** – meeting invites, scheduling, reminders
- **Finance** – invoices, payment reminders, renewals, billing notices
- **Security** – alerts, login warnings, suspicious activity
- **Low Priority** – newsletters, generic updates, low-risk notifications

Categories drive both the label and background color used in the HTML summary.

### 🔹 HTML Summary Output

The LLM generates inline-styled HTML designed to work well in Outlook:

- **Header**
- “Inbox Summary” title
- Short paragraph explaining the focus on unread and important read threads

- **Summary Block**
- Total unread
- Number of included threads
- Highest attention score
- Average attention score
- Category counts on a second line

- **Thread Cards** (one per included thread)
- Category icon + subject as the card title
- `From: [Sender] from [Company] • Received: [Formatted Date]` on a single line
- One-sentence summary (max ~25 words)
- Category label + attention score
- Suggested action (for example “Reply to confirm”, “Review invoice”, “Acknowledge and file”)
- “Open in Outlook Web” link when `linkToMailWeb` is available

- **Footer**
- Small note such as “Prepared by InboxLens – automated summary of your Office 365 inbox”

Date formatting:

- **Today at HH:MM**
- **Yesterday at HH:MM**
- **MMM D at HH:MM** (for example `Dec 1 at 18:55`)

All times use 24-hour format unless the source implies AM/PM.

---

## 💡 Usage Examples

### Example 1: Daily Executive Inbox Snapshot

- Run InboxLens each morning against an executive’s mailbox
- Highlight:
- Important finance and contract threads
- Escalations from key clients or vendors
- Direct requests from internal leadership
- Deliver the HTML summary via email or Teams so they see a prioritised list instead of raw inbox.

### Example 2: Account Manager Client-Facing Triage

- Mark key **client domains** as VIP
- Use the summary to:
- Identify threads where the AM owes a reply
- Catch upcoming renewals or invoice questions
- Call out scheduling emails for QBRs and check-ins
- Use the “Suggested action” text as a lightweight task list for the day.

### Example 3: Finance & Billing Monitoring

- Configure VIPs for:
- Vendor billing systems
- Internal finance distribution lists
- AR/AP addresses
- Increase `attention_critical_finance_service` so:
- Overdue invoices
- Service-interruption warnings
- Failed payment notices
rise to the top of the summary.

---

## 🖥 Backend Architecture (High-Level)

At a high level, the InboxLens flow is:

1. **Office 365 Fetch Node**
- Calls Microsoft Graph / Outlook API
- Retrieves the most recent messages (up to 50, newest first)

2. **O365 Clean Response v3 Node**
- Normalizes message structure (fields like `from`, `to`, `cc`, `bcc`, `subject`, `latest_text`, `has_attachments`, `importance`, `flag`, `is_read`)
- Computes `sender_company` from the sender’s email domain
- Applies VIP and **excluded sender** logic
- Outputs a cleaned JSON payload (input `{{a}}` for the LLM node)

3. **Attention Config Node**
- Exposes configuration UI (for the `attention_config` values)
- Produces the `attention_config` object (input `{{b.attention_config}}` for the LLM node)

4. **InboxLens LLM Node**
- Uses the system prompt with:
- Cleaned messages from `{{a}}`
- Scoring settings from `{{b.attention_config}}`
- User identity from `user_info.ms_user_name`
- Groups, scores, categorises, sorts, and renders the final HTML

5. **Delivery Node (Optional)**
- Sends the HTML summary via email, Teams, or any supported channel

All numeric scoring behavior is controlled via `attention_config`, so tuning does not require prompt changes.

---

## 📌 Key Notes

- InboxLens only works with the set of messages it receives (default: **last 50**). It does not query older history unless the upstream fetch node is changed.
- VIP logic is applied during cleaning. When both a VIP **email** and **domain** match, the effect is controlled by `attention_stack_email_and_domain`.
- Role handling is based exclusively on `user_info.ms_user_name`, so this value must match the user’s primary email address.
- Cc-only FYI messages are **intentionally deprioritised** unless the content clearly involves the user or carries risk (especially finance/security).

---

## 🧯 Troubleshooting

**Issue:** Some emails you expect to see are missing.

**Check:**

- Are they older than the last 50 messages?
- Is the sender listed as an **excluded address**?
- Is the thread fully read, unflagged, and low-priority with no questions or risk?

---

**Issue:** Attention scores feel too high or too low.

**Actions:**

- Adjust key values in `attention_config`:
- Lower or raise `attention_contains_question`, `attention_high_importance`, `attention_vip_known_sender`, etc.
- Increase `attention_already_read_penalty` if read items still dominate the summary.
- Tune `attention_vip_threshold` to change what is treated as “top priority”.

---

**Issue:** Cc emails are ranking too high.

**Actions:**

- Confirm the role logic in the system prompt hasn’t been modified.
- Check that scores for VIP and questions are not overpowering the To vs Cc distinction.
- Review example messages to confirm they truly are “FYI” and not mentioning the user directly.

---

**Issue:** Finance or service-risk emails are not standing out.

**Actions:**

- Increase `attention_critical_finance_service`.
- Verify that the messages include trigger phrases (for example “past due”, “overdue”, “service interruption”, “final notice”).
- Consider marking key billing senders/domains as VIP.

---

## ❓ FAQs

**Q: Why does InboxLens only look at the latest 50 emails?**
A: This provides a good balance between relevance and performance. In practice, the most recent 50 messages are enough to capture current priorities without overloading the model.

---

**Q: How does VIP email vs VIP domain work?**

- VIP **email** → single address, such as `ceo@client.com`
- VIP **domain** → all addresses at `@client.com`

If both match, the stacking behavior depends on `attention_stack_email_and_domain`.

---

**Q: Are read emails completely ignored?**

No. Read emails are still included if they are important (VIP, flagged, high importance, questions, finance/service risk).
They simply receive a penalty via `attention_already_read_penalty` so that brand-new items usually rank higher.

---

**Q: How does InboxLens know who the user is?**

It uses `user_info.ms_user_name` as the definitive user email.
To/Cc/Bcc checks and direct-mention detection all depend on this value.

---

**Q: Can the HTML layout be customized?**

Yes, to a degree. Text, labels, and minor layout details are controlled by the system prompt.
Larger structural changes (new sections, different card layout) require updating the prompt and verifying that downstream consumers can handle the new format.