# Track Which Clients Still Owe Documents From the Firm's Outlook Inbox

An accounting firm's agent reads the documents clients emailed to its Outlook inbox, checks them against each client's list, and drafts reminders for staff to send.

[Run this on Rush](https://cloud.getrush.ai/run/track-missing-client-documents/outlook/). Opens the console with this prompt ready to send. Connect Outlook there first.

## What the agent does

This is for a small accounting or bookkeeping firm that asks each client for the same kinds of paperwork every year: bank statements, payroll summaries, loan statements, receipts for large purchases. Clients send them by email in ones and twos over weeks, as PDFs and phone photos, to the firm's intake address, and a staff member keeps a spreadsheet of who has sent what. The agent keeps that spreadsheet. The person who owns the intake mailbox connects Outlook once with `POST /me/connections {"type": "app", "name": "outlook"}` and approves on Microsoft's sign-in page; the run names that connection and reaches the mailbox through Microsoft Graph.

The firm's handler builds the prompt from its practice-management tool: each client's name, the email addresses they write from, and the documents still outstanding. The agent calls `GET /me/mailFolders/inbox/messages` with a `$filter` on `receivedDateTime` since the last check and `hasAttachments eq true`, selecting `from`, `subject`, `receivedDateTime` and `hasAttachments`, and follows `@odata.nextLink` to the end. It matches each message to a client by the sender's address, and lists mail from unknown senders separately rather than guessing.

For each matched message it calls `GET /me/messages/{id}/attachments` and reads each file attachment's `name`, `contentType` and `size`, then the file itself. It identifies what the document is from its contents, not its filename ("scan_0034.pdf" is often a bank statement), reading the issuer, the account's last four digits and the period it covers. A photo too blurry to read, a password-protected PDF, or a statement for the wrong period is flagged as received but unusable, with the reason.

Then it updates the picture per client: received, still missing, and unusable. For each client still missing something it drafts a short, polite reminder naming exactly what is outstanding and what arrived in a form the firm cannot use. It does not send any of them. The drafts go in the report for a staff member to review and send from Outlook, because what a client is told about their own paperwork is the firm's call.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Check the Outlook inbox for client documents received since 2026-11-06T00:00:00Z. Call GET /me/mailFolders/inbox/messages with $filter receivedDateTime ge that time and hasAttachments eq true, selecting from, subject, receivedDateTime, hasAttachments; follow @odata.nextLink. Clients and outstanding documents: (1) Rivera Plumbing LLC, senders ana@riveraplumbing.example and books@riveraplumbing.example: October bank statement for the checking account ending 4410, Q3 payroll summary, truck loan statement. (2) Dana Whitfield, sender dana.w@mail.example: brokerage year-end statement, mortgage interest statement. For each message from a listed sender, read its attachments with GET /me/messages/{id}/attachments and identify each document from its contents: type, issuer, account last four digits, period. Mark each outstanding item received, missing, or unusable (unreadable, password protected, wrong period, wrong account) with the message date. List messages from senders not on the list separately. For each client with anything missing or unusable, draft a reminder of at most 120 words. Write documents.md and documents.csv. Send, move, flag, delete and reply to nothing.",
  "connections": [
    "outlook"
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

`documents.md` comes back as an artifact on the session, with one section per client: what arrived since the last check with the date and the message it came in, what is still missing, what arrived but cannot be used and why, and the drafted reminder. A short list at the end covers attachments from senders not on the list, which is often a client writing from a new address. `documents.csv` has one row per client and document with its status, ready to paste into the firm's tracking sheet or import into its practice-management tool.

A staff member reads each draft before sending it, checks any document the agent called unusable, and confirms the matches for unknown senders. The agent describes what each document is; it does not judge what a client needs to file or claim, which stays with the firm's accountants. The transcript keeps every Graph call and the attachments the agent opened, which answers "did we ever receive it?" months later.

## Run it on every weekday morning

The firm's handler, which already knows each client's outstanding list, sends `POST /o/{org}/sessions` each weekday morning with that list and the time of the last check in `input`, and a `request_id` that is a UUID v5 of the date, so a retried job starts no second run. With a webhook URL on the API key, the `run.completed` webhook tells the handler the report is ready, and it can read `documents.csv` from the session's artifacts and update its records.

To limit the agent to reading, save it as an agent whose connections name `{"name": "outlook", "access": "read"}`: each run then asks Microsoft for `Mail.Read` and `Contacts.Read` alone when it refreshes the token. That limits what Rush asks for, not what the grant holds: Microsoft issues a token with every Outlook permission the person has granted Rush, so the instruction not to send stays in the prompt as well.

## Why run it on Rush?

The tedious part of document collection is opening attachments: a client sends "here you go" with three photos, and someone has to look at each to tick the right box. An agent can open every attachment, read what it is, and keep the list current, which a mail rule cannot. Running it on Rush keeps the mailbox sign-in in Rush's connection instead of a password in a script on someone's desktop.

Each run has its own computer, so client documents are opened in a machine of their own rather than on a shared office PC, and each run keeps a record of every step and its cost. A session that used the Outlook connection is readable by the person who started it and the org's owners and admins only, which suits a mailbox full of clients' financial statements.

## Frequently asked questions

### Does it work with a shared mailbox?

The connection signs in as one Microsoft account and the prompt reads that account's own inbox through `/me`. If the firm's intake address is a shared mailbox, the simplest setup is to forward or copy its mail to the connected account's inbox, or to connect the account that owns the intake address directly.

### Can it read phone photos of paper documents?

It reads image attachments as well as PDFs, and marks one unusable when it cannot make out the issuer, the account or the period. A staff member checks those, since a photo that is hard for the agent to read is often hard for the accountant too.

### Will it send the reminders?

No. The prompt forbids sending, replying, moving and flagging, and the reminders come back as drafts in the report. A staff member sends them from Outlook after reading them.

### Does the agent give tax advice?

No. It identifies documents against the list the firm gives it and says what is missing. Which documents a client needs, and what they mean for a return, is the accountants' work.

## More Outlook jobs

- [Which Customer Quote Requests Have We Not Answered? A Wholesale Distributor's Morning Check of Each Sales Rep's Outlook](https://getrush.ai/run/find-quote-requests-with-no-reply/outlook/)
- [Match Signed Rate Confirmations in Each Freight Broker's Outlook to Their Loads](https://getrush.ai/run/log-carrier-rate-confirmations/outlook/)
- [Turn Tenant Emails in Each Property Manager's Outlook Into Maintenance Requests](https://getrush.ai/run/log-tenant-maintenance-requests/outlook/)

## More jobs like this: Produce a report or file, no repo

- [Which Clients' Month-End Close Is Behind? A Bookkeeping Firm's ClickUp Report](https://getrush.ai/run/track-month-end-close-by-client/clickup/)
- [Triage Customers' Jam Bug Recordings Into Reproducible Reports](https://getrush.ai/run/triage-customer-bug-recordings/jam/)
- [How Does a Property Manager Triage Each Morning's Maintenance Requests in Airtable?](https://getrush.ai/run/triage-maintenance-requests-each-morning/airtable/)

## Keep reading

- [Connect Outlook to Rush once, then name it on any run](https://getrush.ai/integrations/outlook/)
- [Start your first run from the developer API quickstart](https://getrush.ai/docs/quickstart/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
