إيصال واتساب لمدفوعات Paymob

عند نجاح دفعة عبر Paymob، يصل العميل إيصال على واتساب فورًا.

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

تعمل مع n8n · Make · Zapier

كيف تعمل

المشغّل: Webhook — إشعار معالجة المعاملة من Paymob
  1. استقبل إشعار المعاملة من Paymob.
  2. استخرج المبلغ ورقم الطلب واسم العميل ورقم هاتفه.
  3. تابع فقط إذا نجحت الدفعة.
  4. أرسل قالب واتساب معتمدًا بالعربية كإيصال.

المخطط

truePaymob callbackWebhook{ }Read paymentCode⑂Paid?IfWSend WhatsApp recei…WhatsApp Business Cloud
مشغّل تطبيق منطق كود

الكود

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

Read payment · عقدة Code
// Mode: Run Once for Each Item
// Paymob "transaction processed" callback → clean, easy-to-use fields.
const obj = $json.body?.obj || {};
const billing = obj.order?.shipping_data || obj.payment_key_claims?.billing_data || {};

return {
  json: {
    success: obj.success === true,
    transaction_id: obj.id,
    order_id: obj.order?.merchant_order_id || obj.order?.id,
    amount: (obj.amount_cents || 0) / 100,
    currency: obj.currency,
    method: obj.source_data?.sub_type || obj.source_data?.type || "",
    customer_name: [billing.first_name, billing.last_name].filter(Boolean).join(" "),
    phone: String(billing.phone_number || "").replace(/[^0-9]/g, ""),
    email: billing.email || "",
    error: obj.data?.message || "",
    date: obj.created_at,
  },
};

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

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

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

ملف Workflow JSON
عرض الكود (165 سطر)
{
  "name": "إيصال واتساب لمدفوعات Paymob (Flowngn)",
  "nodes": [
    {
      "parameters": {
        "content": "## إيصال واتساب لمدفوعات Paymob\nعند نجاح دفعة عبر Paymob، يصل العميل إيصال على واتساب فورًا.\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": "43ef56f7-3e64-497c-a29d-9f8e76873bd0",
      "name": "Setup notes",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -420,
        -60
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "paymob-callback",
        "options": {}
      },
      "id": "43ef56f7-3e64-497c-a29d-9f8e76873bd0",
      "name": "Paymob callback",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "webhookId": "43ef56f7-3e64-497c-a29d-9f8e76873bd0"
    },
    {
      "parameters": {
        "jsCode": "// Mode: Run Once for Each Item\n// Paymob \"transaction processed\" callback → clean, easy-to-use fields.\nconst obj = $json.body?.obj || {};\nconst billing = obj.order?.shipping_data || obj.payment_key_claims?.billing_data || {};\n\nreturn {\n  json: {\n    success: obj.success === true,\n    transaction_id: obj.id,\n    order_id: obj.order?.merchant_order_id || obj.order?.id,\n    amount: (obj.amount_cents || 0) / 100,\n    currency: obj.currency,\n    method: obj.source_data?.sub_type || obj.source_data?.type || \"\",\n    customer_name: [billing.first_name, billing.last_name].filter(Boolean).join(\" \"),\n    phone: String(billing.phone_number || \"\").replace(/[^0-9]/g, \"\"),\n    email: billing.email || \"\",\n    error: obj.data?.message || \"\",\n    date: obj.created_at,\n  },\n};",
        "mode": "runOnceForEachItem"
      },
      "id": "43ef56f7-3e64-497c-a29d-9f8e76873bd0",
      "name": "Read payment",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        300,
        0
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "c1",
              "leftValue": "={{ $json.success && $json.phone !== '' }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "43ef56f7-3e64-497c-a29d-9f8e76873bd0",
      "name": "Paid?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        600,
        0
      ]
    },
    {
      "parameters": {
        "operation": "sendTemplate",
        "phoneNumberId": "YOUR_PHONE_NUMBER_ID",
        "recipientPhoneNumber": "={{ $json.phone }}",
        "template": "YOUR_RECEIPT_TEMPLATE|ar",
        "components": {
          "component": [
            {
              "type": "body",
              "bodyParameters": {
                "parameter": [
                  {
                    "type": "text",
                    "text": "={{ $json.customer_name || 'عميلنا العزيز' }}"
                  },
                  {
                    "type": "text",
                    "text": "={{ $json.amount }} {{ $json.currency }}"
                  },
                  {
                    "type": "text",
                    "text": "={{ $json.order_id }}"
                  }
                ]
              }
            }
          ]
        }
      },
      "id": "43ef56f7-3e64-497c-a29d-9f8e76873bd0",
      "name": "Send WhatsApp receipt",
      "type": "n8n-nodes-base.whatsApp",
      "typeVersion": 1,
      "position": [
        900,
        0
      ]
    }
  ],
  "connections": {
    "Paymob callback": {
      "main": [
        [
          {
            "node": "Read payment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read payment": {
      "main": [
        [
          {
            "node": "Paid?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Paid?": {
      "main": [
        [
          {
            "node": "Send WhatsApp receipt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}

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

نصائح

  • ضع رابط الـ webhook الإنتاجي في خانة Transaction processed callback داخل تكامل Paymob.
  • تحقق من توقيع HMAC قبل الوثوق بأي إشعار — راجع أتمتة التحقق من Paymob.

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