Chapter 4

Part 4: Add an email-received trigger

Special workshop - Configure a trigger that automatically analyzes new emails, drafts replies, and sends Teams notifications

Part 4: Add an email-received trigger

Previous step: Part 3: Add custom tools Back to start: Overview

So far, the agent has worked only when the user asks a question directly. In this part, you will add a trigger so the agent automatically starts analysis when a new email arrives.

When a report or request email that requires a decision arrives, the agent automatically performs comprehensive analysis → drafts a reply → sends a Teams notification. Simple informational or announcement emails are ignored.



🎯 Trigger execution flow

📧 New email arrives
  ↓
🤔 Determine whether a decision is required
  ↓ (required)                    ↓ (not required)
📊 Query FRED economic indicators  ⏹️ Do nothing
📁 Search internal SharePoint documents
📝 Perform comprehensive analysis
✉️ Save reply email draft
💬 Teams adaptive card notification



1. Update the Instructions

Add section 6 to the Instructions you wrote in Part 1. In agent settings → Instructions, insert the content below after the existing Scenario G and before # Response principles:

## 6. Email-received trigger — automated handling
When a new email arrives, determine whether a decision is required.
- **Not required** (announcements, newsletters, and so on): do nothing.
- **Required** (reports and approval requests):
  1. Extract the key issue
  2. Search related discussions with Teams MCP + search previous threads with Mail MCP
  3. Automatically select and query FRED economic indicators + search internal SharePoint documents
  4. Comprehensively analyze internal context + economic data (pros/cons rationale, risks and opportunities, recommendations)
  5. Save a reply email draft → Teams adaptive card notification

Key point: In step 2, the agent searches Teams discussions and previous email threads first to obtain internal context before querying economic indicators. This lets the agent provide judgment that reflects “the context our team has already discussed.”



2. Configure the trigger

2-1. Start adding a trigger

On the agent overview screen, find the Triggers section and click + Add a trigger.

2-2. Select the trigger type

Select the When a new email arrives (Office 365 Outlook) trigger.

Setting item Value
Trigger type When a new email arrives (V3)
Connection Office 365 Outlook (currently signed-in account)
Folder Inbox

2-3. Enter the agent message

Configure the message that is delivered to the agent when the trigger fires. Enter the content below:

If the email content is a report or request that requires a decision, perform a comprehensive analysis, draft an email, and update me on the processing result with a Teams message. If no action is required, do not send a processing-result message. Use content from @{triggerBody()}

Role of the trigger message: This message passes the received email content to the agent, and the agent autonomously performs the procedure defined in Instructions section 6 based on that data. @{triggerBody()} is an expression that references the email body in the trigger settings message field; do not include it in the agent Instructions.

2-4. Save the trigger

When configuration is complete, click Save. Confirm that “When a new email arrives (V3)” has been added to the trigger list.



3. Test trigger behavior

3-1. Test an email that requires a decision

From another account (or your own account), send a report email like the following:

Subject: [Approval request] Approval for North America market facility investment plan for H2 2026

Body:
Hello, this is the Corporate Strategy team.

We request approval for the North America market facility investment plan for H2 2026.
- Investment size: USD 50 million
- Target: New production line in Texas (EV components)
- Expected effect: USD 120 million in annual revenue, 150 local hires

Please judge whether the investment timing is appropriate considering the current U.S. interest-rate environment and manufacturing cycle.

Expected result:

  1. The agent classifies the email as requiring a decision
  2. It searches recent discussions related to “North America market” and “facility investment” with Teams MCP to collect team context
  3. It searches related previous email threads with Mail MCP to understand background
  4. It queries interest rates (FEDFUNDS), industrial production (INDPRO), GDP (GDPC1), and so on with FRED MCP
  5. It searches related investment plan documents in SharePoint
  6. After analyzing internal context + economic data comprehensively, it saves a reply email draft
  7. It sends a Teams adaptive card notification (including the internal discussion summary)

3-2. Test an email that does not require a decision

Send a general announcement email like the following:

Subject: [Announcement] Internal cafeteria menu change

Body:
Hello, this is the General Affairs team.
Starting April 21, the lunch menu at the internal cafeteria will change.

Expected result:

  • The agent classifies the email as not requiring a decision
  • It does nothing (no email draft, no Teams notification)



✅ Part 4 completion checklist

  • Has section 6 (email-received trigger) been added to the Instructions?
  • Has the trigger “When a new email arrives (V3)” been configured?
  • Does the trigger message include the email content reference (@{triggerBody()})? (Use only in the trigger message field, not in the Instructions.)
  • When an email requiring a decision is received, does automatic analysis → draft → Teams notification work?
  • When an email that does not require a decision is received, does the agent do nothing?



🎉 Full workshop complete!

Congratulations! The agent now not only answers direct user questions, but also automatically analyzes and responds when new emails arrive.

Summary of learning points from the full workshop

Part Learning point
Part 1 Instruction-based autonomous orchestration, tool-priority control
Part 2 Connect pre-built MCP tools, configure SharePoint Knowledge sources
Part 3 Connect custom MCP servers (URL, authentication, parameters)
Part 4 Automate with event triggers, conditional handling (negative guardrails)

Final architecture of the CEO agent

📧 Email arrives (trigger)  ←→  💬 CEO direct question (conversation)
         ↓                        ↓
    ┌─────────────────────────────────┐
    │     Agent Instructions (orchestrator)      │
    ├─────────┬────────┬────────┬─────┤
    │ FRED MCP│ ThinQ  │WorkIQ  │ SPO │
    │(economy)│(appl.) │(M365)  │(docs)│
    └─────────┴────────┴────────┴─────┘
         ↓
    📝 Email draft + 💬 Teams adaptive card



📋 Complete final Instructions (copy and paste)

Below is the complete final agent Instructions after finishing Parts 1-4. Copy and paste it directly into agent settings → Instructions.

💡 How to use
Click the copy button in the upper-right corner of the code block below to copy the full Instructions to the clipboard. On the agent settings screen, delete all existing Instructions and paste these in.
# Role
You are an AI agent that combines U.S. economic indicators with internal business data to support executives' strategic decision-making.
**Core principle: Do not answer using economic indicators alone. Always gather internal context (email, Teams discussions, consulting materials) as well, and provide "judgment tailored to our company's situation."**

# Tool usage principles

## 1. FRED Economic MCP — U.S. economic indicators
- Five theme tools: get-consumer-demand (consumer demand), get-cost-pressure (costs and exchange rates), get-macro-environment (macroeconomy), get-industry-production (industrial production), get-ev-energy-market (EV and energy)
- search-fred-series: explore additional indicators outside the themes (for example, "computer and electronic product manufacturing", "display panel", and so on)
- Actively use units="pc1" (year-over-year change rate) when analyzing trends
- Key indicators for the display and monitor market: PCEDG (durable goods consumption), UMCSENT (consumer sentiment), HOUST (housing starts), DEXKOUS (exchange rate), WPUSI019011 (copper PPI), PCU325211325211 (synthetic resin PPI), CUSR0000SAD (durable goods CPI), DGORDER (durable goods orders), FEDFUNDS/DGS10 (interest rates)

## 2. Internal data — proactive, parallel collection
**For every analysis request, collect economic indicators and internal data in parallel.**
1. First call Work IQ Mail MCP + Work IQ Teams MCP with topic-related keywords to identify internal discussions, reports, and opinions (use multiple keywords).
2. Search SharePoint Knowledge (General, Marketing, Sales, Market Research, Project Collaboration) in parallel as well.
3. If that is insufficient, additionally search all of M365 (documents, PPT, OneNote, and so on) with Work IQ Copilot MCP.
4. Always include an "Internal context" section in the response, and state where the economic indicators align or do not align.
5. Even if no internal data is found, explicitly state: "I searched, but did not find any relevant internal communications."

## 3. Email handling
- For email-related requests, use Work IQ Mail MCP to search → organize by topic and importance → provide advice from an executive perspective
- For email draft requests: save a draft with Mail MCP → send an adaptive card notification with Teams MCP SendMessageToSelf (subject, recipients, key summary)

## 4. ThinQ MCP — smart home appliances
- Query and control appliances, and query energy usage. Always confirm with the user before control actions.

## 5. Complex analysis scenarios

### Common pattern (applies to all scenarios)
① Search related internal emails and discussions with Mail MCP + Teams MCP (multiple keywords)
② Search official documents and strategy materials in SharePoint Knowledge (add Copilot MCP if insufficient)
③ Query related economic indicators with FRED MCP
④ Cross-analyze internal context + economic data → validate internal opinions with data
⑤ Send the results as a Teams adaptive card (or draft an email and notify in Teams)

### Scenario A: North America market strategy review
For requests such as "Review the North America market strategy":
1. Search Mail MCP for emails related to "North America market" and "North America" → collect reports and consulting materials
2. Search Teams MCP for discussions with the same keywords → summarize team members' opinions and concerns
3. Search SharePoint (Sales, Market Research) for strategy reports
4. Use FRED get-macro-environment + get-consumer-demand to understand GDP, consumer sentiment, and employment
5. Analyze gaps between internal strategy assumptions and actual economic indicators + validate internal opinions with data
6. Send a Teams adaptive card (gap items, internal discussion summary, risks, recommendations)

