أمثلة عملية

3 سيناريوهات شائعة محلولة بشكل كامل.

١. تصنيف العميل تلقائياً عند الرسالة الأولى

كل عميل يكتب على واتساب → AI يحلّل النية → ينشئ مهمة في القسم المناسب (بيع / دعم فني / استفسار عام) → يرد على العميل بأن طلبه استُلم.

jsontrigger + 3 nodes
{
  "triggerType": "EVENT",
  "triggerConfig": { "eventName": "whatsapp.message.received" },
  "nodes": [
    {
      "id": "classify",
      "type": "call_agent",
      "config": {
        "agentId": "rashid",
        "prompt": "صنّف نية الرسالة: bid|support|inquiry. الرسالة: {{triggerData.content}}"
      },
      "next": ["check_bid"]
    },
    {
      "id": "check_bid",
      "type": "condition",
      "config": {
        "field": "classify.response",
        "operator": "contains",
        "value": "bid",
        "trueNodeId": "task_sales",
        "falseNodeId": "task_support"
      }
    },
    {
      "id": "task_sales",
      "type": "create_task",
      "config": {
        "projectId": "PROJECT_GENERAL",
        "title": "عميل محتمل: {{triggerData.phone}}",
        "priority": "HIGH",
        "assignedAgentId": "omar"
      }
    },
    {
      "id": "task_support",
      "type": "create_task",
      "config": {
        "projectId": "PROJECT_GENERAL",
        "title": "طلب دعم: {{triggerData.phone}}",
        "priority": "MEDIUM",
        "assignedAgentId": "rashid"
      }
    }
  ]
}

٢. تقرير أسبوعي ذاتي للعملاء VIP

كل اثنين 9 صباحاً، AI يولّد تقرير تقدّم لكل مشروع VIP ويرسله للعميل عبر WhatsApp.

{
  "triggerType": "CRON",
  "triggerConfig": { "cronExpression": "0 9 * * 1", "timezone": "Asia/Riyadh" },
  "nodes": [
    {
      "id": "summary",
      "type": "call_agent",
      "config": {
        "agentId": "rashid",
        "prompt": "اكتب تقرير أسبوعي مختصر لمشروع X (٥ نقاط فقط). نبرة احترافية ودافئة."
      },
      "next": ["send"]
    },
    {
      "id": "send",
      "type": "send_whatsapp",
      "config": {
        "phone": "966500000001",
        "text": "تقرير الأسبوع 📊\n\n{{summary.response}}"
      }
    }
  ]
}

٣. webhook من Stripe → فاتورة في CRM

عند payment_intent.succeeded من Stripe، النظام يستلم الـ webhook، يستخرج البيانات، ينشئ task “إصدار فاتورة” ويرسل تأكيد للعميل.

{
  "triggerType": "WEBHOOK",
  "triggerConfig": {},
  "nodes": [
    {
      "id": "log_payment",
      "type": "log",
      "config": {
        "level": "INFO",
        "message": "💰 دفع جديد: {{triggerData.body.amount}} {{triggerData.body.currency}}"
      },
      "next": ["task"]
    },
    {
      "id": "task",
      "type": "create_task",
      "config": {
        "projectId": "PROJECT_BILLING",
        "title": "إصدار فاتورة لـ {{triggerData.body.customer.email}}",
        "priority": "HIGH"
      },
      "next": ["confirm"]
    },
    {
      "id": "confirm",
      "type": "send_whatsapp",
      "config": {
        "phone": "{{triggerData.body.customer.phone}}",
        "text": "وصلنا دفعتك ✓ ستصلك الفاتورة خلال 24 ساعة."
      }
    }
  ]
}
نصيحة
كل المتغيرات في الأمثلة (PROJECT_* + أرقام الهاتف) عوّضها بمعرّفاتك الحقيقية.