تحديثات حالة طلبات سلة على واتساب

عندما تتغير حالة طلب في سلة، يصل العميل تحديث على واتساب بالعربية مع رابط التتبع.

متوسط توفّر ~8 ساعة شهريًا تطبيقات المنطقةبواسطة فريق Flowngn

تعمل مع n8n · Make · Zapier

كيف تعمل

المشغّل: Webhook — تحديث حالة طلب في سلة
  1. استقبل تحديث الحالة من سلة.
  2. حوّل الحالة إلى جملة عربية قصيرة.
  3. أرسل للعميل قالب واتساب برقم الطلب والحالة ورابط التتبع.

المخطط

trueSalla status updateWebhook{ }Read statusCode⑂Status to share?IfWSend status updateWhatsApp Business Cloud
مشغّل تطبيق منطق كود

الكود

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

Read status · عقدة Code
// Mode: Run Once for Each Item
// Salla order.status.updated webhook → customer phone + an Arabic status line.
// Status slugs differ between stores; run a test and adjust the list below.
const body = $json.body || {};
const o = body.data?.order || body.data || {};
const c = o.customer || {};
const slug = String(body.data?.status?.slug || o.status?.slug || "").toLowerCase();

const STATUS = {
  in_progress: "جاري تجهيز طلبك",
  completed: "تم تجهيز طلبك",
  delivering: "طلبك في الطريق إليك",
  delivered: "تم توصيل طلبك",
  canceled: "تم إلغاء طلبك",
};

return {
  json: {
    order_id: o.reference_id || o.id,
    name: c.first_name || "",
    phone: `${c.mobile_code || ""}${c.mobile || ""}`.replace(/[^0-9]/g, ""),
    status: STATUS[slug] || "",
    tracking: o.shipping?.tracking_link || o.shipments?.[0]?.tracking_link || "-",
  },
};

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

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

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

ملف Workflow JSON
عرض الكود (169 سطر)
{
  "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-4d3f-a4ae-9194a533337e",
      "name": "Setup notes",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -420,
        -60
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "salla-status",
        "options": {}
      },
      "id": "4582ffa0-b14a-4d3f-a4ae-9194a533337e",
      "name": "Salla status update",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "webhookId": "4582ffa0-b14a-4d3f-a4ae-9194a533337e"
    },
    {
      "parameters": {
        "jsCode": "// Mode: Run Once for Each Item\n// Salla order.status.updated webhook → customer phone + an Arabic status line.\n// Status slugs differ between stores; run a test and adjust the list below.\nconst body = $json.body || {};\nconst o = body.data?.order || body.data || {};\nconst c = o.customer || {};\nconst slug = String(body.data?.status?.slug || o.status?.slug || \"\").toLowerCase();\n\nconst STATUS = {\n  in_progress: \"جاري تجهيز طلبك\",\n  completed: \"تم تجهيز طلبك\",\n  delivering: \"طلبك في الطريق إليك\",\n  delivered: \"تم توصيل طلبك\",\n  canceled: \"تم إلغاء طلبك\",\n};\n\nreturn {\n  json: {\n    order_id: o.reference_id || o.id,\n    name: c.first_name || \"\",\n    phone: `${c.mobile_code || \"\"}${c.mobile || \"\"}`.replace(/[^0-9]/g, \"\"),\n    status: STATUS[slug] || \"\",\n    tracking: o.shipping?.tracking_link || o.shipments?.[0]?.tracking_link || \"-\",\n  },\n};",
        "mode": "runOnceForEachItem"
      },
      "id": "4582ffa0-b14a-4d3f-a4ae-9194a533337e",
      "name": "Read status",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        300,
        0
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "c1",
              "leftValue": "={{ $json.status !== '' && $json.phone.length >= 10 }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "4582ffa0-b14a-4d3f-a4ae-9194a533337e",
      "name": "Status to share?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        600,
        0
      ]
    },
    {
      "parameters": {
        "operation": "sendTemplate",
        "phoneNumberId": "YOUR_PHONE_NUMBER_ID",
        "recipientPhoneNumber": "={{ $json.phone }}",
        "template": "YOUR_ORDER_STATUS_TEMPLATE|ar",
        "components": {
          "component": [
            {
              "type": "body",
              "bodyParameters": {
                "parameter": [
                  {
                    "type": "text",
                    "text": "={{ $json.name || 'عميلنا العزيز' }}"
                  },
                  {
                    "type": "text",
                    "text": "={{ $json.order_id }}"
                  },
                  {
                    "type": "text",
                    "text": "={{ $json.status }}"
                  },
                  {
                    "type": "text",
                    "text": "={{ $json.tracking }}"
                  }
                ]
              }
            }
          ]
        }
      },
      "id": "4582ffa0-b14a-4d3f-a4ae-9194a533337e",
      "name": "Send status update",
      "type": "n8n-nodes-base.whatsApp",
      "typeVersion": 1,
      "position": [
        900,
        0
      ]
    }
  ],
  "connections": {
    "Salla status update": {
      "main": [
        [
          {
            "node": "Read status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read status": {
      "main": [
        [
          {
            "node": "Status to share?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Status to share?": {
      "main": [
        [
          {
            "node": "Send status update",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}

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

نصائح

  • مرّر طلب اختبار على كل حالة وتحقق من الأكواد التي يرسلها متجرك.

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