وكيل ذكي لإدارة المبيعات على تيليجرام

فريق مبيعاتك يضيف العملاء ويسجّل المكالمات ويسأل "مين أكلّم النهارده؟" بكلام عادي على تيليجرام.

وكيل ذكيمتقدم توفّر ~12 ساعة شهريًا وكلاء الذكاء الاصطناعيبواسطة فريق Flowngn

تعمل مع n8n · Make · Zapier

كيف تعمل

المشغّل: تيليجرام — موظف مبيعات يراسل البوت
  1. يكتب موظف المبيعات "كلمت منى من نايل فودز، عايزة عرض سعر قبل الخميس".
  2. يجد الوكيل العميل ويحدّث المرحلة والخطوة التالية وآخر تواصل.
  3. يجيب عن أسئلة خط المبيعات ومن يجب متابعته.
  4. يكتب مسودات رسائل المتابعة في Gmail.

ماذا يستطيع أن يفعل

على عكس الأتمتة الثابتة، يقرر الوكيل أي أدواته يستخدم وبأي ترتيب — ويتذكر المحادثة.

  • يضيف العملاء ويحدّثهم من رسائل عادية
  • يعرض متابعات اليوم
  • يلخّص خط المبيعات حسب المرحلة
  • يكتب مسودات رسائل المتابعة

التعليمات (System prompt)

التعليمات التي تشكّل سلوك الوكيل. موجودة بالفعل داخل قالب n8n — انسخها إلى Make أو Zapier، وعدّل أجزاء YOUR_….

التعليمات (System prompt)
You are the sales assistant for YOUR_COMPANY on Telegram, talking to our own sales team. Reply in their language, short and clear. Today is {{ $now.toFormat('cccc d LLLL yyyy') }}.

Tools:
- "Read leads": the Leads sheet (phone, name, company, email, stage, value, owner, next_step, last_contact). Read it before answering anything.
- "Add lead": adds a new lead. Ask for at least name and phone, plus anything they mention (company, need, value).
- "Update lead": updates one lead by its phone number: stage, next step, value or last contact. Stages: new, contacted, meeting, proposal, won, lost.
- "Draft email": creates a Gmail draft to a lead (never sends).

You can:
- Answer "who should I call today?": open leads with the oldest last_contact or a next_step due today.
- Log calls and meetings in plain words ("called Mona from Nile Foods, wants a proposal by Thursday") as a lead update.
- Summarise the pipeline by stage with totals.
- Draft follow-up emails.

Rules:
- Confirm before changing a stage to won or lost.
- If more than one lead matches, list them and ask which one. Never guess.
- Never invent leads, numbers or promises.

قواعد الأمان

مدمجة في التعليمات والأدوات:

  • يرد فقط على محادثة فريق المبيعات على تيليجرام
  • يسأل قبل تسجيل صفقة كرابحة أو خاسرة
  • يكتب مسودات ولا يرسل أبدًا

يستخدم مفتاح الذكاء الاصطناعي الخاص بك (Claude أو OpenAI أو غيرهما). التكلفة تعتمد على النموذج وطول المحادثة — والنموذج الصغير السريع يجعل معظم المحادثات بجزء من السنت.

المخطط

trueTIncoming messageTelegram Trigger{ }Get messageCode⑂From our sales chat?IfSales agentAI AgentClaude modelAnthropic Chat Mo…◷MemorySimple MemoryGRead leadsGoogle Sheets ToolGAdd leadGoogle Sheets ToolGUpdate leadGoogle Sheets ToolGDraft emailGmail ToolTReply on TelegramTelegram
مشغّل تطبيق منطق كود ذكاء اصطناعي أداة للوكيل

الكود

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

Get message · عقدة Code
// Keeps only text messages and pulls out who sent it and what they asked.
const msg = $input.first().json.message;
if (!msg?.text) return [];

return [{
  json: {
    chatId: msg.chat.id,
    userId: msg.from.id,
    name: [msg.from.first_name, msg.from.last_name].filter(Boolean).join(" "),
    question: msg.text,
  },
}];

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

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

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

