N
n8n Store
Workflow Market
Classify_Emails_by_Action_Required_Using_GPT-4o

Classify_Emails_by_Action_Required_Using_GPT-4o

by khaled0 views

Description

Categories

🤖 AI & Machine Learning

Nodes Used

n8n-nodes-base.gmailn8n-nodes-base.gmailn8n-nodes-base.gmailn8n-nodes-base.gmailn8n-nodes-base.gmailn8n-nodes-base.stickyNoten8n-nodes-base.scheduleTrigger@n8n/n8n-nodes-langchain.lmChatOpenAi@n8n/n8n-nodes-langchain.textClassifier
PriceGratis
Views0
Last Updated11/28/2025
workflow.json
{
  "id": "72Ut8p2aSfFgiTEM",
  "meta": {
    "instanceId": "10ac0d272b984a3e01d44645b4be41105d42352c9db9f4c0c7f5be7946b87d41",
    "templateCredsSetupCompleted": true
  },
  "name": "Classify_Emails_by_Action_Required_Using_GPT-4o",
  "tags": [],
  "nodes": [
    {
      "id": "bbccdd88-4e46-408a-b41f-38671ff56cea",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1409b97b-fadd-43e7-a21a-20d1b3a26357",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        440,
        240
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "YyRWzbmQKB1cindn",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f0398f84-c60b-4107-a9f6-20520abe65ab",
      "name": "Get Emails",
      "type": "n8n-nodes-base.gmail",
      "position": [
        220,
        0
      ],
      "webhookId": "28ad1c28-a292-4ff8-98fc-43ea812a4115",
      "parameters": {
        "filters": {
          "readStatus": "unread"
        },
        "operation": "getAll"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "C1RVeb9JgdvkMkP4",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "112e2574-192f-4717-8a73-157d1e24d8c9",
      "name": "Add \"Action Required\" Label",
      "type": "n8n-nodes-base.gmail",
      "position": [
        900,
        -160
      ],
      "webhookId": "a9425959-45c7-4bc4-a1eb-c1ad7a2aa653",
      "parameters": {
        "labelIds": [
          "Label_5412178974275757474"
        ],
        "messageId": "={{ $json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "C1RVeb9JgdvkMkP4",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "bf8e00cf-b09e-4181-960b-b92a47b323aa",
      "name": "Email Classifier",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        440,
        0
      ],
      "parameters": {
        "options": {},
        "inputText": "={{ $json.snippet }}",
        "categories": {
          "categories": [
            {
              "category": "Action",
              "description": "=The email requires the recipient to take a specific action. This could include replying, reviewing something, clicking a link, attending a meeting, completing a task, or making a decision. The sender expects a response or follow-up."
            },
            {
              "category": "No Action",
              "description": "The email is informational only and does not require any action from the recipient. Examples include newsletters, promotional emails, confirmations, or general updates where no response is needed."
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8350d1b8-21f0-455e-9bfa-a4c7222f5242",
      "name": "Remove \"Inbox\" Label",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1140,
        -160
      ],
      "webhookId": "6e201b20-daf6-454d-94bd-a714cf78bc6c",
      "parameters": {
        "labelIds": [
          "INBOX"
        ],
        "messageId": "={{ $json.id }}",
        "operation": "removeLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "C1RVeb9JgdvkMkP4",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "704ed172-abf6-4203-b39e-d0f38ed4b41b",
      "name": "Add \"No Action\" Label",
      "type": "n8n-nodes-base.gmail",
      "position": [
        900,
        140
      ],
      "webhookId": "1eb02524-6020-4a8f-bfee-4d1434db8669",
      "parameters": {
        "labelIds": [
          "Label_1906200659860958692"
        ],
        "messageId": "={{ $json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "C1RVeb9JgdvkMkP4",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "d89eb342-9eae-4da9-a52a-211042fd59b0",
      "name": "Remove \"Inbox\"  Label",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1140,
        140
      ],
      "webhookId": "1cefd10d-a5ae-45f3-ab46-ff8d475bd48b",
      "parameters": {
        "labelIds": [
          "INBOX"
        ],
        "messageId": "={{ $json.id }}",
        "operation": "removeLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "C1RVeb9JgdvkMkP4",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "0681e342-f582-4d3a-826f-42848432e1b7",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -520,
        -300
      ],
      "parameters": {
        "color": 4,
        "width": 460,
        "height": 400,
        "content": "🧱 NODE-BY-NODE BREAKDOWN\n⏰ 1. Schedule Trigger\n\nRuns the workflow on a set interval.\n📥 2. Get Emails\n\nFetches unread emails from your Gmail inbox.\n🧠 3. Email Classifier\n\nClassifies each email as Action or No Action using GPT-4o.\n🏷️ 4. Add \"Action Required\" Label\n\nAdds the Action Required label to emails that need your attention.\n🧹 5. Remove \"Inbox\" Label (Action)\n\nRemoves the INBOX label from emails marked as Action.\n🏷️ 6. Add \"No Action\" Label\n\nAdds the No Action label to emails that require no response.\n🧹 7. Remove \"Inbox\" Label (No Action)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6ffdc307-d627-47d3-bd8b-d9ecc1a531df",
  "connections": {
    "Get Emails": {
      "main": [
        [
          {
            "node": "Email Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Classifier": {
      "main": [
        [
          {
            "node": "Add \"Action Required\" Label",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Add \"No Action\" Label",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Email Classifier",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Add \"No Action\" Label": {
      "main": [
        [
          {
            "node": "Remove \"Inbox\"  Label",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add \"Action Required\" Label": {
      "main": [
        [
          {
            "node": "Remove \"Inbox\" Label",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

相关工作流