PJL Sales Ops

Mailbox to Deal Notes with Claude

Claude reads a shared sales mailbox and writes the deal notes nobody had time to write.

2026
~11,000emails processed
4cheap gates before any LLM call
6independently runnable stages
The sales-ops stack: mailbox triage feeds deal notes into the same Pipedrive record the proposal engine reads
The sales-ops stack: mailbox triage feeds deal notes into the same Pipedrive record the proposal engine reads

Years of client correspondence sat in a shared Outlook mailbox and never made it onto the deal. Site details, budget discussions, schedule changes and decisions were locked in threads, so the CRM record was thin and anyone picking up a deal had to dig through mail. This pipeline backfills and maintains deal history automatically and enriches person records from email signatures.

Cost discipline is the architecture

Four progressively more expensive gates stand between eleven thousand emails and a model call. A structural regex pass drops out-of-office replies, non-delivery reports, read receipts and system senders. Threading groups what remains. A participant index built once from Pipedrive maps every email address to a person and their deals, so matching is a lookup rather than a search. Finally a keyword gate looks for dollar signs, quotes, budgets, deadlines, dates and contract language, and skips the model entirely if a thread has no business signal.

Only then does Claude Haiku see the thread, with quoted history stripped and the system prompt cached. It returns strict JSON: a relevance boolean, a two-to-four sentence summary, and extracted dates, locations, budgets, themes and participants.

Conservative writes

The pipeline never creates deals. It posts notes to matched deals and fills only empty fields on person records from parsed signatures, so it can never overwrite something a human entered. A dry-run flag prints the rendered note instead of posting. A token bucket keeps Pipedrive writes under its rate limit.

Operational details

Graph authentication uses the device-code flow with delegated shared-mailbox read permission and a cached token, so no tenant-wide consent is needed. Fetch is resumable per message. Message IDs are hashed when the header is missing so dedupe survives malformed mail. The prompt version and model name are stored alongside each cached summary, and re-summarising is opt-in.