AutomationFlowsEmail & Gmail › Interactive Recruitment Customer Service with Whatsapp, Google Sheets CRM

Interactive Recruitment Customer Service with Whatsapp, Google Sheets CRM

ByMira Melhem @melhem on n8n.io

Automate WhatsApp communication for recruitment agencies with an interactive, structured customer experience. This workflow handles pricing inquiries, request submissions, tracking, complaints, and human escalation while maintaining full session tracking and media support. Uses…

Webhook trigger★★★★★ complexity96 nodesHTTP RequestGoogle SheetsGmailData Table
Email & Gmail Trigger: Webhook Nodes: 96 Complexity: ★★★★★ Added:

This workflow corresponds to n8n.io template #11604 — we link there as the canonical source.

This workflow follows the Datatable → Gmail recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "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     

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

How this works

This workflow gives recruitment agencies a fully interactive WhatsApp service that handles pricing questions, job applications, status checks, and complaints without constant manual replies. It pulls data from Google Sheets to deliver accurate, personalised responses and routes complex issues to human agents while keeping every conversation tracked. The key step is the structured menu system that guides users through choices in Arabic and English, supported by media messages and session memory.

Use it when you need reliable, round-the-clock WhatsApp support for high-volume inquiries; avoid it for one-off campaigns or when you require deep custom AI logic. Common variations include adding extra menu options for new services or routing complaints directly to Gmail for faster follow-up.

About this workflow

Automate WhatsApp communication for recruitment agencies with an interactive, structured customer experience. This workflow handles pricing inquiries, request submissions, tracking, complaints, and human escalation while maintaining full session tracking and media support. Uses…

Source: https://n8n.io/workflows/11604/ — original creator credit. Request a take-down →

More Email & Gmail workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Email & Gmail

Ticketing Backend automates registration, QR-ticket generation, email delivery, and check-in validation using Google Sheets, Gmail, and a webhook scanner — reducing manual ticket prep from ~3 hours to

Google Sheets, HTTP Request, Gmail
Email & Gmail

Who is this for? This template is ideal for event organizers, conference managers, and community teams who need an automated participant management system. Perfect for workshops, conferences, meetups,

Google Sheets, HTTP Request, Gmail +1
Email & Gmail

Streamline and standardize your entire client onboarding process with a single end-to-end automation. 🚀📋 This workflow captures detailed client intake data via webhook, automatically creates a fully s

Slack, Asana, HTTP Request +4
Email & Gmail

Human Approval AI Response. Uses httpRequest, slack, gmail, googleSheets. Webhook trigger; 20 nodes.

HTTP Request, Slack, Gmail +2
Email & Gmail

This n8n template automatically monitors website performance using Google's PageSpeed Insights API, compiles detailed reports, and tracks performance trends over time in Google Sheets.

HTTP Request, Google Sheets, Gmail