فرز رسائل الدعم بالذكاء الاصطناعي

الذكاء الاصطناعي يصنّف كل رسالة دعم (فوترة، خطأ، سؤال) ويوجهها للمكان الصحيح.

متوسط توفّر ~10 ساعة شهريًا خدمة العملاءبواسطة فريق Flowngn

تعمل مع n8n · Make · Zapier

كيف تعمل

المشغّل: Gmail — بريد جديد إلى support@
  1. استقبل رسالة الدعم الجديدة.
  2. اطلب من الذكاء الاصطناعي تصنيفها: فوترة، خطأ، استفسار، أو أخرى، مع درجة الاستعجال.
  3. أضف تصنيف Gmail المناسب.
  4. أرسل الرسائل العاجلة أو الأخطاء إلى قناة Slack المناسبة.

المخطط

trueGNew support emailGmail TriggerClassify emailBasic LLM ChainClaude modelAnthropic Chat Mo…{ }Read categoryCodeGAdd Gmail labelGmail⑂Urgent or bug?IfSAlert #supportSlack
مشغّل تطبيق منطق كود ذكاء اصطناعي

الكود

كود JavaScript المستخدم في خطوات Code، وهو مضمَّن بالفعل في القالب بالأسفل.

Read category · عقدة Code
// Mode: Run Once for Each Item
// Create these labels in Gmail, then paste their IDs here (Gmail node → Label → Get Many).
const LABEL_IDS = {
  billing: "Label_BILLING_ID",
  bug: "Label_BUG_ID",
  howto: "Label_HOWTO_ID",
  other: "Label_OTHER_ID",
};

const email = $("New support email").item.json;
const match = $json.text.match(/\{[\s\S]*\}/);
const ai = match ? JSON.parse(match[0]) : { category: "other", urgent: false };
const category = LABEL_IDS[ai.category] ? ai.category : "other";

return {
  json: {
    id: email.id,
    subject: email.subject,
    from: email.from?.value?.[0]?.address,
    category,
    urgent: ai.urgent === true,
    labelId: LABEL_IDS[category],
  },
};

ابنِها بأداتك

اختر أداتك — نفس الأتمتة، خطوة بخطوة.

انسخه والصقه مباشرة في مساحة عمل n8n (Ctrl+V)، أو حمّله واستخدم Import from File. بعد ذلك اربط حساباتك واستبدل كل قيمة تبدأ بـ YOUR_. خطوات الذكاء الاصطناعي تستخدم نموذج Claude، ويمكنك استبداله بـ OpenAI أو Gemini أو Ollama.

ملف Workflow JSON
عرض الكود (228 سطر)
{
  "name": "فرز رسائل الدعم بالذكاء الاصطناعي (Flowngn)",
  "nodes": [
    {
      "parameters": {
        "content": "## فرز رسائل الدعم بالذكاء الاصطناعي\nالذكاء الاصطناعي يصنّف كل رسالة دعم (فوترة، خطأ، سؤال) ويوجهها للمكان الصحيح.\n\n**Setup**\n1. Open each node and connect your own credentials.\n2. Replace every YOUR_… placeholder.\n3. Test once, then activate.\n\nFree template from Flowngn",
        "height": 260,
        "width": 340
      },
      "id": "292cf932-28a7-4103-a30e-aaa1f075d4b9",
      "name": "Setup notes",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -420,
        -60
      ]
    },
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "simple": false,
        "filters": {
          "q": "to:support@yourcompany.com"
        },
        "options": {}
      },
      "id": "292cf932-28a7-4103-a30e-aaa1f075d4b9",
      "name": "New support email",
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Classify this support email.\n\nSubject: {{ $json.subject }}\n\n{{ $json.text }}\n\nReply ONLY with JSON: {\"category\": \"billing\" | \"bug\" | \"howto\" | \"other\", \"urgent\": true | false}"
      },
      "id": "292cf932-28a7-4103-a30e-aaa1f075d4b9",
      "name": "Classify email",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.5,
      "position": [
        300,
        0
      ]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "claude-sonnet-5",
          "mode": "list"
        },
        "options": {}
      },
      "id": "292cf932-28a7-4103-a30e-aaa1f075d4b9",
      "name": "Claude model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.3,
      "position": [
        300,
        220
      ]
    },
    {
      "parameters": {
        "jsCode": "// Mode: Run Once for Each Item\n// Create these labels in Gmail, then paste their IDs here (Gmail node → Label → Get Many).\nconst LABEL_IDS = {\n  billing: \"Label_BILLING_ID\",\n  bug: \"Label_BUG_ID\",\n  howto: \"Label_HOWTO_ID\",\n  other: \"Label_OTHER_ID\",\n};\n\nconst email = $(\"New support email\").item.json;\nconst match = $json.text.match(/\\{[\\s\\S]*\\}/);\nconst ai = match ? JSON.parse(match[0]) : { category: \"other\", urgent: false };\nconst category = LABEL_IDS[ai.category] ? ai.category : \"other\";\n\nreturn {\n  json: {\n    id: email.id,\n    subject: email.subject,\n    from: email.from?.value?.[0]?.address,\n    category,\n    urgent: ai.urgent === true,\n    labelId: LABEL_IDS[category],\n  },\n};",
        "mode": "runOnceForEachItem"
      },
      "id": "292cf932-28a7-4103-a30e-aaa1f075d4b9",
      "name": "Read category",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        600,
        0
      ]
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $json.id }}",
        "labelIds": "={{ [$json.labelId] }}"
      },
      "id": "292cf932-28a7-4103-a30e-aaa1f075d4b9",
      "name": "Add Gmail label",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        900,
        0
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "c1",
              "leftValue": "={{ $json.urgent || $json.category === 'bug' }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "292cf932-28a7-4103-a30e-aaa1f075d4b9",
      "name": "Urgent or bug?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        900,
        220
      ]
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "#support",
          "mode": "name"
        },
        "text": "=🚨 {{ $json.category.toUpperCase() }}{{ $json.urgent ? ' (urgent)' : '' }}: {{ $json.subject }}\nFrom: {{ $json.from }}",
        "otherOptions": {}
      },
      "id": "292cf932-28a7-4103-a30e-aaa1f075d4b9",
      "name": "Alert #support",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        1200,
        0
      ]
    }
  ],
  "connections": {
    "New support email": {
      "main": [
        [
          {
            "node": "Classify email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify email": {
      "main": [
        [
          {
            "node": "Read category",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read category": {
      "main": [
        [
          {
            "node": "Add Gmail label",
            "type": "main",
            "index": 0
          },
          {
            "node": "Urgent or bug?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Urgent or bug?": {
      "main": [
        [
          {
            "node": "Alert #support",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude model": {
      "ai_languageModel": [
        [
          {
            "node": "Classify email",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}

← افتحها في ساحة التجربة لتعديلها

نصائح

  • ابدأ بالتصنيفات فقط، ودع البشر يراجعون قبل أي ردود تلقائية.

أتمتات مشابهة