ملف Workflow JSON
عرض الكود (394 سطر)
{
  "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": "4582ffa0-b14a-4886-a363-b883185e0565",
      "name": "Setup notes",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -420,
        -60
      ]
    },
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "id": "4582ffa0-b14a-4886-a363-b883185e0565",
      "name": "Incoming message",
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.1,
      "position": [
        0,
        0
      ],
      "webhookId": "4582ffa0-b14a-4886-a363-b883185e0565"
    },
    {
      "parameters": {
        "jsCode": "// Keeps only text messages and pulls out who sent it and what they asked.\nconst msg = $input.first().json.message;\nif (!msg?.text) return [];\n\nreturn [{\n  json: {\n    chatId: msg.chat.id,\n    userId: msg.from.id,\n    name: [msg.from.first_name, msg.from.last_name].filter(Boolean).join(\" \"),\n    question: msg.text,\n  },\n}];"
      },
      "id": "4582ffa0-b14a-4886-a363-b883185e0565",
      "name": "Get message",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        300,
        0
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "c1",
              "leftValue": "={{ String($json.chatId) }}",
              "rightValue": "YOUR_SALES_CHAT_ID",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "4582ffa0-b14a-4886-a363-b883185e0565",
      "name": "From our sales chat?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        600,
        0
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $('Get message').item.json.question }}",
        "options": {
          "systemMessage": "=You are the sales assistant for YOUR_COMPANY on Telegram, talking to our own sales team. Reply in their language, short and clear. Today is {{ $now.toFormat('cccc d LLLL yyyy') }}.\n\nTools:\n- \"Read leads\": the Leads sheet (phone, name, company, email, stage, value, owner, next_step, last_contact). Read it before answering anything.\n- \"Add lead\": adds a new lead. Ask for at least name and phone, plus anything they mention (company, need, value).\n- \"Update lead\": updates one lead by its phone number: stage, next step, value or last contact. Stages: new, contacted, meeting, proposal, won, lost.\n- \"Draft email\": creates a Gmail draft to a lead (never sends).\n\nYou can:\n- Answer \"who should I call today?\": open leads with the oldest last_contact or a next_step due today.\n- Log calls and meetings in plain words (\"called Mona from Nile Foods, wants a proposal by Thursday\") as a lead update.\n- Summarise the pipeline by stage with totals.\n- Draft follow-up emails.\n\nRules:\n- Confirm before changing a stage to won or lost.\n- If more than one lead matches, list them and ask which one. Never guess.\n- Never invent leads, numbers or promises."
        }
      },
      "id": "4582ffa0-b14a-4886-a363-b883185e0565",
      "name": "Sales agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.9,
      "position": [
        900,
        0
      ]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "claude-sonnet-5",
          "mode": "list"
        },
        "options": {}
      },
      "id": "4582ffa0-b14a-4886-a363-b883185e0565",
      "name": "Claude model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.3,
      "position": [
        475,
        220
      ]
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Get message').item.json.chatId }}",
        "contextWindowLength": 10
      },
      "id": "4582ffa0-b14a-4886-a363-b883185e0565",
      "name": "Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        645,
        220
      ]
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Returns the Leads sheet.",
        "operation": "read",
        "documentId": {
          "__rl": true,
          "value": "YOUR_SPREADSHEET_ID",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "Leads",
          "mode": "name"
        },
        "options": {}
      },
      "id": "4582ffa0-b14a-4886-a363-b883185e0565",
      "name": "Read leads",
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.5,
      "position": [
        815,
        220
      ]
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Adds a new lead.",
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "YOUR_SPREADSHEET_ID",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "Leads",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "phone": "={{ $fromAI('phone', \"Phone number with country code\", 'string') }}",
            "name": "={{ $fromAI('name', \"Contact name\", 'string') }}",
            "company": "={{ $fromAI('company', \"Company, or empty\", 'string') }}",
            "email": "={{ $fromAI('email', \"Email, or empty\", 'string') }}",
            "stage": "new",
            "value": "={{ $fromAI('value', \"Estimated deal value, or empty\", 'string') }}",
            "owner": "={{ $('Get message').item.json.name }}",
            "next_step": "={{ $fromAI('next_step', \"Next step, or empty\", 'string') }}",
            "last_contact": "={{ $now.toISODate() }}"
          }
        },
        "options": {}
      },
      "id": "4582ffa0-b14a-4886-a363-b883185e0565",
      "name": "Add lead",
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.5,
      "position": [
        985,
        220
      ]
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Updates one lead, matched by phone number.",
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "YOUR_SPREADSHEET_ID",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "Leads",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "phone": "={{ $fromAI('phone', \"The lead's phone number exactly as in the sheet\", 'string') }}",
            "stage": "={{ $fromAI('stage', \"new, contacted, meeting, proposal, won or lost\", 'string') }}",
            "next_step": "={{ $fromAI('next_step', \"The next step and its date\", 'string') }}",
            "last_contact": "={{ $fromAI('last_contact', \"Date of the last contact, YYYY-MM-DD\", 'string') }}"
          },
          "matchingColumns": [
            "phone"
          ]
        },
        "options": {}
      },
      "id": "4582ffa0-b14a-4886-a363-b883185e0565",
      "name": "Update lead",
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.5,
      "position": [
        1155,
        220
      ]
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Creates a Gmail draft to a lead (never sends).",
        "resource": "draft",
        "operation": "create",
        "subject": "={{ $fromAI('subject', \"Email subject\", 'string') }}",
        "message": "={{ $fromAI('body', \"Email body\", 'string') }}",
        "options": {
          "sendTo": "={{ $fromAI('to', \"The recipient's email address\", 'string') }}"
        }
      },
      "id": "4582ffa0-b14a-4886-a363-b883185e0565",
      "name": "Draft email",
      "type": "n8n-nodes-base.gmailTool",
      "typeVersion": 2.1,
      "position": [
        1325,
        220
      ]
    },
    {
      "parameters": {
        "chatId": "={{ $('Get message').item.json.chatId }}",
        "text": "={{ $json.output }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "id": "4582ffa0-b14a-4886-a363-b883185e0565",
      "name": "Reply on Telegram",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1200,
        0
      ]
    }
  ],
  "connections": {
    "Incoming message": {
      "main": [
        [
          {
            "node": "Get message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get message": {
      "main": [
        [
          {
            "node": "From our sales chat?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "From our sales chat?": {
      "main": [
        [
          {
            "node": "Sales agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sales agent": {
      "main": [
        [
          {
            "node": "Reply on Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude model": {
      "ai_languageModel": [
        [
          {
            "node": "Sales agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Memory": {
      "ai_memory": [
        [
          {
            "node": "Sales agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Read leads": {
      "ai_tool": [
        [
          {
            "node": "Sales agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Add lead": {
      "ai_tool": [
        [
          {
            "node": "Sales agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Update lead": {
      "ai_tool": [
        [
          {
            "node": "Sales agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Draft email": {
      "ai_tool": [
        [
          {
            "node": "Sales agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}

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

نصائح

  • استخدم رقم الهاتف كمفتاح للعميل، واحفظه بصيغة واحدة.

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