{
  "name": "Auto-detect actionable emails with OpenAI & get alert message on Teams via flow",
  "nodes": [
    {
      "id": "bb003676-b07c-4658-a5e4-4efcda44a567",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        140,
        -100
      ]
    },
    {
      "id": "cebd6f73-b100-40f2-9f4c-ed30c1bd4708",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -300
      ],
      "parameters": {
        "width": 260,
        "height": 400,
        "content": "## Trigger on Email Received\n\nAutomatically runs the workflow when a new email is received from the configured Gmail account.\n"
      }
    },
    {
      "id": "7a3ad55d-ae03-43f6-b49c-fdec7fa10a5e",
      "name": "Email Trigger (IMAP)",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        -80,
        -100
      ]
    },
    {
      "id": "93987fdc-2914-4a37-b6a3-aedf86b09d8d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        120,
        -300
      ],
      "parameters": {
        "width": 500,
        "height": 400,
        "content": "## Analyze Email Content and Extract Fields\n\n- Evaluate whether the email content qualifies as actionable based on predefined criteria using OpenAI.\n\n- Retrieves essential details such as subject, sen"
      }
    },
    {
      "id": "49ac28cf-0c2f-4638-a40e-e3a6de0febb4",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        -300
      ],
      "parameters": {
        "width": null,
        "height": 400,
        "content": "## Check Is Email Actionable?\n\nProceeds only if the email is classified as “Actionable” by OpenAI."
      }
    },
    {
      "id": "be84addc-9633-40b4-8c7e-a52a0413095a",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        900,
        -300
      ],
      "parameters": {
        "width": 460,
        "height": 400,
        "content": "## Send Alert to MS Teams\n\n- Builds a direct Gmail search URL using the encoded subject to help locate the email easily\n\n- Posts the email details to Microsoft Teams by triggering a Power Automate flo"
      }
    },
    {
      "id": "5de0a008-cbe1-4a9e-a3c3-a6ca429f7f6d",
      "name": "Extract mail details",
      "type": "n8n-nodes-base.set",
      "position": [
        460,
        -100
      ]
    },
    {
      "id": "13a7a0cc-3b3f-4806-b22a-5708d9452609",
      "name": "Build gmail search URL",
      "type": "n8n-nodes-base.code",
      "position": [
        960,
        -100
      ]
    },
    {
      "id": "935332f0-544d-4dd0-a01e-29a0500a0327",
      "name": "Is mail actionable",
      "type": "n8n-nodes-base.if",
      "position": [
        700,
        -100
      ]
    },
    {
      "id": "d6d170ed-5ca4-480d-9e42-d0723d831e6e",
      "name": "Send alert to MS team",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1200,
        -100
      ]
    },
    {
      "id": "ed5cfd2a-5eda-47bf-9eb3-c9852d64e1df",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        180
      ],
      "parameters": {
        "width": 840,
        "height": 480,
        "content": "## Power Automate flow to send a message in Teams.\n\n ### **1. Trigger: When a Webhook is Received**\n   - The flow is initiated when an external system (e.g., n8n) sends an HTTP request to a           "
      }
    }
  ],
  "connections": {
    "OpenAI": {
      "main": [
        [
          {
            "node": "Extract mail details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is mail actionable": {
      "main": [
        [
          {
            "node": "Build gmail search URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Trigger (IMAP)": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract mail details": {
      "main": [
        [
          {
            "node": "Is mail actionable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build gmail search URL": {
      "main": [
        [
          {
            "node": "Send alert to MS team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}