{
  "id": "Hzb71DHsvmIwoERO",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "List whatsapp automation response",
  "tags": [],
  "nodes": [
    {
      "id": "b14f0efb-e53d-4ecf-9252-8b7ecd8943ce",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -2464,
        576
      ],
      "parameters": {
        "path": "whatsapp",
        "options": {},
        "responseMode": "responseNode",
        "multipleMethods": true
      },
      "typeVersion": 1
    },
    {
      "id": "b447fdc6-7885-4223-a889-deda6e7630d0",
      "name": "\u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a",
      "type": "n8n-nodes-base.code",
      "position": [
        -2000,
        576
      ],
      "parameters": {
        "jsCode": "// \ud83d\udce5 \u0645\u0639\u0627\u0644\u062c\u0629 \u0627\u0644\u0631\u0633\u0627\u0626\u0644 \u0627\u0644\u0648\u0627\u0631\u062f\u0629 \u0645\u0646 WhatsApp API\nconst g = $getWorkflowStaticData('global');\ng.contacts = g.contacts || {};\n\nconst body = $json.body || $json;\nconsole.log('\ud83d\udce8 Received webhook:', JSON.stringify(body, null, 2));\n\n// \u0627\u0644\u062a\u062d\u0642\u0642 \u0645\u0646 \u0627\u0644\u0628\u0646\u064a\u0629\nconst entry = body.entry?.[0];\nif (!entry) {\n  return [{ json: { ok: false, error: 'no_entry' } }];\n}\n\nconst changes = entry.changes?.[0];\nconst value = changes?.value;\nif (!value || !value.messages) {\n  return [{ json: { ok: false, error: 'no_messages' } }];\n}\n\nconst phoneNumberId = value.metadata?.phone_number_id;\nconst businessNumber = value.metadata?.display_phone_number || '';\nconst messages = value.messages;\nconst outputs = [];\n\nfor (const msg of messages) {\n  const from = msg.from;\n  const msgId = msg.id;\n  const timestamp = parseInt(msg.timestamp);\n  const msgType = msg.type;\n  \n  // \u0627\u0633\u0645 \u0627\u0644\u0645\u0631\u0633\u0644\n  const contactName = value.contacts?.[0]?.profile?.name || from || '\u0639\u0645\u064a\u0644';\n  const chatKey = `${phoneNumberId}:${from}`;\n  \n  // \u2705 \u062d\u0641\u0638 Contact \u0641\u0642\u0637 (\u0628\u062f\u0648\u0646 \u0631\u0633\u0627\u0626\u0644)\n  if (!g.contacts[chatKey]) {\n    g.contacts[chatKey] = {\n      platform: 'whatsapp',\n      account: phoneNumberId,\n      phone_number_id: phoneNumberId,\n      peer: from,\n      name: contactName\n    };\n  }\n  \n  // \u2705 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a \u0627\u0644\u0623\u0633\u0627\u0633\u064a\u0629 (\u0645\u062a\u0648\u0627\u0641\u0642\u0629 \u0645\u0639 \u0628\u0627\u0642\u064a \u0627\u0644\u0640 workflow)\n  const baseData = {\n    phone_number: from,\n    phone_number_id: phoneNumberId,\n    business_number: businessNumber,\n    contact_name: contactName,\n    is_status_update: false,\n    message_text: '',\n    interactive_reply: '',\n    interactive_title: '',\n    interactive_type: '',\n    media_type: '',\n    media_url: '',\n    media_id: '',\n    media_caption: '',\n    media_filename: '',\n    media_mime_type: ''\n  };\n  \n  // \u0645\u0639\u0627\u0644\u062c\u0629 \u062d\u0633\u0628 \u0627\u0644\u0646\u0648\u0639\n  if (msgType === 'text') {\n    baseData.message_text = msg.text?.body || '';\n    outputs.push({ json: baseData });\n  }\n  \n  // \ud83d\udcce Document\n  else if (msgType === 'document') {\n    const doc = msg.document || {};\n    const originalFilename = doc.filename || 'document';\n    \n    console.log('\ud83d\udcc4 Document received:', {\n      id: doc.id,\n      filename: originalFilename,\n      mime: doc.mime_type,\n      caption: doc.caption\n    });\n    \n    baseData.media_type = 'document';\n    baseData.media_id = doc.id;\n    baseData.media_mime_type = doc.mime_type || 'application/octet-stream';\n    baseData.media_caption = doc.caption || '';\n    baseData.media_filename = originalFilename;  // \u2705 \u0647\u0646\u0627!\n    baseData.message_text = doc.caption || originalFilename;\n    \n    outputs.push({ json: baseData });\n  }\n  \n  // \ud83d\uddbc\ufe0f Image\n  else if (msgType === 'image') {\n    const img = msg.image || {};\n    \n    baseData.media_type = 'image';\n    baseData.media_id = img.id;\n    baseData.media_mime_type = img.mime_type || 'image/jpeg';\n    baseData.media_caption = img.caption || '';\n    baseData.message_text = img.caption || '\ud83d\uddbc\ufe0f \u0635\u0648\u0631\u0629';\n    \n    outputs.push({ json: baseData });\n  }\n  \n  // \ud83c\udfa5 Video\n  else if (msgType === 'video') {\n    const vid = msg.video || {};\n    \n    baseData.media_type = 'video';\n    baseData.media_id = vid.id;\n    baseData.media_mime_type = vid.mime_type || 'video/mp4';\n    baseData.media_caption = vid.caption || '';\n    baseData.message_text = vid.caption || '\ud83c\udfa5 \u0641\u064a\u062f\u064a\u0648';\n    \n    outputs.push({ json: baseData });\n  }\n  \n  // \ud83c\udfb5 Audio/Voice\n  else if (msgType === 'audio' || msgType === 'voice') {\n    const aud = msg[msgType] || {};\n    \n    baseData.media_type = msgType === 'voice' ? 'voice' : 'audio';\n    baseData.media_id = aud.id;\n    baseData.media_mime_type = aud.mime_type || 'audio/ogg';\n    baseData.message_text = msgType === 'voice' ? '\ud83c\udfa4 \u0631\u0633\u0627\u0644\u0629 \u0635\u0648\u062a\u064a\u0629' : '\ud83c\udfb5 \u0645\u0644\u0641 \u0635\u0648\u062a\u064a';\n    \n    outputs.push({ json: baseData });\n  }\n  \n  // Interactive buttons/lists\n  else if (msgType === 'interactive') {\n    if (msg.interactive?.list_reply) {\n      baseData.interactive_reply = msg.interactive.list_reply.id || '';\n      baseData.interactive_title = msg.interactive.list_reply.title || '';\n      baseData.interactive_type = 'list_reply';\n      baseData.message_text = baseData.interactive_title;\n    } else if (msg.interactive?.button_reply) {\n      baseData.interactive_reply = msg.interactive.button_reply.id || '';\n      baseData.interactive_title = msg.interactive.button_reply.title || '';\n      baseData.interactive_type = 'button_reply';\n      baseData.message_text = baseData.interactive_title;\n    }\n    outputs.push({ json: baseData });\n  }\n  \n  // \u0646\u0633\u062e \u0642\u062f\u064a\u0645\u0629 (type=button)\n  else if (msgType === 'button' && msg.button) {\n    baseData.interactive_title = msg.button.text || '';\n    baseData.interactive_reply = (msg.button.payload || baseData.interactive_title || '').trim();\n    baseData.interactive_type = 'button';\n    baseData.message_text = baseData.interactive_title;\n    outputs.push({ json: baseData });\n  }\n}\n\nconsole.log(`\u2705 Processed ${outputs.length} messages`);\n\nreturn outputs.length > 0 ? outputs : [{ json: { \n  ok: true, \n  no_media: true,\n  phone_number_id: phoneNumberId \n} }];"
      },
      "typeVersion": 2
    },
    {
      "id": "91628ba1-d6ac-420b-985b-20da43beb323",
      "name": "\u0631\u0633\u0627\u0644\u0629 \u062c\u062f\u064a\u062f\u0629\u061f",
      "type": "n8n-nodes-base.if",
      "position": [
        -240,
        368
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.interactive_reply }}",
              "operation": "isEmpty"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8a365257-164a-4649-ba22-7d03c7c9abcb",
      "name": "\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0631\u0626\u064a\u0633\u064a\u0629",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        688,
        336
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v17.0/{{ $json.phone_number_id }}/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $json._outgoing.payload }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "5702fbf2-eb43-4731-92d2-a60f863ce515",
      "name": "\u0627\u0644\u0623\u0633\u0639\u0627\u0631 - \u0627\u062e\u062a\u0631 \u062c\u0646\u0633\u064a\u0629",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1056,
        720
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v17.0/{{ $json.phone_number_id }}/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $json._outgoing.payload }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "4b7f74a7-aef9-45bf-8ec2-3f51cb89d26c",
      "name": "\u0637\u0644\u0628 \u062c\u062f\u064a\u062f - \u0627\u062e\u062a\u0631 \u062c\u0646\u0633\u064a\u0629",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1056,
        864
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v17.0/{{ $json.phone_number_id }}/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $json._outgoing.payload }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "374fd065-4e27-4f87-b1ff-371acf336009",
      "name": "\u0645\u062a\u0627\u0628\u0639\u0629 - \u0627\u0637\u0644\u0628 \u0631\u0642\u0645",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1056,
        1008
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v17.0/{{ $json.phone_number_id }}/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $json._outgoing.payload }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "87fbeba5-f4b6-48b7-b230-73650f4c79bc",
      "name": "\u0627\u0644\u062a\u0631\u062c\u0645\u0629 - \u0631\u0627\u0628\u0637",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1056,
        1280
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v17.0/{{ $json.phone_number_id }}/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $json._outgoing.payload }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "473bd547-e864-4f6b-a30b-3775aa624f61",
      "name": "\u0627\u0644\u0634\u0643\u0627\u0648\u0649 - \u0627\u0637\u0644\u0628 \u062a\u0641\u0627\u0635\u064a\u0644",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1056,
        1424
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v17.0/{{ $json.phone_number_id }}/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $json._outgoing.payload }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "4e754e32-b2eb-46ac-b3ac-56c24e1814d1",
      "name": "\u0639\u0646 \u0627\u0644\u0645\u0643\u062a\u0628",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1056,
        1584
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v17.0/{{ $json.phone_number_id }}/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"messaging_product\": \"whatsapp\",\n  \"to\": \"{{ $json.phone_number }}\",\n  \"type\": \"text\",\n  \"text\": {\n    \"body\": \"\ud83c\udfe2 \u0645\u0643\u062a\u0628 \u0641\u0647\u062f \u0644\u0644\u0627\u0633\u062a\u0642\u062f\u0627\u0645\\n\\n\u2705 \u0645\u0643\u062a\u0628 \u0645\u0639\u062a\u0645\u062f \u0648\u0645\u0631\u062e\u0635 \u0645\u0646 \u0645\u0633\u0627\u0646\u062f \u0648\u0648\u0632\u0627\u0631\u0629 \u0627\u0644\u0639\u0645\u0644\\n\\n\ud83c\udf0d \u0646\u0633\u062a\u0642\u062f\u0645 \u0627\u0644\u0639\u0645\u0627\u0644\u0629 \u0627\u0644\u0645\u0646\u0632\u0644\u064a\u0629 \u0645\u0646 \u0627\u0644\u062c\u0646\u0633\u064a\u0627\u062a \u0627\u0644\u062a\u0627\u0644\u064a\u0629:\\n1- \u0627\u0644\u0641\u0644\u0628\u064a\u0646 \ud83c\uddf5\ud83c\udded 12,999 SAR\\n2- \u0633\u0631\u064a\u0644\u0627\u0646\u0643\u0627 \ud83c\uddf1\ud83c\uddf0 14,700 SAR\\n3- \u0628\u0646\u062c\u0644\u0627\u062f\u064a\u0634 \ud83c\udde7\ud83c\udde9 7,900 SAR\\n4- \u0643\u064a\u0646\u064a\u0627 \ud83c\uddf0\ud83c\uddea 6,400 SAR\\n5- \u0623\u0648\u063a\u0646\u062f\u0627 \ud83c\uddfa\ud83c\uddec 4,900 SAR\\n6- \u0625\u062b\u064a\u0648\u0628\u064a\u0627 \ud83c\uddea\ud83c\uddf9 4,490 SAR\\n7- \u0628\u0648\u0631\u0648\u0646\u062f\u064a \ud83c\udde7\ud83c\uddee 5,900 SAR\\n8- \u0627\u0644\u0647\u0646\u062f \ud83c\uddee\ud83c\uddf3 3,000 SAR\\n\\n\ud83d\udee1\ufe0f \u064a\u0648\u062c\u062f \u062a\u0623\u0645\u064a\u0646 \u0644\u0645\u062f\u0629 \u0633\u0646\u062a\u064a\u0646 \u0639\u0644\u0649 \u0627\u0644\u0639\u0645\u0627\u0644\u0629 \u0627\u0644\u0645\u0646\u0632\u0644\u064a\u0629 \u0641\u064a \u062d\u0627\u0644\u0629 \u0627\u0644\u0647\u0631\u0648\u0628 \u0623\u0648 \u0631\u0641\u0636 \u0627\u0644\u0639\u0645\u0644.\\n\\n\ud83d\udcde \u0644\u0644\u062a\u0648\u0627\u0635\u0644 \u0648\u0627\u0644\u0627\u0633\u062a\u0641\u0633\u0627\u0631:\\n\u260e\ufe0f 0112333325\\n\\n\ud83c\udf10 fahadrec.com\"\n  }\n}\n",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "24d9ff16-2752-4915-9239-2ab8e4f04e98",
      "name": "\u0627\u0644\u062a\u062d\u062f\u062b \u0645\u0639 \u0645\u0648\u0638\u0641",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1056,
        1728
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v17.0/{{ $json.phone_number_id }}/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"messaging_product\": \"whatsapp\",\n  \"to\": \"{{ $json.phone_number }}\",\n  \"type\": \"text\",\n  \"text\": {\n    \"body\": \"\ud83e\udd1d \u0627\u0644\u0631\u062c\u0627\u0621 \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631...\\n\\n\u0633\u064a\u062a\u0645 \u0627\u0644\u062a\u0648\u0627\u0635\u0644 \u0645\u0639\u0643 \u0645\u0646 \u0623\u062d\u062f \u0645\u0648\u0638\u0641\u064a \u062e\u062f\u0645\u0629 \u0627\u0644\u0639\u0645\u0644\u0627\u0621 \u0641\u064a \u0623\u0642\u0631\u0628 \u0648\u0642\u062a \u0645\u0645\u0643\u0646.\\n\\n\u0634\u0643\u0631\u0627\u064b \u0644\u062a\u0648\u0627\u0635\u0644\u0643 \u0645\u0639\u0646\u0627! \u2764\ufe0f\"\n  }\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "1aa07f2b-5e6b-4058-aa1c-7b24cca5cdff",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1456,
        1088
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={ \"status\": \"success\" }"
      },
      "typeVersion": 1
    },
    {
      "id": "91ac8558-125b-46ac-a6e7-df5f9f39c425",
      "name": "menu route",
      "type": "n8n-nodes-base.switch",
      "position": [
        272,
        1136
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "\u0627\u0644\u0623\u0633\u0639\u0627\u0631",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "572679ed-98e5-4ef2-91ef-f71ee5f71d5a",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.interactive_reply }}",
                    "rightValue": "m_prices"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "\u0637\u0644\u0628_\u062c\u062f\u064a\u062f",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "e82c38ca-2b19-41ee-81c3-e31fbf68f11e",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.interactive_reply }}",
                    "rightValue": "m_new_request"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "\u0645\u062a\u0627\u0628\u0639\u0629_\u0637\u0644\u0628",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "360450e9-4cad-447c-b4fa-634ea86b2fd4",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.interactive_reply }}",
                    "rightValue": "m_track_request"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "\u0646\u0642\u0644_\u062e\u062f\u0645\u0627\u062a",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "4ec032b5-e027-4604-a7d8-df690fbda405",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.interactive_reply }}",
                    "rightValue": "m_transfer"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "\u0627\u0644\u062a\u0631\u062c\u0645\u0629",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "300ccf24-770f-4da4-b4ba-1512a24d78bd",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.interactive_reply }}",
                    "rightValue": "m_translation"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "\u0627\u0644\u0634\u0643\u0627\u0648\u0649",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "2d739557-df98-49d6-98af-27828c64802a",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.interactive_reply }}",
                    "rightValue": "m_complaints"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "\u0639\u0646_\u0627\u0644\u0645\u0643\u062a\u0628",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "494bb8e9-64b8-4423-8573-8fbd9e5ff500",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.interactive_reply }}",
                    "rightValue": "m_about"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "\u0645\u0648\u0638\u0641",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "55cff913-09b2-407b-983b-cfdf15ac4b28",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.interactive_reply }}",
                    "rightValue": "m_talk_to_agent"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "85e4dcf9-fbb3-43b1-be9d-7063cf506345",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        1648,
        160
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "249da7be-36df-4fa6-bd36-397c8a717315",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json['Nationality'] }}",
              "rightValue": "={{ $('sub route').item.json.interactive_reply }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "29dc3f4a-8977-473f-b767-ab12246bd5d6",
      "name": "\u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0623\u0633\u0639\u0627\u0631",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2192,
        144
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v17.0/{{ $('sub route').item.json.phone_number_id }}/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $json._outgoing.payload }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "161e9e68-4bcd-4388-8ba1-e175d98a7076",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        1648,
        416
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "249da7be-36df-4fa6-bd36-397c8a717315",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json['\u0627\u0644\u062c\u0646\u0633\u064a\u0629 '] }}",
              "rightValue": "={{ $('sub route').item.json.interactive_reply }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "78ea897f-39a2-45e5-8b99-015371056971",
      "name": "\u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0633\u064a\u0631",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2080,
        400
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v17.0/{{ $('sub route').item.json.phone_number_id }}/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"messaging_product\": \"whatsapp\",\n  \"to\": \"{{ $('sub route').item.json.phone_number }}\",\n  \"type\": \"text\",\n  \"text\": {\n    \"body\": \"\u2705 \u062a\u0645 \u0627\u062e\u062a\u064a\u0627\u0631 \u0627\u0644\u062c\u0646\u0633\u064a\u0629: {{ $json['\u0627\u0644\u0628\u0644\u062f'] }}\\n\\n\ud83d\udcc4 \u0631\u0627\u0628\u0637 \u0627\u0644\u0633\u064a\u0631 \u0627\u0644\u0630\u0627\u062a\u064a\u0629 \u0644\u0644\u062c\u0646\u0633\u064a\u0629 \u0644\u0644\u0637\u0644\u0628 \u0627\u0644\u062c\u062f\u064a\u062f: {{ $json['\u0627\u0644\u0633\u064a\u0631\u0629'] }} \\n\\n\ud83d\udca1 \u0633\u064a\u062a\u0645 \u062a\u0633\u062c\u064a\u0644 \u0632\u064a\u0627\u0631\u062a\u0643 \u0644\u0645\u062a\u0627\u0628\u0639\u0629 \u0627\u0647\u062a\u0645\u0627\u0645\u0643\"\n  }\n}\n",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "02a6fa83-763c-4e84-b737-e7549ca01ba4",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        2432,
        400
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "c240ad3d-9147-4d24-bad7-1810db0b1eb8",
      "name": "\u0631\u0633\u0627\u0644\u0629 \u062a\u0623\u0643\u064a\u062f \u0627\u0644\u0633\u064a\u0631\u0629",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2880,
        400
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v17.0/{{ $('sub route').item.json.phone_number_id }}/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"messaging_product\": \"whatsapp\",\n  \"to\": \"{{ $('sub route').item.json.phone_number }}\",\n  \"type\": \"text\",\n  \"text\": {\n    \"body\": \"\u062a\u0645 \u0627\u0633\u062a\u0644\u0627\u0645 \u0637\u0644\u0628\u0643\u060c \u0648\u0633\u064a\u062a\u0648\u0627\u0635\u0644 \u0645\u0639\u0643 \u0627\u0644\u0645\u0648\u0638\u0641 \u0642\u0631\u064a\u0628\u064b\u0627\"\n  }\n}\n",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "b21d3613-3da3-4148-95a4-89ebb6f67dea",
      "name": "\u0625\u062f\u062e\u0627\u0644 \u0637\u0644\u0628 \u062c\u062f\u064a\u062f",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2272,
        400
      ],
      "parameters": {
        "columns": {
          "value": {
            "\u0627\u0644\u0628\u0644\u062f": "={{ $('If1').item.json['\u0627\u0644\u0628\u0644\u062f'] }}",
            "\u0627\u0644\u062d\u0627\u0644\u0629": "\u0642\u064a\u062f \u0627\u0644\u0645\u0631\u0627\u062c\u0639\u0629",
            "\u0627\u0633\u0645 \u0627\u0644\u0639\u0645\u064a\u0644": "={{ $('sub route').item.json.contact_name }}",
            "\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641 ": "={{ $('sub route').item.json.phone_number }}"
          },
          "schema": [
            {
              "id": "\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641 ",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641 ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0627\u0633\u0645 \u0627\u0644\u0639\u0645\u064a\u0644",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "\u0627\u0633\u0645 \u0627\u0644\u0639\u0645\u064a\u0644",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0627\u0644\u0628\u0644\u062f",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "\u0627\u0644\u0628\u0644\u062f",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0627\u0644\u062d\u0627\u0644\u0629",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "\u0627\u0644\u062d\u0627\u0644\u0629",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641 "
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lR0Y0r-bAvLWxVzTW8P3pex1vyxjqfNjQ8RRe0ozMyQ/edit#gid=0",
          "cachedResultName": "\u0637\u0644\u0628\u0627\u062a \u062c\u062f\u064a\u062f\u0629"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1lR0Y0r-bAvLWxVzTW8P3pex1vyxjqfNjQ8RRe0ozMyQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lR0Y0r-bAvLWxVzTW8P3pex1vyxjqfNjQ8RRe0ozMyQ/edit?usp=drivesdk",
          "cachedResultName": "Fahed"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.7
    },
    {
      "id": "e3f36a74-3c90-4392-9050-64000f5e64d8",
      "name": "\u0645\u062a\u0627\u0628\u0639\u0629",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1456,
        640
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $('\u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a').item.json.phone_number }}",
              "lookupColumn": "\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641 "
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lR0Y0r-bAvLWxVzTW8P3pex1vyxjqfNjQ8RRe0ozMyQ/edit#gid=0",
          "cachedResultName": "\u0637\u0644\u0628\u0627\u062a \u062c\u062f\u064a\u062f\u0629"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1lR0Y0r-bAvLWxVzTW8P3pex1vyxjqfNjQ8RRe0ozMyQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lR0Y0r-bAvLWxVzTW8P3pex1vyxjqfNjQ8RRe0ozMyQ/edit?usp=drivesdk",
          "cachedResultName": "Fahed"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.7,
      "alwaysOutputData": true
    },
    {
      "id": "be0e5b6e-0fea-4357-a808-5a094f1c8451",
      "name": "If2",
      "type": "n8n-nodes-base.if",
      "position": [
        1744,
        640
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "249da7be-36df-4fa6-bd36-397c8a717315",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.found }}",
              "rightValue": "={{ $('\u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a').item.json.phone_number }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f386d583-e97b-4ff7-9c94-e4ae6bd2cb44",
      "name": "\u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0645\u062a\u0627\u0628\u0639\u0629",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2240,
        624
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v17.0/{{ $('sub route').item.json.phone_number_id }}/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"messaging_product\": \"whatsapp\",\n  \"to\": \"{{ $('sub route').item.json.phone_number }}\",\n  \"type\": \"text\",\n  \"text\": {\n    \"body\": \" \u062d\u0627\u0644\u0629 \u0637\u0644\u0628\u0643: {{ $json['\u0627\u0644\u062d\u0627\u0644\u0629'] }} \"\n  }\n}\n",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "9f99b7aa-0de0-40d6-845d-5fcb68e5ce65",
      "name": "\u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0645\u062a\u0627\u0628\u0639\u06291",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2240,
        832
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v17.0/{{ $('sub route').item.json.phone_number_id }}/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"messaging_product\": \"whatsapp\",\n  \"to\": \"{{ $('sub route').item.json.phone_number }}\",\n  \"type\": \"text\",\n  \"text\": {\n    \"body\": \" \u0639\u0630\u0631\u064b\u0627\u060c \u0644\u0645 \u064a\u062a\u0645 \u0627\u0644\u0639\u062b\u0648\u0631 \u0639\u0644\u0649 \u0637\u0644\u0628 \u0628\u0647\u0630\u0627 \u0627\u0644\u0631\u0642\u0645 \"\n  }\n}\n",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "47b823fe-8dfd-4911-b20f-45a63d88437b",
      "name": "Wait1",
      "type": "n8n-nodes-base.wait",
      "position": [
        2064,
        1328
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "590e17e2-f6da-42be-b476-e904da8ae953",
      "name": "\u0627\u0642\u0631\u0623 \u0627\u0644\u062d\u0627\u0644\u0629",
      "type": "n8n-nodes-base.code",
      "position": [
        -448,
        592
      ],
      "parameters": {
        "jsCode": "const inItem = $input.first().json;\nconst store = $getWorkflowStaticData('global');\n\nconst account = String(inItem.phone_number_id || '').trim();\nconst peer    = String(inItem.phone_number || '').trim();\nconst key = account && peer ? `${account}:${peer}` : (peer || 'unknown');\n\nconst session = (store.sessions && store.sessions[key]) || { state: 'idle', ts: 0, updatedAt: 0 };\n\nreturn [{\n  json: {\n    ...inItem,\n    session_state: session.state,\n    session_ts: session.updatedAt || session.ts || 0,\n    used_key: key,\n    session_name: session.name || inItem.contact_name || '\u0639\u0645\u064a\u0644'\n  }\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "5f5c2b17-c71e-4229-9f6e-9df625d74d24",
      "name": "If5",
      "type": "n8n-nodes-base.if",
      "position": [
        -2160,
        592
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "9221fb66-eed3-40ae-9a7f-6ebccc56c74a",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.entry[0].changes[0].value.contacts[0].wa_id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "138879c5-5ee7-431f-b3e0-5b3bbb71e0c4",
      "name": "\u0646\u0642\u0644 \u062e\u0627\u062f\u0645\u0627\u062a - \u0627\u062e\u062a\u0631 \u062c\u0646\u0633\u064a\u0629",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1056,
        1152
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v17.0/{{ $json.phone_number_id }}/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $json._outgoing.payload }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "701db46e-76cf-48a7-9876-4a0ecfc9418f",
      "name": "\u0646\u0642\u0644 \u062e\u0627\u062f\u0645\u0627\u062a \u0645\u0646 \u0627\u0644\u0634\u064a\u062a",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1696,
        1328
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 434305240,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lR0Y0r-bAvLWxVzTW8P3pex1vyxjqfNjQ8RRe0ozMyQ/edit#gid=434305240",
          "cachedResultName": "\u0646\u0642\u0644 \u0627\u0644\u062e\u0627\u062f\u0645\u0627\u062a"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1lR0Y0r-bAvLWxVzTW8P3pex1vyxjqfNjQ8RRe0ozMyQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lR0Y0r-bAvLWxVzTW8P3pex1vyxjqfNjQ8RRe0ozMyQ/edit?usp=drivesdk",
          "cachedResultName": "Fahed"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.7
    },
    {
      "id": "69feed29-0596-4982-84e5-278249d9c0ac",
      "name": "\u0625\u062f\u062e\u0627\u0644 \u0646\u0642\u0644 \u062e\u0627\u062f\u0645\u0627\u062a",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1872,
        1328
      ],
      "parameters": {
        "columns": {
          "value": {
            "\u0627\u0644\u062d\u0627\u0644\u0629": "\u0642\u064a\u062f \u0627\u0644\u0645\u0631\u0627\u062c\u0639\u0629",
            "\u0627\u0633\u0645 \u0627\u0644\u0639\u0645\u064a\u0644": "={{ $('sub route').item.json.contact_name }}",
            "\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641 ": "={{ $('\u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a').item.json.phone_number }}"
          },
          "schema": [
            {
              "id": "\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641 ",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641 ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0627\u0633\u0645 \u0627\u0644\u0639\u0645\u064a\u0644",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "\u0627\u0633\u0645 \u0627\u0644\u0639\u0645\u064a\u0644",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0627\u0644\u062d\u0627\u0644\u0629",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "\u0627\u0644\u062d\u0627\u0644\u0629",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641 "
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 434305240,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lR0Y0r-bAvLWxVzTW8P3pex1vyxjqfNjQ8RRe0ozMyQ/edit#gid=434305240",
          "cachedResultName": "\u0646\u0642\u0644 \u0627\u0644\u062e\u0627\u062f\u0645\u0627\u062a"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1lR0Y0r-bAvLWxVzTW8P3pex1vyxjqfNjQ8RRe0ozMyQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lR0Y0r-bAvLWxVzTW8P3pex1vyxjqfNjQ8RRe0ozMyQ/edit?usp=drivesdk",
          "cachedResultName": "Fahed"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.7
    },
    {
      "id": "473acdac-00cd-4b52-ad1d-951c16451a50",
      "name": "\u0631\u0633\u0627\u0644\u0629 \u062a\u0623\u0643\u064a\u062f \u0637\u0644\u0628 \u0627\u0644\u0646\u0642\u0644 \u0627\u0644\u062e\u0627\u062f\u0645\u0627\u062a",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2528,
        1328
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v17.0/{{ $('sub route').item.json.phone_number_id }}/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"messaging_product\": \"whatsapp\",\n  \"to\": \"{{ $('sub route').item.json.phone_number }}\",\n  \"type\": \"text\",\n  \"text\": {\n    \"body\": \"\u062a\u0645 \u0627\u0633\u062a\u0644\u0627\u0645 \u0637\u0644\u0628\u0643\u060c \u0648\u0633\u064a\u062a\u0648\u0627\u0635\u0644 \u0645\u0639\u0643 \u0627\u0644\u0645\u0648\u0638\u0641 \u0642\u0631\u064a\u0628\u064b\u0627\"\n  }\n}\n",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "b595ef3b-85ae-4762-ad4e-a4a2bf421726",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        1600,
        640
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\n\n// \u0646\u0639\u062a\u0628\u0631 \u0623\u0646\u0647 \"\u0648\u062c\u062f \u0635\u0641\" \u0641\u0642\u0637 \u0625\u0630\u0627:\nconst hasData =\n  items.length > 0 &&\n  items.some(it => it && it.json && Object.keys(it.json).length > 0); // \u0645\u0634 \u0641\u0627\u0636\u064a\n\nif (hasData) {\n  // \u0631\u062c\u0651\u0639 \u0643\u0644 \u0627\u0644\u0639\u0646\u0627\u0635\u0631 \u0645\u0639 found=true\u060c \u0648\u0627\u062d\u0641\u0638 \u0627\u0644\u0627\u0642\u062a\u0631\u0627\u0646 \u0645\u0639 \u0639\u0646\u0627\u0635\u0631 \u0627\u0644\u0625\u062f\u062e\u0627\u0644\n  return items.map((item, idx) => ({\n    json: { ...item.json, found: true },\n    pairedItem: { item: idx },   // \u0645\u0647\u0645 \u0644\u062a\u0641\u0627\u062f\u064a \u0627\u0644\u062a\u062d\u0630\u064a\u0631 \u0648\u0627\u0644\u062d\u0641\u0627\u0638 \u0639\u0644\u0649 .item\n  }));\n}\n\n// \u0645\u0627 \u0641\u064a \u0646\u062a\u0627\u0626\u062c \u0645\u0646 \u0627\u0644\u0634\u064a\u062a \u2192 \u0631\u062c\u0651\u0639 \u0639\u0646\u0635\u0631 \u0648\u0627\u062d\u062f \u0645\u0639 found=false (\u0648\u0628\u062f\u0648\u0646 \u0643\u0633\u0631 \u0627\u0644\u0627\u0642\u062a\u0631\u0627\u0646)\nconst base = items[0] || { json: {} };\nreturn [{\n  json: { ...base.json, found: false },\n  pairedItem: base.pairedItem ?? { item: 0 },\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "75862d4d-7765-4b66-9942-10dca2bd59b8",
      "name": "\u0627\u0644\u0634\u0643\u0627\u0648\u0649 - \u0627\u0637\u0644\u0628 \u062a\u0641\u0627\u0635\u064a\u06441",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2000,
        1600
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v17.0/{{ $json.phone_number_id }}/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"messaging_product\": \"whatsapp\",\n  \"to\": \"{{ $json.phone_number }}\",\n  \"type\": \"text\",\n  \"text\": {\n    \"body\": \"\u2705 \u062a\u0645 \u062a\u0633\u062c\u064a\u0644 \u0627\u0644\u0634\u0643\u0648\u0649 \u0627\u0644\u062e\u0627\u0635\u0629 \u0628\u0643 \u0628\u0646\u062c\u0627\u062d.\\n\\n\ud83d\udccc \u0646\u0648\u0639 \u0627\u0644\u0634\u0643\u0648\u0649: {{ $json.interactive_title }}\\n\\n\u0641\u0631\u064a\u0642 \u0627\u0644\u062f\u0639\u0645 \u0633\u064a\u062a\u0648\u0627\u0635\u0644 \u0645\u0639\u0643 \u0642\u0631\u064a\u0628\u064b\u0627 \u0644\u0645\u0639\u0627\u0644\u062c\u0629 \u0627\u0644\u0645\u0634\u0643\u0644\u0629 \ud83d\ude4f\"\n  }\n}\n",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "7552414b-0e87-4e32-b3f0-916580050439",
      "name": "\u0625\u062f\u062e\u0627\u0644 \u0646\u0642\u0644 \u062e\u0627\u062f\u0645\u0627\u062a1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2384,
        1600
      ],
      "parameters": {
        "columns": {
          "value": {
            "\u0627\u0644\u0634\u0643\u0648\u0649": "={{ $('\u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a').item.json.interactive_title }}",
            "\u0627\u0633\u0645 \u0627\u0644\u0639\u0645\u064a\u0644": "={{ $('sub route').item.json.contact_name }}",
            "\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641 ": "={{ $('\u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a').item.json.phone_number }}"
          },
          "schema": [
            {
              "id": "\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641 ",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641 ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0627\u0633\u0645 \u0627\u0644\u0639\u0645\u064a\u0644",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "\u0627\u0633\u0645 \u0627\u0644\u0639\u0645\u064a\u0644",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0627\u0644\u0634\u0643\u0648\u0649",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "\u0627\u0644\u0634\u0643\u0648\u0649",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641 "
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1283595730,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lR0Y0r-bAvLWxVzTW8P3pex1vyxjqfNjQ8RRe0ozMyQ/edit#gid=1283595730",
          "cachedResultName": "\u0634\u0643\u0627\u0648\u064a"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1lR0Y0r-bAvLWxVzTW8P3pex1vyxjqfNjQ8RRe0ozMyQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lR0Y0r-bAvLWxVzTW8P3pex1vyxjqfNjQ8RRe0ozMyQ/edit?usp=drivesdk",
          "cachedResultName": "Fahed"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.7
    },
    {
      "id": "5bd6a30a-3b4a-4d52-aaf0-e7f5caf93583",
      "name": "Verify Webhook2",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -2160,
        400
      ],
      "parameters": {
        "options": {
          "responseCode": 200
        },
        "respondWith": "text",
        "responseBody": "={{$json.query['hub.challenge'] || 'OK'}}"
      },
      "typeVersion": 1.4
    },
    {
      "id": "5841027e-3f56-48d5-ba6e-2e91d4b49ed9",
      "name": "Code in JavaScript1",
      "type": "n8n-nodes-base.code",
      "position": [
        -1200,
        624
      ],
      "parameters": {
        "jsCode": "const g = $getWorkflowStaticData('global');\nconst inItem = $input.first().json;\n\n// \ud83c\udff7\ufe0f PART 1: Label Tracker - \u062a\u062a\u0628\u0639 \u0627\u0644\u062a\u0633\u0645\u064a\u0627\u062a\ng.labels = g.labels || {};\n\nconst account = String(inItem.phone_number_id || '').trim();\nconst peer = String(inItem.phone_number || '').trim();\nconst interactiveReply = String(inItem.interactive_reply || '').trim();\n\nif (account && peer) {\n  const key = `${account}:${peer}`;\n  let label = g.labels[key] || ''; // \u2705 \u0627\u062d\u062a\u0641\u0638 \u0628\u0627\u0644\u0640 label \u0627\u0644\u0633\u0627\u0628\u0642 \u0625\u0630\u0627 \u0644\u0645 \u064a\u062a\u063a\u064a\u0631\n\n  // \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0631\u0626\u064a\u0633\u064a\u0629\n  if (interactiveReply === 'm_prices') {\n    label = '\u0627\u0644\u0623\u0633\u0639\u0627\u0631';\n  } else if (interactiveReply === 'm_new_request') {\n    label = '\u0637\u0644\u0628 \u062c\u062f\u064a\u062f';\n  } else if (interactiveReply === 'm_track_request') {\n    label = '\u0645\u062a\u0627\u0628\u0639\u0629 \u0637\u0644\u0628';\n  } else if (interactiveReply === 'm_transfer') {\n    label = '\u0646\u0642\u0644 \u0627\u0644\u062e\u0627\u062f\u0645\u0627\u062a';\n  } else if (interactiveReply === 'm_translation') {\n    label = '\u0627\u0644\u062a\u0631\u062c\u0645\u0629';\n  } else if (interactiveReply === 'm_talk_to_agent') {\n    label = '\u0627\u0644\u062a\u062d\u062f\u062b \u0645\u0639 \u0645\u0648\u0638\u0641';\n  }\n  // \u0627\u0644\u0634\u0643\u0627\u0648\u0649 \u0648\u0627\u0644\u062f\u0639\u0645\n  else if (interactiveReply === 'complaint_worker') {\n    label = '\u0645\u0634\u0643\u0644\u0629 \u0645\u0639 \u0627\u0644\u0639\u0627\u0645\u0644\u0629';\n  } else if (interactiveReply === 'complaint_service') {\n    label = '\u0645\u0634\u0643\u0644\u0629 \u0641\u064a \u0627\u0644\u062e\u062f\u0645\u0629';\n  } else if (interactiveReply === 'complaint_delay') {\n    label = '\u062a\u0623\u062e\u064a\u0631 \u0641\u064a \u0627\u0644\u0625\u062c\u0631\u0627\u0621\u0627\u062a';\n  } else if (interactiveReply === 'complaint_financial') {\n    label = '\u0645\u0634\u0627\u0643\u0644 \u0645\u0627\u0644\u064a\u0629';\n  } else if (interactiveReply === 'complaint_other') {\n    label = '\u0634\u0643\u0648\u0649 \u0623\u062e\u0631\u0649';\n  }\n  // \u0627\u0644\u0623\u0642\u0633\u0627\u0645 \u0627\u0644\u0641\u0631\u0639\u064a\u0629\n  else if (interactiveReply && interactiveReply.startsWith('price_')) {\n    label = '\u0627\u0644\u0623\u0633\u0639\u0627\u0631';\n  } else if (interactiveReply && interactiveReply.startsWith('req_')) {\n    label = '\u0637\u0644\u0628 \u062c\u062f\u064a\u062f';\n  }\n\n  // \u2705 \u062d\u0641\u0638 \u0627\u0644\u062a\u0633\u0645\u064a\u0629 (\u062d\u062a\u0649 \u0644\u0648 \u0643\u0627\u0646\u062a \u0641\u0627\u0631\u063a\u0629 \u0644\u0646\u062d\u062a\u0641\u0638 \u0628\u0622\u062e\u0631 label)\n  g.labels[key] = label;\n}\n\n// \ud83e\udd16 PART 2: Bot Enable Check - \u0641\u062d\u0635 \u062a\u0641\u0639\u064a\u0644 \u0627\u0644\u0628\u0648\u062a\ng.botEnabled = g.botEnabled || {};\nif (g.botMasterOn === undefined) {\n  g.botMasterOn = true;\n}\n\nlet botEnabled = g.botMasterOn;\n\nif (account && peer) {\n  const exactKey = `${account}:${peer}`;\n  const defaultKey = `default:${peer}`;\n  \n  if (g.botEnabled.hasOwnProperty(exactKey)) {\n    botEnabled = g.botEnabled[exactKey] === true;\n  }\n  else if (g.botEnabled.hasOwnProperty(defaultKey)) {\n    botEnabled = g.botEnabled[defaultKey] === true;\n  }\n}\n\nreturn [{\n  json: {\n    ...inItem,\n    bot_enabled: botEnabled\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "d178569c-ed71-4098-9398-ec7fc801ffef",
      "name": "bot on?",
      "type": "n8n-nodes-base.if",
      "position": [
        -672,
        624
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4988fbae-65bb-4a17-afb8-3e3f26082c42",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.bot_enabled }}",
              "rightValue": "true"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "8dc49fde-2ca7-42dc-8478-d60ea7ff6a49",
      "name": "\u0633\u062c\u0644 \u0627\u0644\u0631\u0633\u0627\u0626\u0644",
      "type": "n8n-nodes-base.code",
      "position": [
        -1024,
        624
      ],
      "parameters": {
        "jsCode": "const g = $getWorkflowStaticData('global');\ng.messages = g.messages || [];\ng.contacts = g.contacts || {};\n\nconst inItem = $input.first().json;\nconst account = String(inItem.phone_number_id || '').trim();\nconst peer = String(inItem.phone_number || '').trim();\nconst key = account && peer ? `${account}:${peer}` : null;\n\nif (!account || !peer) {\n  return [{ json: inItem }];\n}\n\nlet text = (inItem.message_text || '').trim();\nlet meta;\n// ===== Helper functions =====\nfunction inferExtFromMime(mime) {\n  if (!mime) return null;\n  const map = {\n    'application/pdf': 'pdf',\n    'application/msword': 'doc',\n    'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'docx',\n    'application/vnd.ms-excel': 'xls',\n    'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'xlsx',\n    'application/vnd.ms-powerpoint': 'ppt',\n    'application/vnd.openxmlformats-officedocument.presentationml.presentation': 'pptx',\n    'text/plain': 'txt',\n    'text/csv': 'csv',\n    'application/zip': 'zip',\n    'application/json': 'json'\n  };\n  return map[mime] || null;\n}\n\nfunction safeFilename(name) {\n  // \u062a\u0646\u0638\u064a\u0641 \u0627\u0644\u0627\u0633\u0645 \u0645\u0646 \u0627\u0644\u0631\u0645\u0648\u0632 \u063a\u064a\u0631 \u0627\u0644\u0645\u0633\u0645\u0648\u062d \u0628\u0647\u0627\n  return String(name || '')\n    .replace(/[\\\\/:*?\"<>|]+/g, '_')\n    .replace(/\\s+/g, ' ')\n    .trim()\n    .slice(0, 120);\n}\n\nfunction ensureExt(name, extFallback) {\n  const hasExt = /\\.[a-z0-9]{1,6}$/i.test(name || '');\n  if (hasExt) return name;\n  const ext = extFallback ? `.${extFallback}` : '';\n  return `${name || 'document'}${ext}`;\n}\n// =============================\n\n// \u2705 \u0648\u0633\u0627\u0626\u0637 - \u0646\u062d\u0641\u0638 media_id \u0641\u0642\u0637 (\u0627\u0644\u0645\u0644\u0641 \u0641\u064a Data Table)\nif (inItem.media_type && inItem.media_id) {\n  const mediaType = inItem.media_type;\n  \n  if (mediaType === 'image') {\n    text = '\ud83d\uddbc\ufe0f \u0635\u0648\u0631\u0629' + (inItem.media_caption ? ': ' + inItem.media_caption : '');\n    meta = { \n      kind: 'media', \n      type: 'image',\n      media_id: inItem.media_id,  // \u2705 \u0627\u0644\u0645\u0641\u062a\u0627\u062d \u0641\u0642\u0637\n      // \u274c \u0628\u062f\u0648\u0646 base64 - \u0645\u0648\u062c\u0648\u062f \u0641\u064a Data Table\n      caption: inItem.media_caption\n    };\n  } \n  else if (mediaType === 'video') {\n    text = '\ud83c\udfa5 \u0641\u064a\u062f\u064a\u0648' + (inItem.media_caption ? ': ' + inItem.media_caption : '');\n    meta = { \n      kind: 'media', \n      type: 'video',\n      media_id: inItem.media_id,\n      caption: inItem.media_caption\n    };\n  }\n  else if (mediaType === 'audio') {\n    text = '\ud83c\udfb5 \u0645\u0644\u0641 \u0635\u0648\u062a\u064a';\n    meta = { \n      kind: 'media', \n      type: 'audio',\n      media_id: inItem.media_id\n    };\n  }\n  else if (mediaType === 'voice') {\n    text = '\ud83c\udfa4 \u0631\u0633\u0627\u0644\u0629 \u0635\u0648\u062a\u064a\u0629';\n    meta = { \n      kind: 'media', \n      type: 'voice',\n      media_id: inItem.media_id\n    };\n  }\nelse if (mediaType === 'document') {\n  const mime = inItem.media_mime || inItem.media_mime_type; // \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u0645\u062a\u0627\u062d\u0629 \u0645\u0646 \u0627\u0644\u0645\u0635\u062f\u0631\n  const extFromMime = inferExtFromMime(mime);\n  const baseName = safeFilename(inItem.media_filename || '\u0645\u0633\u062a\u0646\u062f');\n  const finalName = ensureExt(baseName, extFromMime || 'bin');\n\n  text = '\ud83d\udcc4 ' + baseName;\n  meta = { \n    kind: 'media', \n    type: 'document',\n    media_id: inItem.media_id,\n    caption: inItem.media_caption,\n    filename: finalName,\n    mime_type: mime || null\n  };\n}\n}\n\n// Interactive\nif (inItem.interactive_reply && inItem.interactive_title) {\n  meta = { \n    kind: 'interactive', \n    title: inItem.interactive_title,\n    id: inItem.interactive_reply,\n    type: inItem.interactive_type\n  };\n  text = inItem.interactive_title || text;\n}\n\nconst msg = {\n  account, peer,\n  name: inItem.contact_name || peer,\n  dir: 'in',\n  text: text,\n  ts: Math.floor(Date.now()/1000),\n  business_phone: inItem.business_number || ''\n};\n\nif (meta) msg.meta = meta;\n\ng.messages.push(msg);\n\n// \u062a\u0646\u0638\u064a\u0641 \u0627\u0644\u0642\u062f\u064a\u0645 (\u0627\u0644\u0622\u0646 \u0622\u0645\u0646 - \u0645\u0627 \u0641\u064a \u0645\u0644\u0641\u0627\u062a \u062b\u0642\u064a\u0644\u0629)\nif (g.messages.length > 5000) {\n  g.messages.splice(0, g.messages.length - 5000);\n}\n\n// \u062d\u0641\u0638 \u062c\u0647\u0629 \u0627\u0644\u0627\u062a\u0635\u0627\u0644\nif (!g.contacts[key]) {\n  g.contacts[key] = {\n    platform: 'whatsapp',\n    account,\n    peer,\n    name: inItem.contact_name || peer\n  };\n} else {\n  const gotName = inItem.contact_name;\n  if (gotName && (!g.contacts[key].name || g.contacts[key].name === peer)) {\n    g.contacts[key].name = gotName;\n  }\n}\n\nreturn [{ json: inItem }];"
      },
      "typeVersion": 2
    },
    {
      "id": "98dc55ab-1a39-4c18-9c92-c848423f13ec",
      "name": "Code in JavaScript2",
      "type": "n8n-nodes-base.code",
      "position": [
        -848,
        624
      ],
      "parameters": {
        "jsCode": "// \u0627\u062d\u0641\u0638 \u0627\u0644\u062d\u0627\u0644\u0629 \u0639\u0646\u062f \u0643\u0644 \u0631\u0633\u0627\u0644\u0629/\u0643\u0628\u0633\u0629 \u0632\u0631\nconst inItem = $input.first().json;\nconst g = $getWorkflowStaticData('global');\n\n// \u0645\u0641\u062a\u0627\u062d \u0627\u0644\u062c\u0644\u0633\u0629 = \u0627\u0644\u062d\u0633\u0627\u0628:\u0627\u0644\u0631\u0642\u0645 (\u0623\u0648 \u0627\u0644\u0631\u0642\u0645 \u0625\u0630\u0627 \u0645\u0627 \u062a\u0648\u0641\u0631 \u0627\u0644\u062d\u0633\u0627\u0628)\nconst account = String(inItem.phone_number_id || '').trim();\nconst peer    = String(inItem.phone_number || '').trim();\nconst key = account && peer ? `${account}:${peer}` : (peer || 'unknown');\n\n// \u0627\u0644\u062d\u0627\u0644\u0629 \u0627\u0644\u062a\u0627\u0644\u064a\u0629 = id \u0627\u0644\u0632\u0631 \u0625\u0646 \u0648\u064f\u062c\u062f\u060c \u0648\u0625\u0644\u0627 \"typed_text\" \u0625\u0646 \u0641\u064a\u0647 \u0646\u0635\nconst nextState = inItem.interactive_reply\n  ? String(inItem.interactive_reply)\n  : (inItem.message_text ? 'typed_text' : 'unknown');\n\ng.sessions = g.sessions || {};\ng.sessions[key] = {\n  state: nextState,\n  name:  inItem.contact_name || '\u0639\u0645\u064a\u0644',\n  phone: inItem.phone_number || '',\n  account,\n  updatedAt: Date.now()\n};\n\nreturn [{ json: { ...inItem, session_state: nextState, session_key: key } }];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "a345c961-8fc9-4880-a06b-bc78ba0726d5",
      "name": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u0629 (\u0639\u0627\u0645)",
      "type": "n8n-nodes-base.code",
      "position": [
        528,
        336
      ],
      "parameters": {
        "jsCode": "const g = $getWorkflowStaticData('global');\ng.messages = g.messages || [];\ng.contacts = g.contacts || {};\n\nconst it = $input.first().json;\nconst account = String(it.phone_number_id || '').trim();\nconst peer = String(it.phone_number || '').trim();\nconst out = it._outgoing || {};\n\nif (!account || !peer || !out.type) {\n  return [{ json: { logged:false, reason:'missing account/peer/_outgoing', ...it } }];\n}\n\nconst key = `${account}:${peer}`;\nconst name = it.contact_name || g.contacts[key]?.name || peer;\nif (!g.contacts[key]) g.contacts[key] = { platform:'whatsapp', peer, account, name };\nelse g.contacts[key].name = name || g.contacts[key].name;\n\n// \ud83d\udd25 \u0627\u0644\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0631\u0626\u064a\u0633\u064a: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635 \u0627\u0644\u0641\u0639\u0644\u064a \u0645\u0646 payload\nlet displayText = '';\n\nif (out.type === 'text' && out.payload?.text?.body) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u064a\u0629 \u0639\u0627\u062f\u064a\u0629\n  displayText = out.payload.text.body;\n  \n} else if (out.type === 'interactive' && out.payload?.interactive) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0642\u0627\u0626\u0645\u0629 \u062a\u0641\u0627\u0639\u0644\u064a\u0629\n  const inter = out.payload.interactive;\n  \n  if (inter.body?.text) {\n    displayText = inter.body.text;\n  }\n  \n  // \u0625\u0636\u0627\u0641\u0629 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u0645\u0648\u062c\u0648\u062f\u0629\n  if (inter.action?.sections) {\n    displayText += '\\n\\n\ud83d\udccb \u0627\u0644\u062e\u064a\u0627\u0631\u0627\u062a \u0627\u0644\u0645\u062a\u0627\u062d\u0629:';\n    inter.action.sections.forEach(section => {\n      if (section.rows) {\n        section.rows.forEach(row => {\n          displayText += `\\n\u2022 ${row.title || row.id}`;\n        });\n      }\n    });\n  }\n  \n} else {\n  // Fallback \u0644\u0644\u0640 preview \u0625\u0630\u0627 \u0644\u0645 \u0646\u0633\u062a\u0637\u0639 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635\n  displayText = out.preview || '\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629';\n}\n\nconst msg = {\n  account, peer, name,\n  dir: 'out',\n  text: displayText,\n  ts: Math.floor(Date.now()/1000),\n  meta: { kind:'sent', type: out.type },\n  business_phone: it.business_number || ''\n};\n\ng.messages.push(msg);\nif (g.messages.length > 5000) g.messages.splice(0, g.messages.length - 5000);\n\nreturn [{ json: { logged:true, ...it } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "a7a5e592-dd4e-4bdf-b959-49a4ddbd81fc",
      "name": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0631\u0626\u064a\u0633\u064a\u0629",
      "type": "n8n-nodes-base.code",
      "position": [
        352,
        336
      ],
      "parameters": {
        "jsCode": "// \u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0631\u0626\u064a\u0633\u064a\u0629\nconst j = $json;\n\nconst payload = {\n  messaging_product: \"whatsapp\",\n  to: j.phone_number,\n  type: \"interactive\",\n  interactive: {\n    type: \"list\",\n    body: {\n      text: \"\u0645\u0631\u062d\u0628\u064b\u0627 \u0628\u0643 \ud83d\udc4b\\n\u0623\u0646\u0627 \u0627\u0644\u0628\u0648\u062a \u0627\u0644\u0630\u0643\u064a \u0644\u0645\u0643\u062a\u0628 \u0641\u0647\u062f \u0644\u0644\u0627\u0633\u062a\u0642\u062f\u0627\u0645 \ud83e\udd16\\n\u0633\u0623\u0643\u0648\u0646 \u0645\u0639\u0643 \u062e\u0637\u0648\u0629 \u0628\u062e\u0637\u0648\u0629 \u0644\u0645\u0633\u0627\u0639\u062f\u062a\u0643 \u0641\u064a \u0623\u064a \u0627\u0633\u062a\u0641\u0633\u0627\u0631 \u2764\ufe0f\u200d\ud83d\udd25\\n\\n\ud83d\udccc \u064a\u0645\u0643\u0646\u0643 \u0623\u064a\u0636\u064b\u0627 \u0632\u064a\u0627\u0631\u0629 \u0645\u0648\u0642\u0639\u0646\u0627 \u0644\u0644\u0627\u0633\u062a\u0641\u0627\u062f\u0629 \u0645\u0646 \u0627\u0644\u0639\u0631\u0648\u0636 \u0627\u0644\u062d\u0635\u0631\u064a\u0629:\\n\ud83c\udf10 https://fahadrec.com\\n\\n\u0627\u062e\u062a\u0631 \u0627\u0644\u062e\u062f\u0645\u0629 \u0627\u0644\u062a\u064a \u062a\u0646\u0627\u0633\u0628\u0643 \u0645\u0646 \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u062a\u0627\u0644\u064a\u0629:\"\n    },\n    footer: { text: \"\u0645\u0643\u062a\u0628 \u0641\u0647\u062f \u0644\u0644\u0627\u0633\u062a\u0642\u062f\u0627\u0645\" },\n    action: {\n      button: \"\u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0631\u0626\u064a\u0633\u064a\u0629\",\n      sections: [\n        {\n          title: \"\u0627\u0644\u062e\u062f\u0645\u0627\u062a \u0627\u0644\u0645\u062a\u0627\u062d\u0629\",\n          rows: [\n            { id: \"m_prices\",         title: \"\ud83d\udcb2 \u0627\u0644\u0623\u0633\u0639\u0627\u0631\",           description: \"\u0627\u0644\u0627\u0637\u0644\u0627\u0639 \u0639\u0644\u0649 \u0623\u0633\u0639\u0627\u0631 \u0627\u0644\u0627\u0633\u062a\u0642\u062f\u0627\u0645\" },\n            { id: \"m_new_request\",    title: \"\ud83d\udcdd \u062a\u0642\u062f\u064a\u0645 \u0637\u0644\u0628 \u062c\u062f\u064a\u062f\",    description: \"\u062a\u0642\u062f\u064a\u0645 \u0637\u0644\u0628 \u0627\u0633\u062a\u0642\u062f\u0627\u0645 \u062c\u062f\u064a\u062f\" },\n            { id: \"m_track_request\",  title: \"\ud83d\udd0e \u0645\u062a\u0627\u0628\u0639\u0629 \u0637\u0644\u0628 \u0633\u0627\u0628\u0642\",   description: \"\u0645\u062a\u0627\u0628\u0639\u0629 \u062d\u0627\u0644\u0629 \u0637\u0644\u0628\u0643\" },\n            { id: \"m_transfer\",       title: \"\ud83d\udd04 \u0646\u0642\u0644 \u0627\u0644\u062e\u0627\u062f\u0645\u0627\u062a\",      description: \"\u0637\u0644\u0628 \u0646\u0642\u0644 \u062e\u0627\u062f\u0645\u0627\u062a\" },\n            { id: \"m_translation\",    title: \"\ud83c\udf10 \u0627\u0644\u062a\u0631\u062c\u0645\u0629 \u0627\u0644\u0641\u0648\u0631\u064a\u0629\",   description: \"\u062e\u062f\u0645\u0629 \u0627\u0644\u062a\u0631\u062c\u0645\u0629 \u0627\u0644\u0641\u0648\u0631\u064a\u0629\" },\n            { id: \"m_complaints\",     title: \"\ud83d\udee0\ufe0f \u0627\u0644\u0634\u0643\u0627\u0648\u0649 \u0648\u0627\u0644\u062f\u0639\u0645\",    description: \"\u062a\u0642\u062f\u064a\u0645 \u0634\u0643\u0648\u0649 \u0623\u0648 \u0637\u0644\u0628 \u062f\u0639\u0645\" },\n            { id: \"m_about\",          title: \"\ud83c\udfe2 \u0639\u0646 \u0627\u0644\u0645\u0643\u062a\u0628\",         description: \"\u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0639\u0646 \u0627\u0644\u0645\u0643\u062a\u0628\" },\n            { id: \"m_talk_to_agent\",  title: \"\ud83e\udd1d \u0627\u0644\u062a\u062d\u062f\u062b \u0645\u0639 \u0645\u0648\u0638\u0641\",    description: \"\u0627\u0644\u062a\u0648\u0627\u0635\u0644 \u0645\u0639 \u062e\u062f\u0645\u0629 \u0627\u0644\u0639\u0645\u0644\u0627\u0621\" }\n          ]\n        }\n      ]\n    }\n  }\n};\n\n// \u0646\u0636\u064a\u0641 \u0648\u0635\u0641 \u0645\u062e\u062a\u0635\u0631 \u0644\u0644\u062f\u0627\u0634\u0628\u0648\u0631\u062f\nreturn [{\n  json: {\n    ...j,\n    _outgoing: {\n      type: \"interactive\",\n      preview: \"\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644: \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0631\u0626\u064a\u0633\u064a\u0629 (8 \u062e\u064a\u0627\u0631\u0627\u062a)\",\n      payload\n    }\n  }\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "a21a63b5-d408-4661-b4dc-100ab1cc9180",
      "name": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06291",
      "type": "n8n-nodes-base.code",
      "position": [
        880,
        848
      ],
      "parameters": {
        "jsCode": "const g = $getWorkflowStaticData('global');\ng.messages = g.messages || [];\ng.contacts = g.contacts || {};\n\nconst it = $input.first().json;\nconst account = String(it.phone_number_id || '').trim();\nconst peer = String(it.phone_number || '').trim();\nconst out = it._outgoing || {};\n\nif (!account || !peer || !out.type) {\n  return [{ json: { logged:false, reason:'missing account/peer/_outgoing', ...it } }];\n}\n\nconst key = `${account}:${peer}`;\nconst name = it.contact_name || g.contacts[key]?.name || peer;\nif (!g.contacts[key]) g.contacts[key] = { platform:'whatsapp', peer, account, name };\nelse g.contacts[key].name = name || g.contacts[key].name;\n\n// \ud83d\udd25 \u0627\u0644\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0631\u0626\u064a\u0633\u064a: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635 \u0627\u0644\u0641\u0639\u0644\u064a \u0645\u0646 payload\nlet displayText = '';\n\nif (out.type === 'text' && out.payload?.text?.body) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u064a\u0629 \u0639\u0627\u062f\u064a\u0629\n  displayText = out.payload.text.body;\n  \n} else if (out.type === 'interactive' && out.payload?.interactive) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0642\u0627\u0626\u0645\u0629 \u062a\u0641\u0627\u0639\u0644\u064a\u0629\n  const inter = out.payload.interactive;\n  \n  if (inter.body?.text) {\n    displayText = inter.body.text;\n  }\n  \n  // \u0625\u0636\u0627\u0641\u0629 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u0645\u0648\u062c\u0648\u062f\u0629\n  if (inter.action?.sections) {\n    displayText += '\\n\\n\ud83d\udccb \u0627\u0644\u062e\u064a\u0627\u0631\u0627\u062a \u0627\u0644\u0645\u062a\u0627\u062d\u0629:';\n    inter.action.sections.forEach(section => {\n      if (section.rows) {\n        section.rows.forEach(row => {\n          displayText += `\\n\u2022 ${row.title || row.id}`;\n        });\n      }\n    });\n  }\n  \n} else {\n  // Fallback \u0644\u0644\u0640 preview \u0625\u0630\u0627 \u0644\u0645 \u0646\u0633\u062a\u0637\u0639 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635\n  displayText = out.preview || '\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629';\n}\n\nconst msg = {\n  account, peer, name,\n  dir: 'out',\n  text: displayText,\n  ts: Math.floor(Date.now()/1000),\n  meta: { kind:'sent', type: out.type },\n  business_phone: it.business_number || ''\n};\n\ng.messages.push(msg);\nif (g.messages.length > 5000) g.messages.splice(0, g.messages.length - 5000);\n\nreturn [{ json: { logged:true, ...it } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "a1b7350b-e9a6-4923-92f1-f2365884fa26",
      "name": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0637\u0644\u0628 \u062c\u062f\u064a\u062f",
      "type": "n8n-nodes-base.code",
      "position": [
        736,
        848
      ],
      "parameters": {
        "jsCode": "const j = $json;\n\nconst payload = {\n  messaging_product: \"whatsapp\",\n  to: j.phone_number,\n  type: \"interactive\",\n  interactive: {\n    type: \"list\",\n    body: { text: \"\ud83d\udcdd \u062a\u0642\u062f\u064a\u0645 \u0637\u0644\u0628 \u062c\u062f\u064a\u062f\\n\ud83c\udf0d \u0627\u062e\u062a\u0631 \u0627\u0644\u062c\u0646\u0633\u064a\u0629:\" },\n    action: {\n      button: \"\u0627\u062e\u062a\u0631 \u0627\u0644\u062c\u0646\u0633\u064a\u0629\",\n      sections: [\n        {\n          title: \"\u0627\u0644\u062c\u0646\u0633\u064a\u0627\u062a\",\n          rows: [\n            { id: \"req_uganda\",      title: \"\ud83c\uddfa\ud83c\uddec \u0623\u0648\u063a\u0646\u062f\u0627\" },\n            { id: \"req_ethiopia\",    title: \"\ud83c\uddea\ud83c\uddf9 \u0625\u062b\u064a\u0648\u0628\u064a\u0627\" },\n            { id: \"req_philippines\", title: \"\ud83c\uddf5\ud83c\udded \u0627\u0644\u0641\u0644\u0628\u064a\u0646\" },\n            { id: \"req_burundi\",     title: \"\ud83c\udde7\ud83c\uddee \u0628\u0648\u0631\u0648\u0646\u062f\u064a\" },\n            { id: \"req_bangladesh\",  title: \"\ud83c\udde7\ud83c\udde9 \u0628\u0646\u063a\u0644\u0627\u062f\u064a\u0634\" },\n            { id: \"req_kenya\",       title: \"\ud83c\uddf0\ud83c\uddea \u0643\u064a\u0646\u064a\u0627\" }\n          ]\n        }\n      ]\n    }\n  }\n};\n\nreturn [{\n  json: {\n    ...j,\n    _outgoing: {\n      type: \"interactive\",\n      preview: \"\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644: \u0637\u0644\u0628 \u062c\u062f\u064a\u062f (\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u062c\u0646\u0633\u064a\u0627\u062a)\",\n      payload\n    }\n  }\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "d3d5c8e1-2a53-45c1-8df4-8f31a39d40c2",
      "name": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06292",
      "type": "n8n-nodes-base.code",
      "position": [
        880,
        1488
      ],
      "parameters": {
        "jsCode": "const g = $getWorkflowStaticData('global');\ng.messages = g.messages || [];\ng.contacts = g.contacts || {};\n\nconst it = $input.first().json;\nconst account = String(it.phone_number_id || '').trim();\nconst peer = String(it.phone_number || '').trim();\nconst out = it._outgoing || {};\n\nif (!account || !peer || !out.type) {\n  return [{ json: { logged:false, reason:'missing account/peer/_outgoing', ...it } }];\n}\n\nconst key = `${account}:${peer}`;\nconst name = it.contact_name || g.contacts[key]?.name || peer;\nif (!g.contacts[key]) g.contacts[key] = { platform:'whatsapp', peer, account, name };\nelse g.contacts[key].name = name || g.contacts[key].name;\n\n// \ud83d\udd25 \u0627\u0644\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0631\u0626\u064a\u0633\u064a: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635 \u0627\u0644\u0641\u0639\u0644\u064a \u0645\u0646 payload\nlet displayText = '';\n\nif (out.type === 'text' && out.payload?.text?.body) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u064a\u0629 \u0639\u0627\u062f\u064a\u0629\n  displayText = out.payload.text.body;\n  \n} else if (out.type === 'interactive' && out.payload?.interactive) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0642\u0627\u0626\u0645\u0629 \u062a\u0641\u0627\u0639\u0644\u064a\u0629\n  const inter = out.payload.interactive;\n  \n  if (inter.body?.text) {\n    displayText = inter.body.text;\n  }\n  \n  // \u0625\u0636\u0627\u0641\u0629 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u0645\u0648\u062c\u0648\u062f\u0629\n  if (inter.action?.sections) {\n    displayText += '\\n\\n\ud83d\udccb \u0627\u0644\u062e\u064a\u0627\u0631\u0627\u062a \u0627\u0644\u0645\u062a\u0627\u062d\u0629:';\n    inter.action.sections.forEach(section => {\n      if (section.rows) {\n        section.rows.forEach(row => {\n          displayText += `\\n\u2022 ${row.title || row.id}`;\n        });\n      }\n    });\n  }\n  \n} else {\n  // Fallback \u0644\u0644\u0640 preview \u0625\u0630\u0627 \u0644\u0645 \u0646\u0633\u062a\u0637\u0639 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635\n  displayText = out.preview || '\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629';\n}\n\nconst msg = {\n  account, peer, name,\n  dir: 'out',\n  text: displayText,\n  ts: Math.floor(Date.now()/1000),\n  meta: { kind:'sent', type: out.type },\n  business_phone: it.business_number || ''\n};\n\ng.messages.push(msg);\nif (g.messages.length > 5000) g.messages.splice(0, g.messages.length - 5000);\n\nreturn [{ json: { logged:true, ...it } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "e36bd2d1-d61f-46a2-a11e-9842305a7b9f",
      "name": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0634\u0643\u0648\u0649",
      "type": "n8n-nodes-base.code",
      "position": [
        704,
        1488
      ],
      "parameters": {
        "jsCode": "const j = $json;\n\nconst payload = {\n  messaging_product: \"whatsapp\",\n  to: j.phone_number,\n  type: \"interactive\",\n  interactive: {\n    type: \"list\",\n    body: { text: \"\ud83d\udee0\ufe0f \u0627\u0644\u0634\u0643\u0627\u0648\u0649 \u0648\u0627\u0644\u062f\u0639\u0645 \u0627\u0644\u0641\u0646\u064a\\n\\n\u0627\u062e\u062a\u0631 \u0646\u0648\u0639 \u0627\u0644\u0634\u0643\u0648\u0649:\" },\n    action: {\n      button: \"\u0627\u062e\u062a\u0631 \u0627\u0644\u0646\u0648\u0639\",\n      sections: [\n        {\n          title: \"\u0623\u0646\u0648\u0627\u0639 \u0627\u0644\u0634\u0643\u0627\u0648\u0649\",\n          rows: [\n            { id: \"complaint_worker\",    title: \"\ud83c\udfe0 \u0645\u0634\u0643\u0644\u0629 \u0645\u0639 \u0627\u0644\u0639\u0627\u0645\u0644\u0629\" },\n            { id: \"complaint_service\",   title: \"\ud83d\udccb \u0645\u0634\u0643\u0644\u0629 \u0641\u064a \u0627\u0644\u062e\u062f\u0645\u0629\" },\n            { id: \"complaint_delay\",     title: \"\u23f0 \u062a\u0623\u062e\u064a\u0631 \u0641\u064a \u0627\u0644\u0625\u062c\u0631\u0627\u0621\u0627\u062a\" },\n            { id: \"complaint_financial\", title: \"\ud83d\udcb0 \u0645\u0634\u0643\u0644\u0629 \u0645\u0627\u0644\u064a\u0629\" },\n            { id: \"complaint_other\",     title: \"\ud83d\udcdd \u0634\u0643\u0648\u0649 \u0623\u062e\u0631\u0649\" }\n          ]\n        }\n      ]\n    }\n  }\n};\n\nreturn [{\n  json: {\n    ...j,\n    _outgoing: {\n      type: \"interactive\",\n      preview: \"\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644: \u0627\u0644\u0634\u0643\u0627\u0648\u0649 (\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0623\u0646\u0648\u0627\u0639)\",\n      payload\n    }\n  }\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "17dc3370-372c-419e-ba0c-f0e6ca9fc72c",
      "name": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0637\u0644\u0628 \u0645\u062a\u0627\u0628\u0639\u0629",
      "type": "n8n-nodes-base.code",
      "position": [
        736,
        992
      ],
      "parameters": {
        "jsCode": "// \u062d\u0636\u0651\u0631 \u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u0651\u064a\u0629 \u062d\u0642\u064a\u0642\u064a\u0629 (\u0645\u0634 \u0628\u0633 preview)\nconst main = ($('sub route').item.json || {});\nif (!main.phone_number_id || !main.phone_number) {\n  throw new Error('missing phone_number_id/phone_number');\n}\n\nconst body = '\u0627\u0646\u062a\u0638\u0631 \u0642\u0644\u064a\u0644\u0627\u064b \u0633\u064a\u062a\u0645 \u0627\u0644\u0631\u062f \u0628\u062d\u0627\u0644\u0629 \u0637\u0644\u0628\u0643';\n\nreturn [{\n  json: {\n    ...$json,\n    phone_number: main.phone_number,\n    phone_number_id: main.phone_number_id,\n    _outgoing: {\n      type: \"text\",\n      preview: \"\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644: \u0645\u062a\u0627\u0628\u0639\u0629 \u0627\u0644\u0637\u0644\u0628 (\u0637\u0644\u0628 \u0631\u0642\u0645/\u0639\u0631\u0636 \u062d\u0627\u0644\u0629)\", // \u0644\u0644\u062f\u0627\u0634\u0628\u0648\u0631\u062f \u0641\u0642\u0637\n      payload: {\n        messaging_product: \"whatsapp\",\n        to: main.phone_number,\n        type: \"text\",\n        text: { body }\n      }\n    }\n  }\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "dc20acb5-d64e-4782-8a8c-760d11150704",
      "name": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0627\u0644\u062a\u0631\u062c\u0645\u0629",
      "type": "n8n-nodes-base.code",
      "position": [
        720,
        1344
      ],
      "parameters": {
        "jsCode": "const main = $('sub route').item.json;\n\nconst bodyText = `\ud83c\udf10 \u062e\u062f\u0645\u0629 \u0627\u0644\u062a\u0631\u062c\u0645\u0629 \u0627\u0644\u0641\u0648\u0631\u064a\u0629\n\n\ud83d\udde3\ufe0f \u062e\u062f\u0645\u0629 \u062a\u0631\u062c\u0645\u0629 \u0647\u0627\u062a\u0641\u064a\u0629 \u0645\u0639 \u0639\u0627\u0645\u0644\u062a\u0643 \u0627\u0644\u0645\u0646\u0632\u0644\u064a\u0629:\n* \u0627\u062a\u0635\u0644 \u0628\u0646\u0627 \u0648\u0636\u0639 \u0627\u0644\u0639\u0627\u0645\u0644\u0629 \u0639\u0644\u0649 \u0627\u0644\u0647\u0627\u062a\u0641\n* \u0645\u062a\u0631\u062c\u0645\u0648\u0646\u0627 \u064a\u062a\u0631\u062c\u0645\u0648\u0646 \u0643\u0644\u0627\u0645 \u0627\u0644\u0639\u0627\u0645\u0644\u0629 \u0641\u0648\u0631\u0627\u064b\n* \u0646\u0634\u0631\u062d \u0644\u0643 \u0645\u0627 \u062a\u0631\u064a\u062f\u0647 \u0627\u0644\u0639\u0627\u0645\u0644\u0629\n* \u0646\u0648\u0636\u062d \u0644\u0647\u0627 \u062a\u0639\u0644\u064a\u0645\u0627\u062a\u0643 \u0648\u0645\u062a\u0637\u0644\u0628\u0627\u062a\u0643\n* \u062d\u0644 \u0633\u0631\u064a\u0639 \u0644\u0644\u0645\u0634\u0627\u0643\u0644 \u0627\u0644\u0644\u063a\u0648\u064a\u0629\n\n\ud83c\udf0d \u0645\u062a\u0648\u0641\u0631 \u0644\u062c\u0645\u064a\u0639 \u0627\u0644\u062c\u0646\u0633\u064a\u0627\u062a:\n\ud83c\uddf5\ud83c\udded \u0627\u0644\u0641\u0644\u0628\u064a\u0646 \u2022 \ud83c\uddf1\ud83c\uddf0 \u0633\u0631\u064a\u0644\u0627\u0646\u0643\u0627 \u2022 \ud83c\udde7\ud83c\udde9 \u0628\u0646\u062c\u0644\u0627\u062f\u064a\u0634 \u2022 \ud83c\uddf0\ud83c\uddea \u0643\u064a\u0646\u064a\u0627\n\ud83c\uddfa\ud83c\uddec \u0623\u0648\u063a\u0646\u062f\u0627 \u2022 \ud83c\uddea\ud83c\uddf9 \u0625\u062b\u064a\u0648\u0628\u064a\u0627 \u2022 \ud83c\udde7\ud83c\uddee \u0628\u0648\u0631\u0648\u0646\u062f\u064a \u2022 \ud83c\uddee\ud83c\uddf3 \u0627\u0644\u0647\u0646\u062f\n\n\ud83d\udcde \u0644\u0644\u062d\u0635\u0648\u0644 \u0639\u0644\u0649 \u0627\u0644\u062e\u062f\u0645\u0629:\nhttps://wa.me/966501417950\n\n\ud83d\udd50 \u0645\u062a\u0627\u062d \u0637\u0648\u0627\u0644 \u0633\u0627\u0639\u0627\u062a \u0627\u0644\u0639\u0645\u0644\n\u0627\u0644\u0633\u0628\u062a - \u0627\u0644\u062e\u0645\u064a\u0633: 8\u0635 - 10\u0645`;\n\nconst payload = {\n  messaging_product: \"whatsapp\",\n  to: main.phone_number,\n  type: \"text\",\n  text: { body: bodyText }\n};\n\nreturn [{\n  json: {\n    ...$json,\n    phone_number: main.phone_number,\n    phone_number_id: main.phone_number_id,\n    contact_name: main.contact_name,\n    _outgoing: {\n      type: \"text\",\n      preview: \"\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644: \u0627\u0644\u062a\u0631\u062c\u0645\u0629 \u0627\u0644\u0641\u0648\u0631\u064a\u0629\",\n      payload\n    }\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "5bc9a8cb-b889-40bf-a72e-32c4ecb4e5e9",
      "name": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0644\u0627\u0644\u0645\u0643\u062a\u0628",
      "type": "n8n-nodes-base.code",
      "position": [
        736,
        1648
      ],
      "parameters": {
        "jsCode": "const main = $('sub route').item.json;\n\nconst bodyText = `\ud83c\udfe2 \u0645\u0643\u062a\u0628 \u0641\u0647\u062f \u0644\u0644\u0627\u0633\u062a\u0642\u062f\u0627\u0645\n\n\u2705 \u0645\u0643\u062a\u0628 \u0645\u0639\u062a\u0645\u062f \u0648\u0645\u0631\u062e\u0635 \u0645\u0646 \u0645\u0633\u0627\u0646\u062f \u0648\u0648\u0632\u0627\u0631\u0629 \u0627\u0644\u0639\u0645\u0644\n\n\ud83c\udf0d \u0646\u0633\u062a\u0642\u062f\u0645 \u0627\u0644\u0639\u0645\u0627\u0644\u0629 \u0627\u0644\u0645\u0646\u0632\u0644\u064a\u0629 \u0645\u0646 \u0627\u0644\u062c\u0646\u0633\u064a\u0627\u062a \u0627\u0644\u062a\u0627\u0644\u064a\u0629:\n1- \u0627\u0644\u0641\u0644\u0628\u064a\u0646 \ud83c\uddf5\ud83c\udded 12,999 SAR\n2- \u0633\u0631\u064a\u0644\u0627\u0646\u0643\u0627 \ud83c\uddf1\ud83c\uddf0 14,700 SAR\n3- \u0628\u0646\u062c\u0644\u0627\u062f\u064a\u0634 \ud83c\udde7\ud83c\udde9 7,900 SAR\n4- \u0643\u064a\u0646\u064a\u0627 \ud83c\uddf0\ud83c\uddea 6,400 SAR\n5- \u0623\u0648\u063a\u0646\u062f\u0627 \ud83c\uddfa\ud83c\uddec 4,900 SAR\n6- \u0625\u062b\u064a\u0648\u0628\u064a\u0627 \ud83c\uddea\ud83c\uddf9 4,490 SAR\n7- \u0628\u0648\u0631\u0648\u0646\u062f\u064a \ud83c\udde7\ud83c\uddee 5,900 SAR\n8- \u0627\u0644\u0647\u0646\u062f \ud83c\uddee\ud83c\uddf3 3,000 SAR\n\n\ud83d\udee1\ufe0f \u064a\u0648\u062c\u062f \u062a\u0623\u0645\u064a\u0646 \u0644\u0645\u062f\u0629 \u0633\u0646\u062a\u064a\u0646 \u0639\u0644\u0649 \u0627\u0644\u0639\u0645\u0627\u0644\u0629 \u0627\u0644\u0645\u0646\u0632\u0644\u064a\u0629 \u0641\u064a \u062d\u0627\u0644\u0629 \u0627\u0644\u0647\u0631\u0648\u0628 \u0623\u0648 \u0631\u0641\u0636 \u0627\u0644\u0639\u0645\u0644.\n\n\ud83d\udcde \u0644\u0644\u062a\u0648\u0627\u0635\u0644 \u0648\u0627\u0644\u0627\u0633\u062a\u0641\u0633\u0627\u0631:\n\u260e\ufe0f 0112333325\n\n\ud83c\udf10 fahadrec.com`;\n\nconst payload = {\n  messaging_product: \"whatsapp\",\n  to: main.phone_number,\n  type: \"text\",\n  text: { body: bodyText }\n};\n\nreturn [{\n  json: {\n    ...$json,\n    phone_number: main.phone_number,\n    phone_number_id: main.phone_number_id,\n    contact_name: main.contact_name,\n    _outgoing: {\n      type: \"text\",\n      preview: \"\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644: \u0639\u0646 \u0627\u0644\u0645\u0643\u062a\u0628\",\n      payload\n    }\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "c8332661-0e78-4d23-b4e0-574734618044",
      "name": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0646\u0642\u0644 \u0627\u0644\u062e\u0627\u062f\u0645\u0627\u062a",
      "type": "n8n-nodes-base.code",
      "position": [
        720,
        1168
      ],
      "parameters": {
        "jsCode": "const main = $('sub route').item.json;\n\nconst bodyText = `\ud83d\udd17 \u0631\u0627\u0628\u0637 \u0646\u0642\u0644 \u0627\u0644\u062e\u0627\u062f\u0645\u0627\u062a:\nhttps://fahadrec.com/workers/filter/tax/service-type:transfer-services/\n\n\ud83d\udca1 \u0633\u064a\u062a\u0645 \u062a\u0633\u062c\u064a\u0644 \u0632\u064a\u0627\u0631\u062a\u0643 \u0644\u0645\u062a\u0627\u0628\u0639\u0629 \u0627\u0647\u062a\u0645\u0627\u0645\u0643`;\n\nconst payload = {\n  messaging_product: \"whatsapp\",\n  to: main.phone_number,\n  type: \"text\",\n  text: { body: bodyText }\n};\n\nreturn [{\n  json: {\n    ...$json,\n    phone_number: main.phone_number,\n    phone_number_id: main.phone_number_id,\n    contact_name: main.contact_name,\n    _outgoing: {\n      type: \"text\",\n      preview: \"\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644: \u0631\u0627\u0628\u0637 \u0646\u0642\u0644 \u0627\u0644\u062e\u0627\u062f\u0645\u0627\u062a\",\n      payload\n    }\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "e269c4f8-3cde-4a43-b816-df79dcd3b703",
      "name": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0634\u0643\u0648\u0649 \u062a\u0645 \u0627\u0644\u062a\u0633\u062c\u064a\u0644",
      "type": "n8n-nodes-base.code",
      "position": [
        1696,
        1600
      ],
      "parameters": {
        "jsCode": "const main = $('sub route').item.json;\nconst data = $('\u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a').item.json;\n\nconst bodyText = `\u2705 \u062a\u0645 \u062a\u0633\u062c\u064a\u0644 \u0627\u0644\u0634\u0643\u0648\u0649 \u0627\u0644\u062e\u0627\u0635\u0629 \u0628\u0643 \u0628\u0646\u062c\u0627\u062d.\n\n\ud83d\udccc \u0646\u0648\u0639 \u0627\u0644\u0634\u0643\u0648\u0649: ${data.interactive_title}\n\n\u0641\u0631\u064a\u0642 \u0627\u0644\u062f\u0639\u0645 \u0633\u064a\u062a\u0648\u0627\u0635\u0644 \u0645\u0639\u0643 \u0642\u0631\u064a\u0628\u064b\u0627 \u0644\u0645\u0639\u0627\u0644\u062c\u0629 \u0627\u0644\u0645\u0634\u0643\u0644\u0629 \ud83d\ude4f`;\n\nconst payload = {\n  messaging_product: \"whatsapp\",\n  to: data.phone_number,\n  type: \"text\",\n  text: { body: bodyText }\n};\n\nreturn [{\n  json: {\n    ...$json,\n    phone_number: data.phone_number,\n    phone_number_id: data.phone_number_id,\n    contact_name: data.contact_name,\n    interactive_title: data.interactive_title,\n    _outgoing: {\n      type: \"text\",\n      preview: `\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644: \u062a\u0623\u0643\u064a\u062f \u062a\u0633\u062c\u064a\u0644 \u0627\u0644\u0634\u0643\u0648\u0649 (${data.interactive_title || ''})`,\n      payload\n    }\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "1f886e08-97d3-4cb1-b9dd-c6a7e1ebc784",
      "name": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06293",
      "type": "n8n-nodes-base.code",
      "position": [
        1856,
        1600
      ],
      "parameters": {
        "jsCode": "const g = $getWorkflowStaticData('global');\ng.messages = g.messages || [];\ng.contacts = g.contacts || {};\n\nconst it = $input.first().json;\nconst account = String(it.phone_number_id || '').trim();\nconst peer = String(it.phone_number || '').trim();\nconst out = it._outgoing || {};\n\nif (!account || !peer || !out.type) {\n  return [{ json: { logged:false, reason:'missing account/peer/_outgoing', ...it } }];\n}\n\nconst key = `${account}:${peer}`;\nconst name = it.contact_name || g.contacts[key]?.name || peer;\nif (!g.contacts[key]) g.contacts[key] = { platform:'whatsapp', peer, account, name };\nelse g.contacts[key].name = name || g.contacts[key].name;\n\n// \ud83d\udd25 \u0627\u0644\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0631\u0626\u064a\u0633\u064a: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635 \u0627\u0644\u0641\u0639\u0644\u064a \u0645\u0646 payload\nlet displayText = '';\n\nif (out.type === 'text' && out.payload?.text?.body) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u064a\u0629 \u0639\u0627\u062f\u064a\u0629\n  displayText = out.payload.text.body;\n  \n} else if (out.type === 'interactive' && out.payload?.interactive) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0642\u0627\u0626\u0645\u0629 \u062a\u0641\u0627\u0639\u0644\u064a\u0629\n  const inter = out.payload.interactive;\n  \n  if (inter.body?.text) {\n    displayText = inter.body.text;\n  }\n  \n  // \u0625\u0636\u0627\u0641\u0629 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u0645\u0648\u062c\u0648\u062f\u0629\n  if (inter.action?.sections) {\n    displayText += '\\n\\n\ud83d\udccb \u0627\u0644\u062e\u064a\u0627\u0631\u0627\u062a \u0627\u0644\u0645\u062a\u0627\u062d\u0629:';\n    inter.action.sections.forEach(section => {\n      if (section.rows) {\n        section.rows.forEach(row => {\n          displayText += `\\n\u2022 ${row.title || row.id}`;\n        });\n      }\n    });\n  }\n  \n} else {\n  // Fallback \u0644\u0644\u0640 preview \u0625\u0630\u0627 \u0644\u0645 \u0646\u0633\u062a\u0637\u0639 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635\n  displayText = out.preview || '\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629';\n}\n\nconst msg = {\n  account, peer, name,\n  dir: 'out',\n  text: displayText,\n  ts: Math.floor(Date.now()/1000),\n  meta: { kind:'sent', type: out.type },\n  business_phone: it.business_number || ''\n};\n\ng.messages.push(msg);\nif (g.messages.length > 5000) g.messages.splice(0, g.messages.length - 5000);\n\nreturn [{ json: { logged:true, ...it } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "0964c928-ad49-4765-a37a-c882d517c44e",
      "name": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06294",
      "type": "n8n-nodes-base.code",
      "position": [
        2032,
        144
      ],
      "parameters": {
        "jsCode": "const g = $getWorkflowStaticData('global');\ng.messages = g.messages || [];\ng.contacts = g.contacts || {};\n\nconst it = $input.first().json;\nconst account = String(it.phone_number_id || '').trim();\nconst peer = String(it.phone_number || '').trim();\nconst out = it._outgoing || {};\n\nif (!account || !peer || !out.type) {\n  return [{ json: { logged:false, reason:'missing account/peer/_outgoing', ...it } }];\n}\n\nconst key = `${account}:${peer}`;\nconst name = it.contact_name || g.contacts[key]?.name || peer;\nif (!g.contacts[key]) g.contacts[key] = { platform:'whatsapp', peer, account, name };\nelse g.contacts[key].name = name || g.contacts[key].name;\n\n// \ud83d\udd25 \u0627\u0644\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0631\u0626\u064a\u0633\u064a: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635 \u0627\u0644\u0641\u0639\u0644\u064a \u0645\u0646 payload\nlet displayText = '';\n\nif (out.type === 'text' && out.payload?.text?.body) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u064a\u0629 \u0639\u0627\u062f\u064a\u0629\n  displayText = out.payload.text.body;\n  \n} else if (out.type === 'interactive' && out.payload?.interactive) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0642\u0627\u0626\u0645\u0629 \u062a\u0641\u0627\u0639\u0644\u064a\u0629\n  const inter = out.payload.interactive;\n  \n  if (inter.body?.text) {\n    displayText = inter.body.text;\n  }\n  \n  // \u0625\u0636\u0627\u0641\u0629 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u0645\u0648\u062c\u0648\u062f\u0629\n  if (inter.action?.sections) {\n    displayText += '\\n\\n\ud83d\udccb \u0627\u0644\u062e\u064a\u0627\u0631\u0627\u062a \u0627\u0644\u0645\u062a\u0627\u062d\u0629:';\n    inter.action.sections.forEach(section => {\n      if (section.rows) {\n        section.rows.forEach(row => {\n          displayText += `\\n\u2022 ${row.title || row.id}`;\n        });\n      }\n    });\n  }\n  \n} else {\n  // Fallback \u0644\u0644\u0640 preview \u0625\u0630\u0627 \u0644\u0645 \u0646\u0633\u062a\u0637\u0639 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635\n  displayText = out.preview || '\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629';\n}\n\nconst msg = {\n  account, peer, name,\n  dir: 'out',\n  text: displayText,\n  ts: Math.floor(Date.now()/1000),\n  meta: { kind:'sent', type: out.type },\n  business_phone: it.business_number || ''\n};\n\ng.messages.push(msg);\nif (g.messages.length > 5000) g.messages.splice(0, g.messages.length - 5000);\n\nreturn [{ json: { logged:true, ...it } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "98db7671-98f3-4c69-b1e4-fcc362e87d5e",
      "name": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06295",
      "type": "n8n-nodes-base.code",
      "position": [
        880,
        992
      ],
      "parameters": {
        "jsCode": "const g = $getWorkflowStaticData('global');\ng.messages = g.messages || [];\ng.contacts = g.contacts || {};\n\nconst it = $input.first().json;\nconst account = String(it.phone_number_id || '').trim();\nconst peer = String(it.phone_number || '').trim();\nconst out = it._outgoing || {};\n\nif (!account || !peer || !out.type) {\n  return [{ json: { logged:false, reason:'missing account/peer/_outgoing', ...it } }];\n}\n\nconst key = `${account}:${peer}`;\nconst name = it.contact_name || g.contacts[key]?.name || peer;\nif (!g.contacts[key]) g.contacts[key] = { platform:'whatsapp', peer, account, name };\nelse g.contacts[key].name = name || g.contacts[key].name;\n\n// \ud83d\udd25 \u0627\u0644\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0631\u0626\u064a\u0633\u064a: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635 \u0627\u0644\u0641\u0639\u0644\u064a \u0645\u0646 payload\nlet displayText = '';\n\nif (out.type === 'text' && out.payload?.text?.body) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u064a\u0629 \u0639\u0627\u062f\u064a\u0629\n  displayText = out.payload.text.body;\n  \n} else if (out.type === 'interactive' && out.payload?.interactive) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0642\u0627\u0626\u0645\u0629 \u062a\u0641\u0627\u0639\u0644\u064a\u0629\n  const inter = out.payload.interactive;\n  \n  if (inter.body?.text) {\n    displayText = inter.body.text;\n  }\n  \n  // \u0625\u0636\u0627\u0641\u0629 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u0645\u0648\u062c\u0648\u062f\u0629\n  if (inter.action?.sections) {\n    displayText += '\\n\\n\ud83d\udccb \u0627\u0644\u062e\u064a\u0627\u0631\u0627\u062a \u0627\u0644\u0645\u062a\u0627\u062d\u0629:';\n    inter.action.sections.forEach(section => {\n      if (section.rows) {\n        section.rows.forEach(row => {\n          displayText += `\\n\u2022 ${row.title || row.id}`;\n        });\n      }\n    });\n  }\n  \n} else {\n  // Fallback \u0644\u0644\u0640 preview \u0625\u0630\u0627 \u0644\u0645 \u0646\u0633\u062a\u0637\u0639 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635\n  displayText = out.preview || '\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629';\n}\n\nconst msg = {\n  account, peer, name,\n  dir: 'out',\n  text: displayText,\n  ts: Math.floor(Date.now()/1000),\n  meta: { kind:'sent', type: out.type },\n  business_phone: it.business_number || ''\n};\n\ng.messages.push(msg);\nif (g.messages.length > 5000) g.messages.splice(0, g.messages.length - 5000);\n\nreturn [{ json: { logged:true, ...it } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "aec8b2a9-0dab-4557-8c94-aabc38b8227c",
      "name": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06296",
      "type": "n8n-nodes-base.code",
      "position": [
        880,
        1168
      ],
      "parameters": {
        "jsCode": "const g = $getWorkflowStaticData('global');\ng.messages = g.messages || [];\ng.contacts = g.contacts || {};\n\nconst it = $input.first().json;\nconst account = String(it.phone_number_id || '').trim();\nconst peer = String(it.phone_number || '').trim();\nconst out = it._outgoing || {};\n\nif (!account || !peer || !out.type) {\n  return [{ json: { logged:false, reason:'missing account/peer/_outgoing', ...it } }];\n}\n\nconst key = `${account}:${peer}`;\nconst name = it.contact_name || g.contacts[key]?.name || peer;\nif (!g.contacts[key]) g.contacts[key] = { platform:'whatsapp', peer, account, name };\nelse g.contacts[key].name = name || g.contacts[key].name;\n\n// \ud83d\udd25 \u0627\u0644\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0631\u0626\u064a\u0633\u064a: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635 \u0627\u0644\u0641\u0639\u0644\u064a \u0645\u0646 payload\nlet displayText = '';\n\nif (out.type === 'text' && out.payload?.text?.body) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u064a\u0629 \u0639\u0627\u062f\u064a\u0629\n  displayText = out.payload.text.body;\n  \n} else if (out.type === 'interactive' && out.payload?.interactive) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0642\u0627\u0626\u0645\u0629 \u062a\u0641\u0627\u0639\u0644\u064a\u0629\n  const inter = out.payload.interactive;\n  \n  if (inter.body?.text) {\n    displayText = inter.body.text;\n  }\n  \n  // \u0625\u0636\u0627\u0641\u0629 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u0645\u0648\u062c\u0648\u062f\u0629\n  if (inter.action?.sections) {\n    displayText += '\\n\\n\ud83d\udccb \u0627\u0644\u062e\u064a\u0627\u0631\u0627\u062a \u0627\u0644\u0645\u062a\u0627\u062d\u0629:';\n    inter.action.sections.forEach(section => {\n      if (section.rows) {\n        section.rows.forEach(row => {\n          displayText += `\\n\u2022 ${row.title || row.id}`;\n        });\n      }\n    });\n  }\n  \n} else {\n  // Fallback \u0644\u0644\u0640 preview \u0625\u0630\u0627 \u0644\u0645 \u0646\u0633\u062a\u0637\u0639 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635\n  displayText = out.preview || '\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629';\n}\n\nconst msg = {\n  account, peer, name,\n  dir: 'out',\n  text: displayText,\n  ts: Math.floor(Date.now()/1000),\n  meta: { kind:'sent', type: out.type },\n  business_phone: it.business_number || ''\n};\n\ng.messages.push(msg);\nif (g.messages.length > 5000) g.messages.splice(0, g.messages.length - 5000);\n\nreturn [{ json: { logged:true, ...it } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "25716894-6cf2-4e1f-9510-4066b5c9c2a7",
      "name": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06297",
      "type": "n8n-nodes-base.code",
      "position": [
        880,
        1344
      ],
      "parameters": {
        "jsCode": "const g = $getWorkflowStaticData('global');\ng.messages = g.messages || [];\ng.contacts = g.contacts || {};\n\nconst it = $input.first().json;\nconst account = String(it.phone_number_id || '').trim();\nconst peer = String(it.phone_number || '').trim();\nconst out = it._outgoing || {};\n\nif (!account || !peer || !out.type) {\n  return [{ json: { logged:false, reason:'missing account/peer/_outgoing', ...it } }];\n}\n\nconst key = `${account}:${peer}`;\nconst name = it.contact_name || g.contacts[key]?.name || peer;\nif (!g.contacts[key]) g.contacts[key] = { platform:'whatsapp', peer, account, name };\nelse g.contacts[key].name = name || g.contacts[key].name;\n\n// \ud83d\udd25 \u0627\u0644\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0631\u0626\u064a\u0633\u064a: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635 \u0627\u0644\u0641\u0639\u0644\u064a \u0645\u0646 payload\nlet displayText = '';\n\nif (out.type === 'text' && out.payload?.text?.body) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u064a\u0629 \u0639\u0627\u062f\u064a\u0629\n  displayText = out.payload.text.body;\n  \n} else if (out.type === 'interactive' && out.payload?.interactive) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0642\u0627\u0626\u0645\u0629 \u062a\u0641\u0627\u0639\u0644\u064a\u0629\n  const inter = out.payload.interactive;\n  \n  if (inter.body?.text) {\n    displayText = inter.body.text;\n  }\n  \n  // \u0625\u0636\u0627\u0641\u0629 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u0645\u0648\u062c\u0648\u062f\u0629\n  if (inter.action?.sections) {\n    displayText += '\\n\\n\ud83d\udccb \u0627\u0644\u062e\u064a\u0627\u0631\u0627\u062a \u0627\u0644\u0645\u062a\u0627\u062d\u0629:';\n    inter.action.sections.forEach(section => {\n      if (section.rows) {\n        section.rows.forEach(row => {\n          displayText += `\\n\u2022 ${row.title || row.id}`;\n        });\n      }\n    });\n  }\n  \n} else {\n  // Fallback \u0644\u0644\u0640 preview \u0625\u0630\u0627 \u0644\u0645 \u0646\u0633\u062a\u0637\u0639 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635\n  displayText = out.preview || '\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629';\n}\n\nconst msg = {\n  account, peer, name,\n  dir: 'out',\n  text: displayText,\n  ts: Math.floor(Date.now()/1000),\n  meta: { kind:'sent', type: out.type },\n  business_phone: it.business_number || ''\n};\n\ng.messages.push(msg);\nif (g.messages.length > 5000) g.messages.splice(0, g.messages.length - 5000);\n\nreturn [{ json: { logged:true, ...it } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "1f839807-5524-4f66-a527-5e385df64687",
      "name": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06298",
      "type": "n8n-nodes-base.code",
      "position": [
        880,
        1648
      ],
      "parameters": {
        "jsCode": "const g = $getWorkflowStaticData('global');\ng.messages = g.messages || [];\ng.contacts = g.contacts || {};\n\nconst it = $input.first().json;\nconst account = String(it.phone_number_id || '').trim();\nconst peer = String(it.phone_number || '').trim();\nconst out = it._outgoing || {};\n\nif (!account || !peer || !out.type) {\n  return [{ json: { logged:false, reason:'missing account/peer/_outgoing', ...it } }];\n}\n\nconst key = `${account}:${peer}`;\nconst name = it.contact_name || g.contacts[key]?.name || peer;\nif (!g.contacts[key]) g.contacts[key] = { platform:'whatsapp', peer, account, name };\nelse g.contacts[key].name = name || g.contacts[key].name;\n\n// \ud83d\udd25 \u0627\u0644\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0631\u0626\u064a\u0633\u064a: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635 \u0627\u0644\u0641\u0639\u0644\u064a \u0645\u0646 payload\nlet displayText = '';\n\nif (out.type === 'text' && out.payload?.text?.body) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u064a\u0629 \u0639\u0627\u062f\u064a\u0629\n  displayText = out.payload.text.body;\n  \n} else if (out.type === 'interactive' && out.payload?.interactive) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0642\u0627\u0626\u0645\u0629 \u062a\u0641\u0627\u0639\u0644\u064a\u0629\n  const inter = out.payload.interactive;\n  \n  if (inter.body?.text) {\n    displayText = inter.body.text;\n  }\n  \n  // \u0625\u0636\u0627\u0641\u0629 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u0645\u0648\u062c\u0648\u062f\u0629\n  if (inter.action?.sections) {\n    displayText += '\\n\\n\ud83d\udccb \u0627\u0644\u062e\u064a\u0627\u0631\u0627\u062a \u0627\u0644\u0645\u062a\u0627\u062d\u0629:';\n    inter.action.sections.forEach(section => {\n      if (section.rows) {\n        section.rows.forEach(row => {\n          displayText += `\\n\u2022 ${row.title || row.id}`;\n        });\n      }\n    });\n  }\n  \n} else {\n  // Fallback \u0644\u0644\u0640 preview \u0625\u0630\u0627 \u0644\u0645 \u0646\u0633\u062a\u0637\u0639 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635\n  displayText = out.preview || '\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629';\n}\n\nconst msg = {\n  account, peer, name,\n  dir: 'out',\n  text: displayText,\n  ts: Math.floor(Date.now()/1000),\n  meta: { kind:'sent', type: out.type },\n  business_phone: it.business_number || ''\n};\n\ng.messages.push(msg);\nif (g.messages.length > 5000) g.messages.splice(0, g.messages.length - 5000);\n\nreturn [{ json: { logged:true, ...it } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "cd04a734-ec52-48a5-bde7-41645b0c5898",
      "name": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06299",
      "type": "n8n-nodes-base.code",
      "position": [
        880,
        1792
      ],
      "parameters": {
        "jsCode": "const g = $getWorkflowStaticData('global');\ng.messages = g.messages || [];\ng.contacts = g.contacts || {};\n\nconst it = $input.first().json;\nconst account = String(it.phone_number_id || '').trim();\nconst peer = String(it.phone_number || '').trim();\nconst out = it._outgoing || {};\n\nif (!account || !peer || !out.type) {\n  return [{ json: { logged:false, reason:'missing account/peer/_outgoing', ...it } }];\n}\n\nconst key = `${account}:${peer}`;\nconst name = it.contact_name || g.contacts[key]?.name || peer;\nif (!g.contacts[key]) g.contacts[key] = { platform:'whatsapp', peer, account, name };\nelse g.contacts[key].name = name || g.contacts[key].name;\n\n// \ud83d\udd25 \u0627\u0644\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0631\u0626\u064a\u0633\u064a: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635 \u0627\u0644\u0641\u0639\u0644\u064a \u0645\u0646 payload\nlet displayText = '';\n\nif (out.type === 'text' && out.payload?.text?.body) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u064a\u0629 \u0639\u0627\u062f\u064a\u0629\n  displayText = out.payload.text.body;\n  \n} else if (out.type === 'interactive' && out.payload?.interactive) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0642\u0627\u0626\u0645\u0629 \u062a\u0641\u0627\u0639\u0644\u064a\u0629\n  const inter = out.payload.interactive;\n  \n  if (inter.body?.text) {\n    displayText = inter.body.text;\n  }\n  \n  // \u0625\u0636\u0627\u0641\u0629 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u0645\u0648\u062c\u0648\u062f\u0629\n  if (inter.action?.sections) {\n    displayText += '\\n\\n\ud83d\udccb \u0627\u0644\u062e\u064a\u0627\u0631\u0627\u062a \u0627\u0644\u0645\u062a\u0627\u062d\u0629:';\n    inter.action.sections.forEach(section => {\n      if (section.rows) {\n        section.rows.forEach(row => {\n          displayText += `\\n\u2022 ${row.title || row.id}`;\n        });\n      }\n    });\n  }\n  \n} else {\n  // Fallback \u0644\u0644\u0640 preview \u0625\u0630\u0627 \u0644\u0645 \u0646\u0633\u062a\u0637\u0639 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635\n  displayText = out.preview || '\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629';\n}\n\nconst msg = {\n  account, peer, name,\n  dir: 'out',\n  text: displayText,\n  ts: Math.floor(Date.now()/1000),\n  meta: { kind:'sent', type: out.type },\n  business_phone: it.business_number || ''\n};\n\ng.messages.push(msg);\nif (g.messages.length > 5000) g.messages.splice(0, g.messages.length - 5000);\n\nreturn [{ json: { logged:true, ...it } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "c93b47e9-21dd-4c47-8543-7aacedac7e5f",
      "name": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u062910",
      "type": "n8n-nodes-base.code",
      "position": [
        2736,
        400
      ],
      "parameters": {
        "jsCode": "const g = $getWorkflowStaticData('global');\ng.messages = g.messages || [];\ng.contacts = g.contacts || {};\n\nconst it = $input.first().json;\nconst account = String(it.phone_number_id || '').trim();\nconst peer = String(it.phone_number || '').trim();\nconst out = it._outgoing || {};\n\nif (!account || !peer || !out.type) {\n  return [{ json: { logged:false, reason:'missing account/peer/_outgoing', ...it } }];\n}\n\nconst key = `${account}:${peer}`;\nconst name = it.contact_name || g.contacts[key]?.name || peer;\nif (!g.contacts[key]) g.contacts[key] = { platform:'whatsapp', peer, account, name };\nelse g.contacts[key].name = name || g.contacts[key].name;\n\n// \ud83d\udd25 \u0627\u0644\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0631\u0626\u064a\u0633\u064a: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635 \u0627\u0644\u0641\u0639\u0644\u064a \u0645\u0646 payload\nlet displayText = '';\n\nif (out.type === 'text' && out.payload?.text?.body) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u064a\u0629 \u0639\u0627\u062f\u064a\u0629\n  displayText = out.payload.text.body;\n  \n} else if (out.type === 'interactive' && out.payload?.interactive) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0642\u0627\u0626\u0645\u0629 \u062a\u0641\u0627\u0639\u0644\u064a\u0629\n  const inter = out.payload.interactive;\n  \n  if (inter.body?.text) {\n    displayText = inter.body.text;\n  }\n  \n  // \u0625\u0636\u0627\u0641\u0629 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u0645\u0648\u062c\u0648\u062f\u0629\n  if (inter.action?.sections) {\n    displayText += '\\n\\n\ud83d\udccb \u0627\u0644\u062e\u064a\u0627\u0631\u0627\u062a \u0627\u0644\u0645\u062a\u0627\u062d\u0629:';\n    inter.action.sections.forEach(section => {\n      if (section.rows) {\n        section.rows.forEach(row => {\n          displayText += `\\n\u2022 ${row.title || row.id}`;\n        });\n      }\n    });\n  }\n  \n} else {\n  // Fallback \u0644\u0644\u0640 preview \u0625\u0630\u0627 \u0644\u0645 \u0646\u0633\u062a\u0637\u0639 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635\n  displayText = out.preview || '\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629';\n}\n\nconst msg = {\n  account, peer, name,\n  dir: 'out',\n  text: displayText,\n  ts: Math.floor(Date.now()/1000),\n  meta: { kind:'sent', type: out.type },\n  business_phone: it.business_number || ''\n};\n\ng.messages.push(msg);\nif (g.messages.length > 5000) g.messages.splice(0, g.messages.length - 5000);\n\nreturn [{ json: { logged:true, ...it } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "53bfdbe1-1e6f-4f33-a78d-cb68b635bd39",
      "name": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u062913",
      "type": "n8n-nodes-base.code",
      "position": [
        2368,
        1328
      ],
      "parameters": {
        "jsCode": "const g = $getWorkflowStaticData('global');\ng.messages = g.messages || [];\ng.contacts = g.contacts || {};\n\nconst it = $input.first().json;\nconst account = String(it.phone_number_id || '').trim();\nconst peer = String(it.phone_number || '').trim();\nconst out = it._outgoing || {};\n\nif (!account || !peer || !out.type) {\n  return [{ json: { logged:false, reason:'missing account/peer/_outgoing', ...it } }];\n}\n\nconst key = `${account}:${peer}`;\nconst name = it.contact_name || g.contacts[key]?.name || peer;\nif (!g.contacts[key]) g.contacts[key] = { platform:'whatsapp', peer, account, name };\nelse g.contacts[key].name = name || g.contacts[key].name;\n\n// \ud83d\udd25 \u0627\u0644\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0631\u0626\u064a\u0633\u064a: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635 \u0627\u0644\u0641\u0639\u0644\u064a \u0645\u0646 payload\nlet displayText = '';\n\nif (out.type === 'text' && out.payload?.text?.body) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u064a\u0629 \u0639\u0627\u062f\u064a\u0629\n  displayText = out.payload.text.body;\n  \n} else if (out.type === 'interactive' && out.payload?.interactive) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0642\u0627\u0626\u0645\u0629 \u062a\u0641\u0627\u0639\u0644\u064a\u0629\n  const inter = out.payload.interactive;\n  \n  if (inter.body?.text) {\n    displayText = inter.body.text;\n  }\n  \n  // \u0625\u0636\u0627\u0641\u0629 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u0645\u0648\u062c\u0648\u062f\u0629\n  if (inter.action?.sections) {\n    displayText += '\\n\\n\ud83d\udccb \u0627\u0644\u062e\u064a\u0627\u0631\u0627\u062a \u0627\u0644\u0645\u062a\u0627\u062d\u0629:';\n    inter.action.sections.forEach(section => {\n      if (section.rows) {\n        section.rows.forEach(row => {\n          displayText += `\\n\u2022 ${row.title || row.id}`;\n        });\n      }\n    });\n  }\n  \n} else {\n  // Fallback \u0644\u0644\u0640 preview \u0625\u0630\u0627 \u0644\u0645 \u0646\u0633\u062a\u0637\u0639 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635\n  displayText = out.preview || '\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629';\n}\n\nconst msg = {\n  account, peer, name,\n  dir: 'out',\n  text: displayText,\n  ts: Math.floor(Date.now()/1000),\n  meta: { kind:'sent', type: out.type },\n  business_phone: it.business_number || ''\n};\n\ng.messages.push(msg);\nif (g.messages.length > 5000) g.messages.splice(0, g.messages.length - 5000);\n\nreturn [{ json: { logged:true, ...it } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "1ee89d43-f92b-4e04-9d01-396f58a94f4d",
      "name": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u062914",
      "type": "n8n-nodes-base.code",
      "position": [
        1936,
        400
      ],
      "parameters": {
        "jsCode": "const g = $getWorkflowStaticData('global');\ng.messages = g.messages || [];\ng.contacts = g.contacts || {};\n\nconst it = $input.first().json;\nconst account = String(it.phone_number_id || '').trim();\nconst peer = String(it.phone_number || '').trim();\nconst out = it._outgoing || {};\n\nif (!account || !peer || !out.type) {\n  return [{ json: { logged:false, reason:'missing account/peer/_outgoing', ...it } }];\n}\n\nconst key = `${account}:${peer}`;\nconst name = it.contact_name || g.contacts[key]?.name || peer;\nif (!g.contacts[key]) g.contacts[key] = { platform:'whatsapp', peer, account, name };\nelse g.contacts[key].name = name || g.contacts[key].name;\n\n// \ud83d\udd25 \u0627\u0644\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0631\u0626\u064a\u0633\u064a: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635 \u0627\u0644\u0641\u0639\u0644\u064a \u0645\u0646 payload\nlet displayText = '';\n\nif (out.type === 'text' && out.payload?.text?.body) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u064a\u0629 \u0639\u0627\u062f\u064a\u0629\n  displayText = out.payload.text.body;\n  \n} else if (out.type === 'interactive' && out.payload?.interactive) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0642\u0627\u0626\u0645\u0629 \u062a\u0641\u0627\u0639\u0644\u064a\u0629\n  const inter = out.payload.interactive;\n  \n  if (inter.body?.text) {\n    displayText = inter.body.text;\n  }\n  \n  // \u0625\u0636\u0627\u0641\u0629 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u0645\u0648\u062c\u0648\u062f\u0629\n  if (inter.action?.sections) {\n    displayText += '\\n\\n\ud83d\udccb \u0627\u0644\u062e\u064a\u0627\u0631\u0627\u062a \u0627\u0644\u0645\u062a\u0627\u062d\u0629:';\n    inter.action.sections.forEach(section => {\n      if (section.rows) {\n        section.rows.forEach(row => {\n          displayText += `\\n\u2022 ${row.title || row.id}`;\n        });\n      }\n    });\n  }\n  \n} else {\n  // Fallback \u0644\u0644\u0640 preview \u0625\u0630\u0627 \u0644\u0645 \u0646\u0633\u062a\u0637\u0639 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635\n  displayText = out.preview || '\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629';\n}\n\nconst msg = {\n  account, peer, name,\n  dir: 'out',\n  text: displayText,\n  ts: Math.floor(Date.now()/1000),\n  meta: { kind:'sent', type: out.type },\n  business_phone: it.business_number || ''\n};\n\ng.messages.push(msg);\nif (g.messages.length > 5000) g.messages.splice(0, g.messages.length - 5000);\n\nreturn [{ json: { logged:true, ...it } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "e67345b5-d125-4ae5-849f-16155de93d7b",
      "name": "\u062a\u062d\u0636\u064a\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 - \u0627\u0644\u0623\u0633\u0639\u0627\u0631",
      "type": "n8n-nodes-base.code",
      "position": [
        1872,
        144
      ],
      "parameters": {
        "jsCode": "const textPayload = (to, body) => ({\n  messaging_product: \"whatsapp\",\n  to, type: \"text\", text: { body }\n});\nconst main = ($('sub route').item.json || {});\nif (!main.phone_number_id || !main.phone_number) throw new Error('missing phone');\nconst body = `\u0633\u0639\u0631 \u0627\u0644\u0627\u0633\u062a\u0642\u062f\u0627\u0645 \u0645\u0646 ${$json['country']} \u0647\u0648: ${$json['price']}.`;\n\nreturn [{\n  json: {\n    ...$json,\n    phone_number: main.phone_number,\n    phone_number_id: main.phone_number_id,\n    _outgoing: {\n      type:'text',\n      preview:'\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644: \u0633\u0639\u0631 \u0627\u0644\u0627\u0633\u062a\u0642\u062f\u0627\u0645 (\u062d\u0633\u0628 \u0627\u0644\u062c\u0646\u0633\u064a\u0629)',\n      payload: textPayload(main.phone_number, body)\n    }\n  }\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "a24990c0-5db1-4870-9009-ed9082c24f6a",
      "name": "\u062a\u062d\u0636\u064a\u0631 \u0625\u0631\u0633\u0627\u0644 - \u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0633\u064a\u0631 \u0627\u0644\u0630\u0627\u062a\u064a\u0629",
      "type": "n8n-nodes-base.code",
      "position": [
        1792,
        400
      ],
      "parameters": {
        "jsCode": "const main = $('sub route').item.json;\nconst curr = $json;\n\nconst bodyText = `\u2705 \u062a\u0645 \u0627\u062e\u062a\u064a\u0627\u0631 \u0627\u0644\u062c\u0646\u0633\u064a\u0629: ${curr['\u0627\u0644\u0628\u0644\u062f']}\n\n\ud83d\udcc4 \u0631\u0627\u0628\u0637 \u0627\u0644\u0633\u064a\u0631 \u0627\u0644\u0630\u0627\u062a\u064a\u0629 \u0644\u0644\u062c\u0646\u0633\u064a\u0629 \u0644\u0644\u0637\u0644\u0628 \u0627\u0644\u062c\u062f\u064a\u062f: ${curr['\u0627\u0644\u0633\u064a\u0631\u0629']} \n\n\ud83d\udca1 \u0633\u064a\u062a\u0645 \u062a\u0633\u062c\u064a\u0644 \u0632\u064a\u0627\u0631\u062a\u0643 \u0644\u0645\u062a\u0627\u0628\u0639\u0629 \u0627\u0647\u062a\u0645\u0627\u0645\u0643`;\n\nconst payload = {\n  messaging_product: \"whatsapp\",\n  to: main.phone_number,\n  type: \"text\",\n  text: { body: bodyText }\n};\n\nreturn [{\n  json: {\n    ...curr,\n    phone_number: main.phone_number,\n    phone_number_id: main.phone_number_id,\n    contact_name: main.contact_name,\n    _outgoing: {\n      type: \"text\",\n      preview: \"\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644: \u0631\u0627\u0628\u0637 \u0627\u0644\u0633\u064a\u0631 \u0627\u0644\u0630\u0627\u062a\u064a\u0629\",\n      payload\n    }\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "f68d898f-4fb1-4f8c-9c16-7dd1681963ce",
      "name": "\u062a\u062d\u0636\u064a\u0631 \u0625\u0631\u0633\u0627\u0644 - \u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0633\u064a\u0631 \u0627\u0644\u0630\u0627\u062a\u064a\u06291",
      "type": "n8n-nodes-base.code",
      "position": [
        2576,
        400
      ],
      "parameters": {
        "jsCode": "const main = $('sub route').item.json;\n\nconst bodyText = \"\u062a\u0645 \u0627\u0633\u062a\u0644\u0627\u0645 \u0637\u0644\u0628\u0643\u060c \u0648\u0633\u064a\u062a\u0648\u0627\u0635\u0644 \u0645\u0639\u0643 \u0627\u0644\u0645\u0648\u0638\u0641 \u0642\u0631\u064a\u0628\u064b\u0627\";\n\nconst payload = {\n  messaging_product: \"whatsapp\",\n  to: main.phone_number,\n  type: \"text\",\n  text: { body: bodyText }\n};\n\nreturn [{\n  json: {\n    ...$json,\n    phone_number: main.phone_number,\n    phone_number_id: main.phone_number_id,\n    contact_name: main.contact_name,\n    _outgoing: {\n      type: \"text\",\n      preview: \"\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644: \u062a\u0623\u0643\u064a\u062f \u0627\u0633\u062a\u0644\u0627\u0645 \u0627\u0644\u0637\u0644\u0628\",\n      payload\n    }\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "e4da64dd-da3a-405c-b295-2d0781341f04",
      "name": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u062911",
      "type": "n8n-nodes-base.code",
      "position": [
        2112,
        624
      ],
      "parameters": {
        "jsCode": "const g = $getWorkflowStaticData('global');\ng.messages = g.messages || [];\ng.contacts = g.contacts || {};\n\nconst it = $input.first().json;\nconst account = String(it.phone_number_id || '').trim();\nconst peer = String(it.phone_number || '').trim();\nconst out = it._outgoing || {};\n\nif (!account || !peer || !out.type) {\n  return [{ json: { logged:false, reason:'missing account/peer/_outgoing', ...it } }];\n}\n\nconst key = `${account}:${peer}`;\nconst name = it.contact_name || g.contacts[key]?.name || peer;\nif (!g.contacts[key]) g.contacts[key] = { platform:'whatsapp', peer, account, name };\nelse g.contacts[key].name = name || g.contacts[key].name;\n\n// \ud83d\udd25 \u0627\u0644\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0631\u0626\u064a\u0633\u064a: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635 \u0627\u0644\u0641\u0639\u0644\u064a \u0645\u0646 payload\nlet displayText = '';\n\nif (out.type === 'text' && out.payload?.text?.body) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u064a\u0629 \u0639\u0627\u062f\u064a\u0629\n  displayText = out.payload.text.body;\n  \n} else if (out.type === 'interactive' && out.payload?.interactive) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0642\u0627\u0626\u0645\u0629 \u062a\u0641\u0627\u0639\u0644\u064a\u0629\n  const inter = out.payload.interactive;\n  \n  if (inter.body?.text) {\n    displayText = inter.body.text;\n  }\n  \n  // \u0625\u0636\u0627\u0641\u0629 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u0645\u0648\u062c\u0648\u062f\u0629\n  if (inter.action?.sections) {\n    displayText += '\\n\\n\ud83d\udccb \u0627\u0644\u062e\u064a\u0627\u0631\u0627\u062a \u0627\u0644\u0645\u062a\u0627\u062d\u0629:';\n    inter.action.sections.forEach(section => {\n      if (section.rows) {\n        section.rows.forEach(row => {\n          displayText += `\\n\u2022 ${row.title || row.id}`;\n        });\n      }\n    });\n  }\n  \n} else {\n  // Fallback \u0644\u0644\u0640 preview \u0625\u0630\u0627 \u0644\u0645 \u0646\u0633\u062a\u0637\u0639 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635\n  displayText = out.preview || '\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629';\n}\n\nconst msg = {\n  account, peer, name,\n  dir: 'out',\n  text: displayText,\n  ts: Math.floor(Date.now()/1000),\n  meta: { kind:'sent', type: out.type },\n  business_phone: it.business_number || ''\n};\n\ng.messages.push(msg);\nif (g.messages.length > 5000) g.messages.splice(0, g.messages.length - 5000);\n\nreturn [{ json: { logged:true, ...it } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "4ea07fbc-0fd0-4e94-b7c7-0c32876a1531",
      "name": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u062912",
      "type": "n8n-nodes-base.code",
      "position": [
        2112,
        832
      ],
      "parameters": {
        "jsCode": "const g = $getWorkflowStaticData('global');\ng.messages = g.messages || [];\ng.contacts = g.contacts || {};\n\nconst it = $input.first().json;\nconst account = String(it.phone_number_id || '').trim();\nconst peer = String(it.phone_number || '').trim();\nconst out = it._outgoing || {};\n\nif (!account || !peer || !out.type) {\n  return [{ json: { logged:false, reason:'missing account/peer/_outgoing', ...it } }];\n}\n\nconst key = `${account}:${peer}`;\nconst name = it.contact_name || g.contacts[key]?.name || peer;\nif (!g.contacts[key]) g.contacts[key] = { platform:'whatsapp', peer, account, name };\nelse g.contacts[key].name = name || g.contacts[key].name;\n\n// \ud83d\udd25 \u0627\u0644\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0631\u0626\u064a\u0633\u064a: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635 \u0627\u0644\u0641\u0639\u0644\u064a \u0645\u0646 payload\nlet displayText = '';\n\nif (out.type === 'text' && out.payload?.text?.body) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u064a\u0629 \u0639\u0627\u062f\u064a\u0629\n  displayText = out.payload.text.body;\n  \n} else if (out.type === 'interactive' && out.payload?.interactive) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0642\u0627\u0626\u0645\u0629 \u062a\u0641\u0627\u0639\u0644\u064a\u0629\n  const inter = out.payload.interactive;\n  \n  if (inter.body?.text) {\n    displayText = inter.body.text;\n  }\n  \n  // \u0625\u0636\u0627\u0641\u0629 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u0645\u0648\u062c\u0648\u062f\u0629\n  if (inter.action?.sections) {\n    displayText += '\\n\\n\ud83d\udccb \u0627\u0644\u062e\u064a\u0627\u0631\u0627\u062a \u0627\u0644\u0645\u062a\u0627\u062d\u0629:';\n    inter.action.sections.forEach(section => {\n      if (section.rows) {\n        section.rows.forEach(row => {\n          displayText += `\\n\u2022 ${row.title || row.id}`;\n        });\n      }\n    });\n  }\n  \n} else {\n  // Fallback \u0644\u0644\u0640 preview \u0625\u0630\u0627 \u0644\u0645 \u0646\u0633\u062a\u0637\u0639 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635\n  displayText = out.preview || '\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629';\n}\n\nconst msg = {\n  account, peer, name,\n  dir: 'out',\n  text: displayText,\n  ts: Math.floor(Date.now()/1000),\n  meta: { kind:'sent', type: out.type },\n  business_phone: it.business_number || ''\n};\n\ng.messages.push(msg);\nif (g.messages.length > 5000) g.messages.splice(0, g.messages.length - 5000);\n\nreturn [{ json: { logged:true, ...it } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "1d0c3cc6-8093-4fa5-86cb-799c6abe4ab4",
      "name": "\u062a\u062d\u0636\u064a\u0631 \u0625\u0631\u0633\u0627\u0644 - \u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0645\u062a\u0627\u0628\u0639\u0629",
      "type": "n8n-nodes-base.code",
      "position": [
        1952,
        624
      ],
      "parameters": {
        "jsCode": "const main = $('sub route').item.json;\nconst curr = $json;\n\nconst bodyText = ` \u062d\u0627\u0644\u0629 \u0637\u0644\u0628\u0643: ${curr['\u0627\u0644\u062d\u0627\u0644\u0629']} `;\n\nconst payload = {\n  messaging_product: \"whatsapp\",\n  to: main.phone_number,\n  type: \"text\",\n  text: { body: bodyText }\n};\n\nreturn [{\n  json: {\n    ...curr,\n    phone_number: main.phone_number,\n    phone_number_id: main.phone_number_id,\n    contact_name: main.contact_name,\n    _outgoing: {\n      type: \"text\",\n      preview: `\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644: \u062d\u0627\u0644\u0629 \u0627\u0644\u0637\u0644\u0628 (${curr['\u0627\u0644\u062d\u0627\u0644\u0629'] || ''})`,\n      payload\n    }\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "a9d1d9e2-fa33-4059-b5ad-43d7f2e7bc1f",
      "name": "\u062a\u062d\u0636\u064a\u0631 \u0625\u0631\u0633\u0627\u0644 - \u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0645\u062a\u0627\u0628\u0639\u0629 \u0644\u0627 \u064a\u0648\u062c\u062f",
      "type": "n8n-nodes-base.code",
      "position": [
        1936,
        832
      ],
      "parameters": {
        "jsCode": "const main = $('sub route').item.json;\n\nconst bodyText = \" \u0639\u0630\u0631\u064b\u0627\u060c \u0644\u0645 \u064a\u062a\u0645 \u0627\u0644\u0639\u062b\u0648\u0631 \u0639\u0644\u0649 \u0637\u0644\u0628 \u0628\u0647\u0630\u0627 \u0627\u0644\u0631\u0642\u0645 \";\n\nconst payload = {\n  messaging_product: \"whatsapp\",\n  to: main.phone_number,\n  type: \"text\",\n  text: { body: bodyText }\n};\n\nreturn [{\n  json: {\n    ...$json,\n    phone_number: main.phone_number,\n    phone_number_id: main.phone_number_id,\n    contact_name: main.contact_name,\n    _outgoing: {\n      type: \"text\",\n      preview: \"\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644: \u0644\u0645 \u064a\u062a\u0645 \u0627\u0644\u0639\u062b\u0648\u0631 \u0639\u0644\u0649 \u0627\u0644\u0637\u0644\u0628\",\n      payload\n    }\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "99c0e52d-a0a9-4833-b18c-e608c49f64da",
      "name": "\u062d\u0636\u0631 \u0627\u0644\u0627\u0631\u0633\u0627\u0644 - \u0646\u0642\u0644 \u0627\u0644\u062e\u0627\u062f\u0645\u0627\u062a",
      "type": "n8n-nodes-base.code",
      "position": [
        2224,
        1328
      ],
      "parameters": {
        "jsCode": "const main = $('sub route').item.json;\n\nconst bodyText = \"\u062a\u0645 \u0627\u0633\u062a\u0644\u0627\u0645 \u0637\u0644\u0628\u0643\u060c \u0648\u0633\u064a\u062a\u0648\u0627\u0635\u0644 \u0645\u0639\u0643 \u0627\u0644\u0645\u0648\u0638\u0641 \u0642\u0631\u064a\u0628\u064b\u0627\";\n\nconst payload = {\n  messaging_product: \"whatsapp\",\n  to: main.phone_number,\n  type: \"text\",\n  text: { body: bodyText }\n};\n\nreturn [{\n  json: {\n    ...$json,\n    phone_number: main.phone_number,\n    phone_number_id: main.phone_number_id,\n    contact_name: main.contact_name,\n    _outgoing: {\n      type: \"text\",\n      preview: \"\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644: \u062a\u0623\u0643\u064a\u062f \u0637\u0644\u0628 \u0646\u0642\u0644 \u0627\u0644\u062e\u0627\u062f\u0645\u0627\u062a\",\n      payload\n    }\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "4fcf6f9a-8226-4e44-a4bb-dd11e9746fc2",
      "name": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0627\u0644\u0645\u0648\u0638\u0641",
      "type": "n8n-nodes-base.code",
      "position": [
        736,
        1792
      ],
      "parameters": {
        "jsCode": "const main = $('sub route').item.json;\n\nconst bodyText = `\ud83e\udd1d \u0627\u0644\u0631\u062c\u0627\u0621 \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631...\n\n\u0633\u064a\u062a\u0645 \u0627\u0644\u062a\u0648\u0627\u0635\u0644 \u0645\u0639\u0643 \u0645\u0646 \u0623\u062d\u062f \u0645\u0648\u0638\u0641\u064a \u062e\u062f\u0645\u0629 \u0627\u0644\u0639\u0645\u0644\u0627\u0621 \u0641\u064a \u0623\u0642\u0631\u0628 \u0648\u0642\u062a \u0645\u0645\u0643\u0646.\n\n\u0634\u0643\u0631\u0627\u064b \u0644\u062a\u0648\u0627\u0635\u0644\u0643 \u0645\u0639\u0646\u0627! \u2764\ufe0f`;\n\nconst payload = {\n  messaging_product: \"whatsapp\",\n  to: main.phone_number,\n  type: \"text\",\n  text: { body: bodyText }\n};\n\nreturn [{\n  json: {\n    ...$json,\n    phone_number: main.phone_number,\n    phone_number_id: main.phone_number_id,\n    contact_name: main.contact_name,\n    _outgoing: {\n      type: \"text\",\n      preview: \"\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644: \u0627\u0644\u062a\u062d\u062f\u062b \u0645\u0639 \u0645\u0648\u0638\u0641\",\n      payload\n    }\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "0142688c-0abb-4227-b779-2061140766ad",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2768,
        32
      ],
      "parameters": {
        "color": 5,
        "width": 560,
        "height": 736,
        "content": "## WhatsApp Webhook Entry Points\n\nThree webhook endpoints receive messages from WhatsApp Business API:\n- Main webhook\n- Backup webhook 2\n- Backup webhook 3\n\nHandles:\n\u2713 Text messages\n\u2713 Interactive button/list replies\n\u2713 Images, videos, audio, voice notes\n\u2713 Documents (PDF, Excel, etc.)\n\u2713 Webhook verification (hub.challenge)\n\nRoutes to data extraction"
      },
      "typeVersion": 1
    },
    {
      "id": "e77cfc6b-31b3-4658-96d8-a11e66a00b6c",
      "name": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0627\u0644\u0623\u0633\u0639\u0627\u0631",
      "type": "n8n-nodes-base.code",
      "position": [
        720,
        672
      ],
      "parameters": {
        "jsCode": "// \u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \"\u0627\u0644\u0623\u0633\u0639\u0627\u0631 (\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u062c\u0646\u0633\u064a\u0627\u062a)\"\nconst j = $json;\n\nconst payload = {\n  messaging_product: \"whatsapp\",\n  to: j.phone_number,\n  type: \"interactive\",\n  interactive: {\n    type: \"list\",\n    body: { text: \"\ud83d\udcb2 \u0627\u062e\u062a\u0631 \u0627\u0644\u062c\u0646\u0633\u064a\u0629 \u0627\u0644\u0645\u0637\u0644\u0648\u0628\u0629 \u0644\u0645\u0639\u0631\u0641\u0629 \u0627\u0644\u0633\u0639\u0631:\" },\n    action: {\n      button: \"\u0627\u062e\u062a\u0631 \u0627\u0644\u062c\u0646\u0633\u064a\u0629\",\n      sections: [\n        {\n          title: \"\u0627\u0644\u062c\u0646\u0633\u064a\u0627\u062a\",\n          rows: [\n            { id: \"price_uganda\",     title: \"\ud83c\uddfa\ud83c\uddec \u0623\u0648\u063a\u0646\u062f\u0627\" },\n            { id: \"price_ethiopia\",   title: \"\ud83c\uddea\ud83c\uddf9 \u0625\u062b\u064a\u0648\u0628\u064a\u0627\" },\n            { id: \"price_philippines\",title: \"\ud83c\uddf5\ud83c\udded \u0627\u0644\u0641\u0644\u0628\u064a\u0646\" },\n            { id: \"price_burundi\",    title: \"\ud83c\udde7\ud83c\uddee \u0628\u0648\u0631\u0648\u0646\u062f\u064a\" },\n            { id: \"price_bangladesh\", title: \"\ud83c\udde7\ud83c\udde9 \u0628\u0646\u063a\u0644\u0627\u062f\u064a\u0634\" },\n            { id: \"price_kenya\",      title: \"\ud83c\uddf0\ud83c\uddea \u0643\u064a\u0646\u064a\u0627\" }\n          ]\n        }\n      ]\n    }\n  }\n};\n\nreturn [{\n  json: {\n    ...j,\n    _outgoing: {\n      type: \"interactive\",\n      preview: \"\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644: \u0627\u0644\u0623\u0633\u0639\u0627\u0631 (\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u062c\u0646\u0633\u064a\u0627\u062a)\",\n      payload\n    }\n  }\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "6fe35754-decc-40db-93e2-bc1a38c1a576",
      "name": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u0629 (\u0639\u0627\u0645)1",
      "type": "n8n-nodes-base.code",
      "position": [
        880,
        672
      ],
      "parameters": {
        "jsCode": "const g = $getWorkflowStaticData('global');\ng.messages = g.messages || [];\ng.contacts = g.contacts || {};\n\nconst it = $input.first().json;\nconst account = String(it.phone_number_id || '').trim();\nconst peer = String(it.phone_number || '').trim();\nconst out = it._outgoing || {};\n\nif (!account || !peer || !out.type) {\n  return [{ json: { logged:false, reason:'missing account/peer/_outgoing', ...it } }];\n}\n\nconst key = `${account}:${peer}`;\nconst name = it.contact_name || g.contacts[key]?.name || peer;\nif (!g.contacts[key]) g.contacts[key] = { platform:'whatsapp', peer, account, name };\nelse g.contacts[key].name = name || g.contacts[key].name;\n\n// \ud83d\udd25 \u0627\u0644\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0631\u0626\u064a\u0633\u064a: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635 \u0627\u0644\u0641\u0639\u0644\u064a \u0645\u0646 payload\nlet displayText = '';\n\nif (out.type === 'text' && out.payload?.text?.body) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u064a\u0629 \u0639\u0627\u062f\u064a\u0629\n  displayText = out.payload.text.body;\n  \n} else if (out.type === 'interactive' && out.payload?.interactive) {\n  // \u0631\u0633\u0627\u0644\u0629 \u0642\u0627\u0626\u0645\u0629 \u062a\u0641\u0627\u0639\u0644\u064a\u0629\n  const inter = out.payload.interactive;\n  \n  if (inter.body?.text) {\n    displayText = inter.body.text;\n  }\n  \n  // \u0625\u0636\u0627\u0641\u0629 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u0645\u0648\u062c\u0648\u062f\u0629\n  if (inter.action?.sections) {\n    displayText += '\\n\\n\ud83d\udccb \u0627\u0644\u062e\u064a\u0627\u0631\u0627\u062a \u0627\u0644\u0645\u062a\u0627\u062d\u0629:';\n    inter.action.sections.forEach(section => {\n      if (section.rows) {\n        section.rows.forEach(row => {\n          displayText += `\\n\u2022 ${row.title || row.id}`;\n        });\n      }\n    });\n  }\n  \n} else {\n  // Fallback \u0644\u0644\u0640 preview \u0625\u0630\u0627 \u0644\u0645 \u0646\u0633\u062a\u0637\u0639 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635\n  displayText = out.preview || '\ud83d\udce4 \u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629';\n}\n\nconst msg = {\n  account, peer, name,\n  dir: 'out',\n  text: displayText,\n  ts: Math.floor(Date.now()/1000),\n  meta: { kind:'sent', type: out.type },\n  business_phone: it.business_number || ''\n};\n\ng.messages.push(msg);\nif (g.messages.length > 5000) g.messages.splice(0, g.messages.length - 5000);\n\nreturn [{ json: { logged:true, ...it } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "3a3ecde4-1f67-46f1-aea7-9120996ddf71",
      "name": "\u0627\u0644\u0633\u064a\u0631",
      "type": "n8n-nodes-base.code",
      "position": [
        1456,
        416
      ],
      "parameters": {
        "jsCode": "// \u0628\u064a\u0627\u0646\u0627\u062a \u0627\u0644\u0633\u064a\u0631 \u0627\u0644\u0630\u0627\u062a\u064a\u0629 \u0627\u0644\u062b\u0627\u0628\u062a\u0629\nconst cvs = [\n  { '\u0627\u0644\u0628\u0644\u062f': '\u0623\u0648\u063a\u0646\u062f\u0627 \ud83c\uddfa\ud83c\uddec',    '\u0627\u0644\u062c\u0646\u0633\u064a\u0629 ': 'req_uganda',     '\u0627\u0644\u0633\u064a\u0631\u0629': 'https://fahadrec.com/workers/filter/tax/country:uganda;service-type:recruitment/' },\n  { '\u0627\u0644\u0628\u0644\u062f': '\u0625\u062b\u064a\u0648\u0628\u064a\u0627 \ud83c\uddea\ud83c\uddf9',   '\u0627\u0644\u062c\u0646\u0633\u064a\u0629 ': 'req_ethiopia',   '\u0627\u0644\u0633\u064a\u0631\u0629': 'https://fahadrec.com/workers/filter/tax/country:ethiopia;service-type:recruitment/' },\n  { '\u0627\u0644\u0628\u0644\u062f': '\u0627\u0644\u0641\u0644\u0628\u064a\u0646 \ud83c\uddf5\ud83c\udded',   '\u0627\u0644\u062c\u0646\u0633\u064a\u0629 ': 'req_philippines','\u0627\u0644\u0633\u064a\u0631\u0629': 'https://fahadrec.com/workers/filter/tax/country:philippines;service-type:recruitment/' },\n  { '\u0627\u0644\u0628\u0644\u062f': '\u0628\u0648\u0631\u0648\u0646\u062f\u064a \ud83c\udde7\ud83c\uddee',   '\u0627\u0644\u062c\u0646\u0633\u064a\u0629 ': 'req_burundi',    '\u0627\u0644\u0633\u064a\u0631\u0629': 'https://fahadrec.com/workers/filter/tax/country:burundi;service-type:recruitment/' },\n  { '\u0627\u0644\u0628\u0644\u062f': '\u0628\u0646\u063a\u0644\u0627\u062f\u064a\u0634 \ud83c\udde7\ud83c\udde9', '\u0627\u0644\u062c\u0646\u0633\u064a\u0629 ': 'req_bangladesh', '\u0627\u0644\u0633\u064a\u0631\u0629': 'https://fahadrec.com/workers/filter/tax/country:bangladesh;service-type:recruitment/' },\n  { '\u0627\u0644\u0628\u0644\u062f': '\u0643\u064a\u0646\u064a\u0627 \ud83c\uddf0\ud83c\uddea',     '\u0627\u0644\u062c\u0646\u0633\u064a\u0629 ': 'req_kenya',      '\u0627\u0644\u0633\u064a\u0631\u0629': 'https://fahadrec.com/workers/filter/tax/country:kenya;service-type:recruitment/' }\n];\n\n// \u0625\u0631\u062c\u0627\u0639 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a \u0643\u0635\u0641\u0648\u0641 JSON\nreturn cvs.map(cv => ({ json: cv }));\n"
      },
      "typeVersion": 2
    },
    {
      "id": "aa700b36-377b-4ed7-90dd-f3daa31e70ad",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2496,
        192
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=\u062a\u0645 \u062a\u0633\u062c\u064a\u0644 \u0637\u0644\u0628 \u062c\u062f\u064a\u062f:  \n\n\u0627\u0633\u0645 \u0627\u0644\u0639\u0645\u064a\u0644: {{ $json['\u0627\u0633\u0645 \u0627\u0644\u0639\u0645\u064a\u0644']}} \n\n\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641: {{ $json['\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641 '] }} \n\n\u0628\u0644\u062f \u0627\u0644\u0637\u0644\u0628: {{ $json['\u0627\u0644\u0628\u0644\u062f'] }}",
        "options": {},
        "subject": " \u062a\u0633\u062c\u064a\u0644 \u0637\u0644\u0628 \u062c\u062f\u064a\u062f"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "c956c796-989c-437f-a25f-1ed87d54b600",
      "name": "Send a message1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2464,
        1104
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=\u062a\u0645 \u0637\u0644\u0628 \u0646\u0642\u0644 \u062e\u0627\u062f\u0645\u0627\u062a: \n\n\u0627\u0633\u0645 \u0627\u0644\u0639\u0645\u064a\u0644: {{ $json['\u0627\u0633\u0645 \u0627\u0644\u0639\u0645\u064a\u0644']}}\n\n\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641: {{ $json['\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641 '] }}\n\n\u0628\u0644\u062f \u0627\u0644\u0637\u0644\u0628: {{ $json['\u0627\u0644\u0628\u0644\u062f'] }}",
        "options": {},
        "subject": "\u062a\u0645 \u0637\u0644\u0628 \u0646\u0642\u0644 \u062e\u0627\u062f\u0645\u0627\u062a"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "b2c02bc6-0137-4f47-acfc-70a80665d3e9",
      "name": "Send a message2",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2176,
        1600
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=\u0647\u0646\u0627\u0643 \u0639\u0645\u064a\u0644 \u0623\u0631\u0633\u0644 \u0634\u0643\u0648\u0649: \n\n\u0627\u0633\u0645 \u0627\u0644\u0639\u0645\u064a\u0644: {{ $('\u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a').item.json.contact_name }}\n\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641: {{ $('\u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a').item.json.phone_number }}\n\n\u0646\u0648\u0639 \u0627\u0644\u0645\u0634\u0643\u0644\u0629: {{ $('\u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a').item.json.interactive_title }}",
        "options": {},
        "subject": "\u0647\u0646\u0627\u0643 \u0639\u0645\u064a\u0644 \u0623\u0631\u0633\u0644 \u0634\u0643\u0648\u0649"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "a267104e-cc91-433a-b56d-e0b0b5aa86a4",
      "name": "Send a message3",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1232,
        1728
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=\u0647\u0646\u0627\u0643 \u0639\u0645\u064a\u0644 \u064a\u0631\u064a\u062f \u0645\u0648\u0638\u0641 \u0628\u0634\u0631\u064a: \n\n\u0627\u0633\u0645 \u0627\u0644\u0639\u0645\u064a\u0644: {{ $('\u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a').item.json.contact_name }}\n\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641: {{ $('\u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a').item.json.phone_number }}\n",
        "options": {},
        "subject": "\u0647\u0646\u0627\u0643 \u0639\u0645\u064a\u0644 \u0623\u0631\u0633\u0644 \u0634\u0643\u0648\u0649"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "5accd48a-9e99-4bf6-93a5-eca1bc712a87",
      "name": "sub route",
      "type": "n8n-nodes-base.switch",
      "position": [
        1040,
        320
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "7f3051a7-ca03-43aa-8b82-0bdbed3f0411",
                    "operator": {
                      "type": "string",
                      "operation": "startsWith"
                    },
                    "leftValue": "={{ $json.interactive_reply }}",
                    "rightValue": "price_"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "64b87b23-5d12-4144-a40c-258eab65e688",
                    "operator": {
                      "type": "string",
                      "operation": "startsWith"
                    },
                    "leftValue": "={{ $json.interactive_reply }}",
                    "rightValue": "req_"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "33a7614c-275d-476c-a860-df16c485ef2b",
                    "operator": {
                      "type": "string",
                      "operation": "startsWith"
                    },
                    "leftValue": "={{ $json.interactive_reply }}",
                    "rightValue": "complaint_"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "9d8346bb-d23a-4bdd-a6c7-25bfa43981da",
                    "operator": {
                      "type": "string",
                      "operation": "startsWith"
                    },
                    "leftValue": "={{ $json.interactive_reply }}",
                    "rightValue": "m_"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "012deae1-ab2a-4e29-a2a3-155531884405",
      "name": "Get row(s)",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1488,
        160
      ],
      "parameters": {
        "operation": "get",
        "returnAll": true,
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "yiQeA2dW0zlIPPQR",
          "cachedResultUrl": "/projects/sJVutLQokgMvGHKk/datatables/yiQeA2dW0zlIPPQR",
          "cachedResultName": "fahad whatsapp"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6df2de89-4cb1-401b-a88b-e79daa0e341e",
      "name": "\u0641\u064a \u0648\u0633\u0627\u0626\u0637\u061f",
      "type": "n8n-nodes-base.if",
      "position": [
        -1808,
        576
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f9464b07-98f8-4207-8824-25efc046ea73",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.media_id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c7cc7e00-024b-455b-a197-7a05001bbe8e",
      "name": "Action in an app",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1616,
        416
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v17.0/{{ $json.media_id }}?fields=url,mime_type",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3e8c16e2-08d2-41d2-b5f8-58c840b4b440",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1440,
        416
      ],
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        },
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "5b81c228-c38c-4c7a-983a-90fa5e285d5d",
      "name": "\u062d\u0641\u0638 \u0627\u0644\u0645\u064a\u062f\u064a\u0627",
      "type": "n8n-nodes-base.code",
      "position": [
        -1296,
        416
      ],
      "parameters": {
        "jsCode": "// \ud83d\udcbe \u062d\u0641\u0638 \u0627\u0644\u0645\u0644\u0641 \u0641\u064a Data Table\nconst original = $('\u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a').first().json;\nconst binaryData = $input.first().binary?.data;\n\nif (!binaryData || !binaryData.data) {\n  console.error('\u274c No binary data');\n  return [{ json: original }];\n}\n\nconst base64 = binaryData.data.toString('base64');\nconst mime = binaryData.mimeType || 'application/octet-stream';\n\nconsole.log(`\u2705 Saving: ${original.media_type} - ${mime} - ${(base64.length * 0.75 / 1024).toFixed(2)} KB`);\n\nreturn [{\n  json: {\n    // \u0644\u0644\u0640 Data Table\n    media_id: original.media_id,\n    account: original.phone_number_id,\n    peer: original.phone_number,\n    media_type: original.media_type,\n    media_base64: base64,\n    media_mime_type: mime,  // \u2705 \u0647\u0630\u0627 \u0645\u0647\u0645 \u062c\u062f\u0627\u064b\n    caption: original.media_caption || '',\n    filename: original.media_filename || '',\n    created_at: Math.floor(Date.now() / 1000),\n    \n    // \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a \u0627\u0644\u0623\u0635\u0644\u064a\u0629\n    phone_number_id: original.phone_number_id,\n    phone_number: original.phone_number,\n    business_number: original.business_number,\n    message_text: original.message_text,\n    interactive_reply: original.interactive_reply,\n    interactive_title: original.interactive_title,\n    interactive_type: original.interactive_type,\n    contact_name: original.contact_name,\n    is_status_update: original.is_status_update,\n    media_downloaded: true,\n    media_filename: original.media_filename,  // \u2705 \u0623\u0636\u0641\u0647\u0627 \u0647\u0646\u0627\n\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "e95e9578-9dae-4f9f-8597-b7944227ee36",
      "name": "\u062a\u0646\u0632\u064a\u0644 \u0627\u0644\u0648\u0633\u0627\u0626\u0637",
      "type": "n8n-nodes-base.code",
      "position": [
        -1488,
        624
      ],
      "parameters": {
        "jsCode": "// \ud83d\udce5 \u062a\u0646\u0632\u064a\u0644 \u0627\u0644\u0648\u0633\u0627\u0626\u0637 \u0645\u0646 WhatsApp\n\nconst g = $getWorkflowStaticData('global');\nconst item = $input.first().json;\n\n// \u0625\u0630\u0627 \u0645\u0627 \u0641\u064a media_id\u060c \u062a\u062c\u0627\u0648\u0632\nif (!item.media_id) {\n  return [{ json: item }];\n}\n\ntry {\n  // 1\ufe0f\u20e3 \u062c\u0644\u0628 \u0631\u0627\u0628\u0637 \u0627\u0644\u0645\u0644\u0641 \u0645\u0646 WhatsApp API\n  const mediaInfoUrl = `https://graph.facebook.com/v17.0/${item.media_id}`;\n  const mediaInfoResponse = await fetch(mediaInfoUrl, {\n    headers: {\n      'Authorization': 'Bearer YOUR_TOKEN_HERE' // \u26a0\ufe0f \u0636\u0639 \u0627\u0644\u062a\u0648\u0643\u0646 \u0647\u0646\u0627\n    }\n  });\n  \n  const mediaInfo = await mediaInfoResponse.json();\n  const mediaUrl = mediaInfo.url;\n  \n  // 2\ufe0f\u20e3 \u062a\u0646\u0632\u064a\u0644 \u0627\u0644\u0645\u0644\u0641 \u0646\u0641\u0633\u0647\n  const mediaResponse = await fetch(mediaUrl, {\n    headers: {\n      'Authorization': 'Bearer YOUR_TOKEN_HERE' // \u26a0\ufe0f \u0636\u0639 \u0627\u0644\u062a\u0648\u0643\u0646 \u0647\u0646\u0627\n    }\n  });\n  \n  const mediaBuffer = await mediaResponse.arrayBuffer();\n  const mediaBase64 = Buffer.from(mediaBuffer).toString('base64');\n  \n  console.log(`\u2705 \u062a\u0645 \u062a\u0646\u0632\u064a\u0644 \u0627\u0644\u0648\u0633\u0627\u0626\u0637: ${item.media_type} - ${(mediaBase64.length * 0.75 / 1024).toFixed(2)} KB`);\n  \n  // 3\ufe0f\u20e3 \u062d\u0641\u0638 \u0627\u0644\u0645\u0644\u0641 \u0645\u0639 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a\n  return [{\n    json: {\n      ...item,\n      media_url: mediaUrl,\n      media_base64: mediaBase64, // \u0627\u0644\u0645\u0644\u0641 \u0643\u0640 base64\n      media_mime_type: mediaInfo.mime_type\n    }\n  }];\n  \n} catch (error) {\n  console.error('\u274c \u062e\u0637\u0623 \u0641\u064a \u062a\u0646\u0632\u064a\u0644 \u0627\u0644\u0648\u0633\u0627\u0626\u0637:', error);\n  return [{ json: item }]; // \u0623\u0631\u062c\u0639 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a \u0627\u0644\u0623\u0635\u0644\u064a\u0629\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "ac832353-6645-47e0-80c7-caa369fe13fa",
      "name": "Code in JavaScript4",
      "type": "n8n-nodes-base.code",
      "position": [
        -880,
        416
      ],
      "parameters": {
        "jsCode": "// \u0627\u0633\u062a\u0631\u062c\u0627\u0639 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a \u0627\u0644\u0623\u0635\u0644\u064a\u0629 \u0628\u0639\u062f Data Table\nconst original = $('\u062d\u0641\u0638 \u0627\u0644\u0645\u064a\u062f\u064a\u0627').first().json;\n\nreturn [{\n  json: {\n    phone_number_id: original.phone_number_id,\n    phone_number: original.phone_number,\n    business_number: original.business_number,\n    message_text: original.message_text,\n    interactive_reply: original.interactive_reply,\n    interactive_title: original.interactive_title,\n    interactive_type: original.interactive_type,\n    contact_name: original.contact_name,\n    is_status_update: original.is_status_update,\n    media_type: original.media_type,\n    media_id: original.media_id,\n    media_caption: original.media_caption,\n    media_filename: original.media_filename,\n    media_downloaded: true\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "e629dc03-b2b3-4e48-8524-ae2e732f6104",
      "name": "Menu Cooldown Check",
      "type": "n8n-nodes-base.code",
      "position": [
        -32,
        352
      ],
      "parameters": {
        "jsCode": "// \ud83d\udd50 \u0625\u0636\u0627\u0641\u0629 \u0646\u0638\u0627\u0645 Cooldown \u0644\u0644\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0631\u0626\u064a\u0633\u064a\u0629 (5 \u062f\u0642\u0627\u0626\u0642)\nconst g = $getWorkflowStaticData('global');\nconst inItem = $input.first().json;\n\n// \u062a\u0647\u064a\u0626\u0629 \u0627\u0644\u062a\u062e\u0632\u064a\u0646\ng.lastMenuSent = g.lastMenuSent || {};\n\nconst account = String(inItem.phone_number_id || '').trim();\nconst peer = String(inItem.phone_number || '').trim();\nconst key = `${account}:${peer}`;\n\n// \u0627\u0644\u0648\u0642\u062a \u0627\u0644\u062d\u0627\u0644\u064a\nconst now = Date.now();\n\n// \u0622\u062e\u0631 \u0648\u0642\u062a \u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0641\u064a\u0647 \u0644\u0647\u0630\u0627 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645\nconst lastSent = g.lastMenuSent[key] || 0;\n\n// \u0627\u0644\u0641\u0631\u0642 \u0628\u0627\u0644\u062f\u0642\u0627\u0626\u0642\nconst minutesPassed = (now - lastSent) / (1000 * 60);\n\n// \u2705 \u0625\u0630\u0627 \u0645\u0631 \u0623\u0643\u062b\u0631 \u0645\u0646 5 \u062f\u0642\u0627\u0626\u0642\u060c \u0623\u0631\u0633\u0644 \u0627\u0644\u0642\u0627\u0626\u0645\u0629\nif (minutesPassed >= 5) {\n  console.log(`\u2705 Sending menu to ${key} (${minutesPassed.toFixed(1)} minutes since last)`);\n  \n  // \u062a\u062d\u062f\u064a\u062b \u0648\u0642\u062a \u0627\u0644\u0625\u0631\u0633\u0627\u0644\n  g.lastMenuSent[key] = now;\n  \n  // \u0627\u0644\u0633\u0645\u0627\u062d \u0628\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0642\u0627\u0626\u0645\u0629\n  return [{ \n    json: { \n      ...inItem,\n      send_menu: true,\n      cooldown_passed: true\n    } \n  }];\n}\n\n// \u274c \u0625\u0630\u0627 \u0644\u0645 \u064a\u0645\u0631 5 \u062f\u0642\u0627\u0626\u0642 \u0628\u0639\u062f\nconst remainingMinutes = (5 - minutesPassed).toFixed(1);\nconsole.log(`\u23f3 Menu cooldown active for ${key}. ${remainingMinutes} minutes remaining.`);\n\nreturn [{ \n  json: { \n    ...inItem,\n    send_menu: false,\n    cooldown_active: true,\n    remaining_minutes: remainingMinutes\n  } \n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "d232d149-cd4a-48b2-a667-cb9f72b3441c",
      "name": "If3",
      "type": "n8n-nodes-base.if",
      "position": [
        128,
        352
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "64b6cae2-2752-4d38-aee0-faa58f736f2e",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.send_menu }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "fbaa136b-5e42-4d48-99a0-259368ebbe9e",
      "name": "Upsert row(s)",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -1088,
        416
      ],
      "parameters": {
        "columns": {
          "value": {
            "peer": "={{ $json.phone_number }}",
            "account": "= {{ $json.phone_number_id }}",
            "caption": "={{ $json.caption }}",
            "filename": "={{ $json.filename }}",
            "media_id": "={{ $json.media_id }}",
            "mime_type": "={{ $json.media_mime_type }}",
            "created_at": "={{ $json.created_at }}",
            "media_type": "={{ $json.media_type }}",
            "media_base64": "={{ $json.media_base64 }}"
          },
          "schema": [
            {
              "id": "media_id",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "media_id",
              "defaultMatch": false
            },
            {
              "id": "media_type",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "media_type",
              "defaultMatch": false
            },
            {
              "id": "media_base64",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "media_base64",
              "defaultMatch": false
            },
            {
              "id": "mime_type",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "mime_type",
              "defaultMatch": false
            },
            {
              "id": "caption",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "caption",
              "defaultMatch": false
            },
            {
              "id": "filename",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "filename",
              "defaultMatch": false
            },
            {
              "id": "account",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "account",
              "defaultMatch": false
            },
            {
              "id": "peer",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "peer",
              "defaultMatch": false
            },
            {
              "id": "created_at",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "created_at",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "filters": {
          "conditions": [
            {
              "keyName": "media_id",
              "keyValue": "={{ $json.media_id }}"
            }
          ]
        },
        "options": {},
        "operation": "upsert",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "ycdU6FSuoQmH7x5X",
          "cachedResultUrl": "/projects/bgGgFi3gyzS51ECL/datatables/ycdU6FSuoQmH7x5X",
          "cachedResultName": "media"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a9b166db-62e0-4c96-9fc8-71ba80be420a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2096,
        -80
      ],
      "parameters": {
        "color": 6,
        "width": 496,
        "height": 864,
        "content": "## Message Data Extraction\n\nParses incoming WhatsApp webhooks and extracts:\n- Phone numbers (sender & business)\n- Contact names\n- Message content (text/media)\n- Interactive replies (button/list selections)\n- Media metadata (type, ID, mime, caption, filename)\n\nStructures data for downstream processing\nHandles all WhatsApp message types uniformly"
      },
      "typeVersion": 1
    },
    {
      "id": "4fea1da5-07f8-4a97-a973-b48ef3e219da",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1584,
        -80
      ],
      "parameters": {
        "width": 496,
        "height": 864,
        "content": "## Media File Management\n\nProcess:\n1. Detect media presence (image/video/audio/document)\n2. Fetch media URL from WhatsApp API\n3. Download file as binary\n4. Convert to base64\n5. Store in Data Table with metadata\n\nSupports:\n\ud83d\uddbc\ufe0f Images \u2022 \ud83c\udfa5 Videos \u2022 \ud83c\udfb5 Audio\n\ud83c\udfa4 Voice notes \u2022 \ud83d\udcc4 Documents\n\nKeeps original filenames and mime types"
      },
      "typeVersion": 1
    },
    {
      "id": "fe2e7d3c-52d6-4d84-bd15-51f5108cd46c",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1056,
        -80
      ],
      "parameters": {
        "color": 7,
        "width": 512,
        "height": 864,
        "content": "## Bot Enable Check & Session Tracking\n\nLabel Tracker:\n- Tracks which menu section user is in\n- Maintains context across messages\n- Identifies main menu vs sub-menu interactions\n\nBot Master Switch:\n- Global on/off control\n- Per-user override capability\n- Prevents bot from responding when disabled\n\nSession State:\n- Tracks conversation flow state\n- Records last interaction timestamp\n- Manages user journey through menu system"
      },
      "typeVersion": 1
    },
    {
      "id": "6492fda2-c659-4d20-954d-44662839a490",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        -80
      ],
      "parameters": {
        "color": 3,
        "width": 496,
        "height": 864,
        "content": "## Conversation History Logger\n\nLogs every message (incoming & outgoing):\n- Stores in global workflow memory\n- Tracks: text, timestamp, direction, type\n- Maintains last 5000 messages\n- Links messages to contacts\n- Preserves media metadata (no heavy files)\n\nUsed for:\n\u2192 Conversation review\n\u2192 Analytics\n\u2192 Customer history\n\u2192 Debugging"
      },
      "typeVersion": 1
    },
    {
      "id": "79a3cc82-a492-4cd3-96dc-4941de967c89",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -80
      ],
      "parameters": {
        "color": 4,
        "width": 496,
        "height": 400,
        "content": "## Main Menu Display\n\nCooldown System (5 minutes):\n- Prevents menu spam\n- Tracks last menu send time per user\n- Only shows menu if cooldown passed\n\nInteractive Menu Options:\n\ud83d\udcb2 Prices\n\ud83d\udcdd New Request  \n\ud83d\udd0e Track Request\n\ud83d\udd04 Worker Transfer\n\ud83c\udf10 Translation\n\ud83d\udee0\ufe0f Complaints\n\ud83c\udfe2 About Office\n\ud83e\udd1d Talk to Agent\n\nPrepares \u2192 Logs \u2192 Sends via WhatsApp API"
      },
      "typeVersion": 1
    },
    {
      "id": "008da021-054b-47a9-9df4-63a53143163d",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -288,
        1072
      ],
      "parameters": {
        "width": 496,
        "height": 672,
        "content": "## Smart Menu Navigation\n\nMenu Route (Main Options):\nRoutes to 8 primary services based on button ID\n\nSub Route (Nested Actions):\n- price_* \u2192 Price lookup flow\n- req_* \u2192 New request flow  \n- complaint_* \u2192 Complaint handling\n- m_* \u2192 Back to main menu\n\nEach route:\n1. Prepares appropriate response\n2. Logs outgoing message\n3. Sends via WhatsApp API\n4. Triggers backend actions (Google Sheets, Email)"
      },
      "typeVersion": 1
    },
    {
      "id": "545f13c2-8301-42f0-9ea8-ca1df7b7c81d",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2768,
        592
      ],
      "parameters": {
        "width": 864,
        "height": 1328,
        "content": "## Complete Service Flows & Backend Integration\n\n\ud83d\udcca PRICE INQUIRY\n- Static data (8 nationalities with prices in SAR)\n- User selects nationality \u2192 Bot sends price\n- No backend needed\n\n\ud83d\udcdd NEW REQUEST\n1. User selects nationality\n2. Bot sends CV link\n3. Save to \"\u0637\u0644\u0628\u0627\u062a \u062c\u062f\u064a\u062f\u0629\" sheet\n4. Email staff (fahadrecr@gmail.com)\n5. Send confirmation to customer\nData: Phone, Name, Nationality, Status: \"\u0642\u064a\u062f \u0627\u0644\u0645\u0631\u0627\u062c\u0639\u0629\"\n\n\ud83d\udd0e REQUEST TRACKING\n1. Bot asks user to wait\n2. Lookup phone in Google Sheets\n3. Found \u2192 Send status\n4. Not found \u2192 Send error message\n\n\ud83d\udd04 WORKER TRANSFER\n1. Send transfer page link\n2. Save to \"\u0646\u0642\u0644 \u0627\u0644\u062e\u0627\u062f\u0645\u0627\u062a\" sheet\n3. Email staff notification\n4. Confirm to customer\n\n\ud83c\udf10 TRANSLATION SERVICE\n- Send WhatsApp link for phone interpretation\n- All nationalities supported\n- Static response only\n\n\ud83d\udee0\ufe0f COMPLAINTS\nTypes: Worker issue, Service issue, Delays, Financial, Other\n1. User selects complaint type\n2. Save to \"\u0634\u0643\u0627\u0648\u064a\" sheet\n3. Email staff immediately\n4. Confirm receipt to customer\n\n\ud83c\udfe2 ABOUT OFFICE\n- Licensed info, 8 nationalities, prices\n- 2-year insurance, contact info\n- Static text response\n\n\ud83e\udd1d HUMAN AGENT\n1. Send \"please wait\" message\n2. Email staff immediately\n3. Include customer name & phone\n\n\ud83d\udcca GOOGLE SHEETS CRM (3 Tabs)\n- \"\u0637\u0644\u0628\u0627\u062a \u062c\u062f\u064a\u062f\u0629\" - New requests\n- \"\u0646\u0642\u0644 \u0627\u0644\u062e\u0627\u062f\u0645\u0627\u062a\" - Transfers\n- \"\u0634\u0643\u0627\u0648\u064a\" - Complaints\nOperation: Upsert by phone number\n\n\u2709\ufe0f EMAIL NOTIFICATIONS\nTo: fahadrecr@gmail.com\nTriggers: New request, Transfer, Complaint, Human agent\nIncludes: Customer details, request type, timestamp\n\nAll flows: Prepare \u2192 Log \u2192 Send \u2192 Backend Action"
      },
      "typeVersion": 1
    },
    {
      "id": "bc5197a4-1da4-4a0e-a365-6f4b3a08b337",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2816,
        -816
      ],
      "parameters": {
        "color": 3,
        "width": 1760,
        "height": 704,
        "content": "# \u26a0\ufe0f Important Note\n\n# This workflow is part of a larger system.\n# It is not a standalone workflow \u2014 it connects to a full dashboard where:\n\n## - All data from the workflow is saved\n## - All incoming and outgoing messages are displayed\n## - A human escalation process is available when the automated workflow cannot complete the task or requires manual intervention"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "67bd5bef-cdc4-4843-acd7-3b132374fc55",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "\u062a\u062d\u0636\u064a\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 - \u0627\u0644\u0623\u0633\u0639\u0627\u0631",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "\u062a\u062d\u0636\u064a\u0631 \u0625\u0631\u0633\u0627\u0644 - \u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0633\u064a\u0631 \u0627\u0644\u0630\u0627\u062a\u064a\u0629",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If2": {
      "main": [
        [
          {
            "node": "\u062a\u062d\u0636\u064a\u0631 \u0625\u0631\u0633\u0627\u0644 - \u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0645\u062a\u0627\u0628\u0639\u0629",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u062a\u062d\u0636\u064a\u0631 \u0625\u0631\u0633\u0627\u0644 - \u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0645\u062a\u0627\u0628\u0639\u0629 \u0644\u0627 \u064a\u0648\u062c\u062f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If3": {
      "main": [
        [
          {
            "node": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0631\u0626\u064a\u0633\u064a\u0629",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If5": {
      "main": [
        [
          {
            "node": "\u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "\u062a\u062d\u0636\u064a\u0631 \u0625\u0631\u0633\u0627\u0644 - \u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0633\u064a\u0631 \u0627\u0644\u0630\u0627\u062a\u064a\u06291",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "\u062d\u0636\u0631 \u0627\u0644\u0627\u0631\u0633\u0627\u0644 - \u0646\u0642\u0644 \u0627\u0644\u062e\u0627\u062f\u0645\u0627\u062a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Verify Webhook2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "bot on?": {
      "main": [
        [
          {
            "node": "\u0627\u0642\u0631\u0623 \u0627\u0644\u062d\u0627\u0644\u0629",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "sub route": {
      "main": [
        [
          {
            "node": "Get row(s)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u0627\u0644\u0633\u064a\u0631",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0634\u0643\u0648\u0649 \u062a\u0645 \u0627\u0644\u062a\u0633\u062c\u064a\u0644",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "menu route",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s)": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "menu route": {
      "main": [
        [
          {
            "node": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0627\u0644\u0623\u0633\u0639\u0627\u0631",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0637\u0644\u0628 \u062c\u062f\u064a\u062f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0637\u0644\u0628 \u0645\u062a\u0627\u0628\u0639\u0629",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0646\u0642\u0644 \u0627\u0644\u062e\u0627\u062f\u0645\u0627\u062a",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0627\u0644\u062a\u0631\u062c\u0645\u0629",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0634\u0643\u0648\u0649",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0644\u0627\u0644\u0645\u0643\u062a\u0628",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0627\u0644\u0645\u0648\u0638\u0641",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0627\u0644\u0633\u064a\u0631": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "\u062d\u0641\u0638 \u0627\u0644\u0645\u064a\u062f\u064a\u0627",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0645\u062a\u0627\u0628\u0639\u0629": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upsert row(s)": {
      "main": [
        [
          {
            "node": "Code in JavaScript4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message2": {
      "main": [
        [
          {
            "node": "\u0625\u062f\u062e\u0627\u0644 \u0646\u0642\u0644 \u062e\u0627\u062f\u0645\u0627\u062a1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Action in an app": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0639\u0646 \u0627\u0644\u0645\u0643\u062a\u0628": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0641\u064a \u0648\u0633\u0627\u0626\u0637\u061f": {
      "main": [
        [
          {
            "node": "Action in an app",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u062a\u0646\u0632\u064a\u0644 \u0627\u0644\u0648\u0633\u0627\u0626\u0637",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "If2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript1": {
      "main": [
        [
          {
            "node": "\u0633\u062c\u0644 \u0627\u0644\u0631\u0633\u0627\u0626\u0644",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript2": {
      "main": [
        [
          {
            "node": "bot on?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript4": {
      "main": [
        [
          {
            "node": "Code in JavaScript1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Menu Cooldown Check": {
      "main": [
        [
          {
            "node": "If3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0627\u0642\u0631\u0623 \u0627\u0644\u062d\u0627\u0644\u0629": {
      "main": [
        [
          {
            "node": "\u0631\u0633\u0627\u0644\u0629 \u062c\u062f\u064a\u062f\u0629\u061f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u062d\u0641\u0638 \u0627\u0644\u0645\u064a\u062f\u064a\u0627": {
      "main": [
        [
          {
            "node": "Upsert row(s)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0633\u064a\u0631": {
      "main": [
        [
          {
            "node": "\u0625\u062f\u062e\u0627\u0644 \u0637\u0644\u0628 \u062c\u062f\u064a\u062f",
            "type": "main",
            "index": 0
          },
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0633\u062c\u0644 \u0627\u0644\u0631\u0633\u0627\u0626\u0644": {
      "main": [
        [
          {
            "node": "Code in JavaScript2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0631\u0633\u0627\u0644\u0629 \u062c\u062f\u064a\u062f\u0629\u061f": {
      "main": [
        [
          {
            "node": "Menu Cooldown Check",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "sub route",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0627\u0644\u062a\u0631\u062c\u0645\u0629 - \u0631\u0627\u0628\u0637": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u062a\u0646\u0632\u064a\u0644 \u0627\u0644\u0648\u0633\u0627\u0626\u0637": {
      "main": [
        [
          {
            "node": "Code in JavaScript1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0623\u0633\u0639\u0627\u0631": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0625\u062f\u062e\u0627\u0644 \u0637\u0644\u0628 \u062c\u062f\u064a\u062f": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0627\u0644\u062a\u062d\u062f\u062b \u0645\u0639 \u0645\u0648\u0638\u0641": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send a message3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0645\u062a\u0627\u0628\u0639\u0629": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0645\u062a\u0627\u0628\u0639\u06291": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06291": {
      "main": [
        [
          {
            "node": "\u0637\u0644\u0628 \u062c\u062f\u064a\u062f - \u0627\u062e\u062a\u0631 \u062c\u0646\u0633\u064a\u0629",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06292": {
      "main": [
        [
          {
            "node": "\u0627\u0644\u0634\u0643\u0627\u0648\u0649 - \u0627\u0637\u0644\u0628 \u062a\u0641\u0627\u0635\u064a\u0644",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06293": {
      "main": [
        [
          {
            "node": "\u0627\u0644\u0634\u0643\u0627\u0648\u0649 - \u0627\u0637\u0644\u0628 \u062a\u0641\u0627\u0635\u064a\u06441",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06294": {
      "main": [
        [
          {
            "node": "\u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0623\u0633\u0639\u0627\u0631",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06295": {
      "main": [
        [
          {
            "node": "\u0645\u062a\u0627\u0628\u0639\u0629 - \u0627\u0637\u0644\u0628 \u0631\u0642\u0645",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06296": {
      "main": [
        [
          {
            "node": "\u0646\u0642\u0644 \u062e\u0627\u062f\u0645\u0627\u062a - \u0627\u062e\u062a\u0631 \u062c\u0646\u0633\u064a\u0629",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06297": {
      "main": [
        [
          {
            "node": "\u0627\u0644\u062a\u0631\u062c\u0645\u0629 - \u0631\u0627\u0628\u0637",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06298": {
      "main": [
        [
          {
            "node": "\u0639\u0646 \u0627\u0644\u0645\u0643\u062a\u0628",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06299": {
      "main": [
        [
          {
            "node": "\u0627\u0644\u062a\u062d\u062f\u062b \u0645\u0639 \u0645\u0648\u0638\u0641",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0625\u062f\u062e\u0627\u0644 \u0646\u0642\u0644 \u062e\u0627\u062f\u0645\u0627\u062a": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send a message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u062910": {
      "main": [
        [
          {
            "node": "\u0631\u0633\u0627\u0644\u0629 \u062a\u0623\u0643\u064a\u062f \u0627\u0644\u0633\u064a\u0631\u0629",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u062911": {
      "main": [
        [
          {
            "node": "\u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0645\u062a\u0627\u0628\u0639\u0629",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u062912": {
      "main": [
        [
          {
            "node": "\u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0645\u062a\u0627\u0628\u0639\u06291",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u062913": {
      "main": [
        [
          {
            "node": "\u0631\u0633\u0627\u0644\u0629 \u062a\u0623\u0643\u064a\u062f \u0637\u0644\u0628 \u0627\u0644\u0646\u0642\u0644 \u0627\u0644\u062e\u0627\u062f\u0645\u0627\u062a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u062914": {
      "main": [
        [
          {
            "node": "\u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0633\u064a\u0631",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0645\u062a\u0627\u0628\u0639\u0629 - \u0627\u0637\u0644\u0628 \u0631\u0642\u0645": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          },
          {
            "node": "\u0645\u062a\u0627\u0628\u0639\u0629",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a": {
      "main": [
        [
          {
            "node": "\u0641\u064a \u0648\u0633\u0627\u0626\u0637\u061f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0646\u0642\u0644 \u062e\u0627\u062f\u0645\u0627\u062a \u0645\u0646 \u0627\u0644\u0634\u064a\u062a": {
      "main": [
        [
          {
            "node": "\u0625\u062f\u062e\u0627\u0644 \u0646\u0642\u0644 \u062e\u0627\u062f\u0645\u0627\u062a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0627\u0644\u0623\u0633\u0639\u0627\u0631 - \u0627\u062e\u062a\u0631 \u062c\u0646\u0633\u064a\u0629": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0634\u0643\u0648\u0649": {
      "main": [
        [
          {
            "node": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06292",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u0629 (\u0639\u0627\u0645)": {
      "main": [
        [
          {
            "node": "\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0631\u0626\u064a\u0633\u064a\u0629",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0637\u0644\u0628 \u062c\u062f\u064a\u062f - \u0627\u062e\u062a\u0631 \u062c\u0646\u0633\u064a\u0629": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0627\u0644\u0634\u0643\u0627\u0648\u0649 - \u0627\u0637\u0644\u0628 \u062a\u0641\u0627\u0635\u064a\u0644": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u0629 (\u0639\u0627\u0645)1": {
      "main": [
        [
          {
            "node": "\u0627\u0644\u0623\u0633\u0639\u0627\u0631 - \u0627\u062e\u062a\u0631 \u062c\u0646\u0633\u064a\u0629",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0627\u0644\u0634\u0643\u0627\u0648\u0649 - \u0627\u0637\u0644\u0628 \u062a\u0641\u0627\u0635\u064a\u06441": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send a message2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0627\u0644\u0645\u0648\u0638\u0641": {
      "main": [
        [
          {
            "node": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06299",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0646\u0642\u0644 \u062e\u0627\u062f\u0645\u0627\u062a - \u0627\u062e\u062a\u0631 \u062c\u0646\u0633\u064a\u0629": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          },
          {
            "node": "\u0646\u0642\u0644 \u062e\u0627\u062f\u0645\u0627\u062a \u0645\u0646 \u0627\u0644\u0634\u064a\u062a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0631\u0626\u064a\u0633\u064a\u0629": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u062a\u062d\u0636\u064a\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 - \u0627\u0644\u0623\u0633\u0639\u0627\u0631": {
      "main": [
        [
          {
            "node": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06294",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0627\u0644\u0623\u0633\u0639\u0627\u0631": {
      "main": [
        [
          {
            "node": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u0629 (\u0639\u0627\u0645)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0627\u0644\u062a\u0631\u062c\u0645\u0629": {
      "main": [
        [
          {
            "node": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06297",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0644\u0627\u0644\u0645\u0643\u062a\u0628": {
      "main": [
        [
          {
            "node": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06298",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0637\u0644\u0628 \u062c\u062f\u064a\u062f": {
      "main": [
        [
          {
            "node": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06291",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u062d\u0636\u0631 \u0627\u0644\u0627\u0631\u0633\u0627\u0644 - \u0646\u0642\u0644 \u0627\u0644\u062e\u0627\u062f\u0645\u0627\u062a": {
      "main": [
        [
          {
            "node": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u062913",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0637\u0644\u0628 \u0645\u062a\u0627\u0628\u0639\u0629": {
      "main": [
        [
          {
            "node": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06295",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u062a\u062d\u0636\u064a\u0631 \u0625\u0631\u0633\u0627\u0644 - \u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0645\u062a\u0627\u0628\u0639\u0629": {
      "main": [
        [
          {
            "node": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u062911",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0646\u0642\u0644 \u0627\u0644\u062e\u0627\u062f\u0645\u0627\u062a": {
      "main": [
        [
          {
            "node": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06296",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0634\u0643\u0648\u0649 \u062a\u0645 \u0627\u0644\u062a\u0633\u062c\u064a\u0644": {
      "main": [
        [
          {
            "node": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u06293",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0631\u0633\u0627\u0644\u0629 \u062a\u0623\u0643\u064a\u062f \u0637\u0644\u0628 \u0627\u0644\u0646\u0642\u0644 \u0627\u0644\u062e\u0627\u062f\u0645\u0627\u062a": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u062d\u0636\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u2013 \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0631\u0626\u064a\u0633\u064a\u0629": {
      "main": [
        [
          {
            "node": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u0629 (\u0639\u0627\u0645)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u062a\u062d\u0636\u064a\u0631 \u0625\u0631\u0633\u0627\u0644 - \u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0633\u064a\u0631 \u0627\u0644\u0630\u0627\u062a\u064a\u0629": {
      "main": [
        [
          {
            "node": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u062914",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u062a\u062d\u0636\u064a\u0631 \u0625\u0631\u0633\u0627\u0644 - \u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0633\u064a\u0631 \u0627\u0644\u0630\u0627\u062a\u064a\u06291": {
      "main": [
        [
          {
            "node": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u062910",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u062a\u062d\u0636\u064a\u0631 \u0625\u0631\u0633\u0627\u0644 - \u0631\u0633\u0627\u0644\u0629 \u0627\u0644\u0645\u062a\u0627\u0628\u0639\u0629 \u0644\u0627 \u064a\u0648\u062c\u062f": {
      "main": [
        [
          {
            "node": "\u0633\u062c\u0644 \u0631\u0633\u0627\u0644\u0629 \u062e\u0627\u0631\u062c\u062912",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}