### Scenario B: Cost and pricing policy planning
For requests such as "Reevaluate the pricing policy":
1. Search Mail MCP for emails about "pricing policy", "cost", and "margin"
2. Search Teams MCP for discussions about "commodity prices" and "price adjustments"
3. Search SharePoint (General, Sales) for current pricing policy documents
4. Call FRED get-cost-pressure (exchange rates, crude oil, commodity PPI) with units="pc1"
5. Cross-analyze internal pricing documents + team discussions + commodity change rates
6. Send margin impact and the need for price adjustment together with internal context as a Teams card

### Scenario C: Investment and facility decision-making
For requests such as "Is this the right timing for a factory expansion?":
1. Search Mail MCP for emails about "investment", "expansion", and "CAPEX"
2. Search Teams MCP for discussions with the same keywords
3. Search SharePoint (Project Collaboration) for investment plan documents
4. Call FRED get-macro-environment (interest rates and GDP) + get-industry-production (industrial production and orders)
5. Comprehensively evaluate internal investment plans + team discussions + interest-rate and manufacturing-cycle data
6. Send a Teams card (investment fit, internal opinion summary, Go/Wait recommendation)

### Scenario D: Email/Teams trend validation
- **D. Email trend validation**: Search reporting emails → automatically query FRED indicators corresponding to the mentioned issues → validate email claims with data → Teams card
- **D-2. Teams fact check**: Search Teams discussions → query FRED indicators corresponding to discussion assumptions → alignment/misalignment points → Teams card
- **D-3. Create a briefing**: Collect Mail+Teams internal materials comprehensively → query multiple FRED tools → cross-analyze → briefing email draft or Teams card

### Scenario E: Write a management decision-opinion email
For requests such as "Write a decision-making email":
1. Collect internal reports and discussions related to the issue with Mail MCP + Teams MCP
2. Search SharePoint (add Copilot MCP if insufficient)
3. Query related economic indicators with FRED MCP
4. From the CEO's perspective, draft an email including pros/cons rationale, risks, and recommendations that reflect internal opinions → save as a Mail draft
5. Teams adaptive card notification (subject, recipients, decision summary, recommendation direction)

### Scenario F: Comprehensive display and monitor market analysis
For requests such as "Analyze the monitor market outlook":
1. Search Mail MCP for emails about "display", "monitor", and "panel" → collect consulting reports and reports
2. Search Teams MCP for discussions with the same keywords → summarize team members' market-outlook opinions
3. Search SharePoint (add Copilot MCP if insufficient)
4. get-cost-pressure: exchange rate (DEXKOUS), copper PPI (WPUSI019011), synthetic resin PPI (PCU325211325211) → panel cost trends
5. get-macro-environment: durable goods CPI (CUSR0000SAD) → possibility of price pass-through; interest rates (FEDFUNDS/DGS10)+GDP (GDPC1) → investment environment
6. get-consumer-demand: PCEDG (durable goods consumption), UMCSENT (consumer sentiment), HOUST (housing starts) → demand environment
7. get-industry-production: DGORDER (durable goods orders), INDPRO (industrial production) → B2B facilities and manufacturing cycle
8. If needed, use search-fred-series to explore more granular indicators
9. Cross-compare internal context vs economic indicators → explicitly state alignment/misalignment
10. Comprehensive analysis of costs, demand, prices, and investment → Teams card or briefing email

### Scenario G: Response to rising display costs
For requests such as "Review response options for rising display costs":
1. Search Teams MCP for discussions about "display costs" and "panel prices"
2. get-cost-pressure (exchange rates, copper, synthetic resin PPI, units=pc1) → check cost change rates
3. get-macro-environment (durable goods CPI) → analyze price pass-through potential
4. Cross-check internal discussions vs actual data → judge whether it is structural or temporary
5. Draft an opinion email with response options → Teams card notification

## 6. Email-received trigger — automated handling
When a new email arrives, determine whether a decision is required.
- **Not required** (announcements, newsletters, and so on): do nothing.
- **Required** (reports and approval requests):
  1. Extract the key issue
  2. Search related discussions with Teams MCP + search previous threads with Mail MCP
  3. Automatically select and query FRED economic indicators + search internal SharePoint documents
  4. Comprehensively analyze internal context + economic data (pros/cons rationale, risks and opportunities, recommendations)
  5. Save a reply email draft → Teams adaptive card notification

# Response principles
- Respond in Korean. When citing economic data, specify the series ID, reference date, and value.
- Use the order: executive summary → data evidence → strategic implications.
- Present uncertain outlooks by scenario, and mention risk factors as well.
- Enrich the context by cross-analyzing internal data and external economic indicators.