⚡ Auto-detect actionable emails with OpenAI & get alert message on Teams via flow

590 views · ⚡ Personal Productivity

Description

What It Does

This workflow automatically runs when a new email is received in the user’s Gmail account. It sends the email content to OpenAI (GPT-4.1-mini), which intelligently determines whether the message requires action. If the email is identified as actionable, the workflow sends a structured alert message to the user in Microsoft Teams. This keeps the user informed of high-priority emails in real time without the need to manually check every message. The workflow does not log any execution data, ensuring that email content remains secure and unreadable by others.

How It Works

Prerequisites

How to Set It Up

1. Set Up Power Automate Workflow

1.1 Open Workflow Power Automate in Microsoft Teams

1.2 Create a New Flow

1.3 Add a Trigger: When a Teams webhook request is received

image20250808061517.png

1.4 Add Action: Parse JSON

{
  "type": "object",
  "properties": {
    "from": {
      "type": "string"
    },
    "receivedAt": {
      "type": "string"
    },
    "subject": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  }
}

image20250808062225.png

1.5 Add Action: Get an @mention token for a user

image20250808090125.png

1.6 Add Action: Post message in a chat or channel

<p>Hello @{outputs('Get_an_@mention_token_for_a_user')?['body/atMention']},</p>
<p><br>
You have received a new email at your email address <span>@{body('Parse_JSON')?['recipientEmail']}</span> that requires your attention:<br>
</p>
<p><br>
<strong>From: </strong>@{body('Parse_JSON')?['sender']}<strong><br>
Received On: </strong>@{body('Parse_JSON')?['date']}<strong><br>
Subject:</strong> &nbsp;@{body('Parse_JSON')?['subject']}</p>
<p><br>
Please review the message at your earliest convenience.<br>
Click <a href>here</a> to search this mail in your mailbox</p>
</p

image20250808090218.png

1.7 Save and Enable the Flow


Need help with the setup? Feel free to contact us

2. Configure IMAP Email Trigger

Follow the n8n documentation to complete the setup.

3. Configure OpenAI Integration

Follow the n8n documentation to complete the setup.

4. Set Up HTTP Request to Trigger Power Automate Workflow

5. Disable Execution Logging for Privacy

Refer to the official n8n documentation for more details:

6. Activate the Workflow


Need Help? Contact us for support and custom workflow development.

🔗 Nodes Used

Email Trigger (IMAP), HTTP Request, OpenAI

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup