Blog

How to Detect Deal Risk From Email Thread Patterns

Engagement drops, unanswered objections, competitor mentions and overdue commitments: a deal risk detector built on iGPT's API, returning structured JSON.

3 min read

A taut cord between two posts with one green knot

You can build a deal risk detector with iGPT’s API, a few lines of Python, and about ten minutes. It scans email threads for engagement drops, unanswered objections, competitor mentions, and overdue commitments, then returns structured JSON you can pipe into Slack, your CRM, or a dashboard.

Here’s how.

Step 1: Get your API key

Sign up at igpt.ai/hub/apikeys and grab your key. Store it as an environment variable:

export IGPT_API_KEY=your_key_here

Step 2: Install the SDK and connect an inbox

pip install igptai
import os
from igptai import IGPT

igpt = IGPT(api_key=os.getenv("IGPT_API_KEY"))

res = igpt.connectors.authorize(
    user="user_123",
    service="spike",
    scope="messages"
)

print("Open this URL to authorize:", res.get("url"))

The user opens the URL, authorizes their inbox, and iGPT starts indexing. Thread reconstruction, quoted text deduplication, participant attribution, and temporal ordering all happen automatically during indexing.

Step 3: Query for deal risk signals

igpt = IGPT(
    api_key=os.getenv("IGPT_API_KEY"),
    user="user_123"
)

response = igpt.recall.ask(
    input=(
        "What friction or risk signals exist in my "
        "active deals? Include engagement drops, "
        "unanswered objections, competitor mentions, "
        "and overdue commitments from our side."
    ),
    quality="cef-1-high",
    output_format="json"
)

That’s it. The output could look like this:

Three signals converging on one account plus an overdue deliverable from your own side. Any single signal is a task for your next touchpoint. All four together is the pattern that precedes deals going dark, and the overdue_from_us field is the one your rep most needs and least wants to discover during a live call.

Scaling to a workflow

The query above works for one user checking their own deals. To turn it into a production workflow:

Daily Slack digest. Run the query on a cron job, filter for high-risk deals, post a summary to your sales channel. Your Monday pipeline review starts with evidence instead of gut feel.

CRM enrichment. Push risk signals and overdue commitments into Salesforce or HubSpot on a daily sync. Your CRM starts reflecting what actually happened in the conversation rather than what your rep remembered to log.

Pre-call prep. Pull the risk report for a specific account before a scheduled call. You walk in knowing the objection that went unanswered, the commitment you owe, and the engagement shift that happened after your last proposal.

Quarterly forensics. Run the query against closed-lost deals from last quarter. See which patterns appeared before the deal died and how early they showed up. Every loss becomes a training case.

Other things you can detect with the same API

The same recall.ask() call with different prompts gives you:

Follow-up radar. “Which contacts are waiting on a response from me?” surfaces every thread where you owe a reply, ranked by how overdue it is.

Commitment tracker. “What have I promised to send or do this week across all active threads?” matches promises against follow-through and flags what’s late.

Competitive intelligence. “Which prospects have mentioned competitors, and in what context?” pulls mentions with surrounding conversation so you know whether it’s casual research or active evaluation.

Account health. “What’s the overall engagement trend across my top 10 accounts over the past 30 days?” gives a macro view of which relationships are warming and which are cooling.


Try it on your own inbox at igpt.ai/hub/playground. Connect through MCP at mcp.igpt.ai if you’re working inside Claude, Cursor, or another MCP-compatible tool.

Stacks of envelopes being organised into an index card cabinet with green tabs
Product

iGPT: your agent’s email context in one request

iGPT is a premium connector on Agent200. It indexes your users' email, threads and attachments, and answers your agent with cited, structured context in…

1 min read

Five frosted glass lenses of different shapes in a row, one with a green edge
Guides

Choosing a web search API for your agent

Tavily, Exa, Brave Search, Perplexity and Firecrawl each lean toward a different part of search. How to pick for your agent, and why you…

2 min read

200 OK

Build the agent.
Access everything it needs.

Bring the agent you already have. Agent200 provides and executes its external capabilities.

Book a demo.
See it in action.

Tell us who you are, then pick a time for a 1:1 session with an expert from our team.

We use your details only to email you about Agent200. See the Privacy Policy.

Pick a time. We'll take it from there.

A 1:1 session with an expert from our team, about what you are building.

Open in Calendly (opens in a new tab)