{
  "id": "T34FGUZ2HaXkfEGA",
  "name": "\ud83d\ude80 AI-Powered WhatsApp Customer Support for Shopify Brands",
  "tags": [],
  "nodes": [
    {
      "id": "396cc334-cabd-4647-b625-c6d861b59c67",
      "name": "WhatsApp Trigger",
      "type": "n8n-nodes-base.whatsAppTrigger",
      "position": [
        -1776,
        880
      ],
      "parameters": {
        "options": {},
        "updates": [
          "messages"
        ]
      },
      "credentials": {
        "whatsAppTriggerApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8cc9d281-f641-45da-a241-9da9a0b9886c",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -800,
        848
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "WelcomeMsg",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "3f5d0aa4-8e80-41f4-84fd-f2f8e53cb1b2",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.categorized }}",
                    "rightValue": "Starter"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "OrderStatusQuery",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "778cb6a5-51e4-4255-8459-640670c9fd25",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.categorized }}",
                    "rightValue": "Order status"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "ProductsQuery",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "0a306950-ee2c-46fb-9b96-1942e4ef5c7e",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.categorized }}",
                    "rightValue": "Products"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "SupportQuery",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "615cd80c-dcaa-498e-8cd3-3eeecc9995d8",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.categorized }}",
                    "rightValue": "Support"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": 3
        }
      },
      "typeVersion": 3.2
    },
    {
      "id": "07e36edb-644a-4abd-a8d6-318d80edfe3c",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -272,
        544
      ],
      "parameters": {
        "sessionKey": "={{ $json.messages[0].text.body }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "0c00ac3c-4ce8-4c9f-b52c-4e09ffa33e21",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -528,
        544
      ],
      "parameters": {
        "model": "deepseek/deepseek-chat-v3.1:free",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5c14f15c-020d-4529-bed2-6b63cdad94a9",
      "name": "Get Products from Shopify",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -224,
        1136
      ],
      "parameters": {
        "url": "https://<YourStore>.myshopify.com/admin/api/2025-07/products.json",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f0005249-2e1b-4d2f-8423-b754e4152d9f",
      "name": "Normalize Input",
      "type": "n8n-nodes-base.set",
      "position": [
        -1024,
        880
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "4f012685-2724-42f6-a86e-72bf7ea300d2",
              "name": "=normalized",
              "type": "string",
              "value": "{{|const raw = $json.body || $json.text || \"\";const normalized = raw  .toLowerCase()  .trim()  .replace(/[^\\w\\s#]/g, \"\");  // keep #, remove other punctuationreturn [{  original: raw,  normalized: normalized}];}}"
            },
            {
              "id": "b320a461-bc21-43aa-bf55-d1dd583b447d",
              "name": "messages[0].text.body",
              "type": "string",
              "value": "={{ $('WhatsApp Trigger').item.json.messages[0].text.body.toLowerCase().trim().replace(/[^\\w\\s#]/g, '') }}"
            },
            {
              "id": "de55950f-a124-4af2-a8b1-ff2e3a0fcac4",
              "name": "categorized",
              "type": "string",
              "value": "={{ \n(() => {\n  const msg = ( $('WhatsApp Trigger').item.json.messages[0].text.body.toLowerCase().trim().replace(/[^\\w\\s#]/g, '')|| \"\").trim();\n  const low = msg.toLowerCase();\n\n  // Regex patterns\n  const rePriority = /\\b(not\\s+(?:acceptable|happy|satisfied|working)|angry|frustrat(?:ed|ing)|disappoint(?:ed|ing)|complain(?:t|ing)?|escalate|fed\\s*up|ridiculous|worst|cheat(?:ed)?|fake|scam|delay(?:ed)?|late|still\\s+haven'?t\\s+received|no\\s+update|i\\s+don'?t\\s+believe|unacceptable|3\\+?\\s*weeks|weeks?\\s*(?:now|and\\s*no\\s*update))\\b|[\\?\\!]{2,}/i;\n  const reRefund = /\\b(refund(?:ed|s)?|refund\\s*status|refund\\s*not\\s*(?:received|got)|return(?:s|ing)?|exchange|replacement|replace|cancel(?:led|ation)?|cancel\\s*(?:my\\s*)?order|return\\s*policy|refund\\s*policy|rto\\s*refund|money\\s*back)\\b/i;\n  const reOrder = /\\b(where\\s+is\\s+my\\s+order|order\\s*status|status\\s+of|dispatc?h(?:ed)?|shipp(?:ed|ing)?|delivery|deliver(?:ed)?\\s*(?:date|eta)?|track(?:ing)?\\s*(?:id|no\\.?|number|details)?|awb|courier|out\\s*for\\s*delivery|when\\s+can\\s+i\\s+expect|eta|tracking\\s*id|tracking\\s*no\\.?|tracking\\s*number)\\b/i;\n  const reProducts = /\\b(product(?:s)?|available|availability|catalog|collection|inventory|in\\s*stock|restock|size(?:s)?|size\\s*chart|color|colour|colors|colours|variant(?:s)?|price|pricing|cost|mrp|new\\s*arrivals?|latest)\\b/i;\n  const reStarter = /^(?:\\s*(hi|hello|hey|hola|namaste|yo|sup|greetings|gm|good\\s*morning|good\\s*afternoon|good\\s*evening|gn)\\b|\ud83d\udc4b)\\s*[!.?]*$/i;\n\n  // Priority order\n  if (reOrder.test(msg)) return \"Order status\";\n  if (reProducts.test(msg)) return \"Products\";\n  if (reStarter.test(msg) && msg.length < 40) return \"Starter\";\n  return \"Support\";\n})()\n}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3d1b7f86-9821-488f-b6bd-aaf38b241f37",
      "name": "Orders Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -416,
        256
      ],
      "parameters": {
        "text": "={{ $('WhatsApp Trigger').item.json.messages[0].text.body }}",
        "options": {
          "systemMessage": "=You are a helpful assistant\n\nYou are a WhatsApp Customer Support Agent for an e-commerce store. Your task is to read the customer\u2019s query, classify it into one of the categories below, and reply accordingly.\n\n- **OrderStatus** \u2192 Queries related to order tracking, delivery status, shipping, delays, etc.  \n  **Action**:When http request returns, fetch the status from response[0].orders.orders[0].fulfillments.fulfillments[0].shipment_status \nand tracking_url from response[0].tracking_url.\n  **Response format**:  \n  ```\n  Your order is currently in <status>.  \n  You can track it here: https://odrtrk.live/trk/<tracking_url>\n  ```\n  If order is not found:  \n  ```\n  I couldn\u2019t find your order. Could you please share your order ID?\n  ```\n\n\n### Rules\n1.Do not invent data. If order data is not found, respond with:  \n   ```\n   I couldn\u2019t find your order. Could you please share your order ID?\n   ```  "
        },
        "promptType": "define",
        "needsFallback": true,
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "f9d42ea8-c632-4864-9f21-0d919f28ee2a",
      "name": "Products Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -416,
        912
      ],
      "parameters": {
        "text": "={{ $json.messages[0].text.body }}",
        "options": {
          "systemMessage": "=ROLE\nYou are a WhatsApp Product Availability Agent for a Shopify store. Your job is to answer product availability questions by calling the \u201cGet Products from Shopify\u201d tool, filtering results, and replying with a concise list of products and their in-stock sizes.\n\nTOOLS YOU CAN USE\n- Get Products from Shopify  \u2192 returns an array of products with fields like:\n  id, title, handle, status, tags, variants[], images[], updated_at\n  Each variant has: option1 (Size), option2 (Color), price, inventory_quantity, inventory_management, status implied by product, etc.\n\nPOLICIES (MUST FOLLOW)\n1) Only consider products where product.status == \"active\".\n2) For each product, only show sizes (variants) where inventory_quantity > 0.\n   - Treat variant.option1 as the Size. (Example: \"XXL\")\n   - If multiple colors exist and the user asks for a color, filter variants by that color (option2). Otherwise, ignore color in the final list unless it helps clarity.\n3) Do not show sold-out variants (inventory_quantity <= 0) and do not mention sizes with zero inventory.\n4) If the customer asks for \u201cbest seller\u201d or \u201ctop rated\u201d:\n   - Use tags to identify them.\n   - BEST SELLER tags include: [\"best-seller\",\"bestseller\",\"best_seller\"]\n   - TOP RATED tags include: [\"top-rated\",\"top_rated\",\"toprated\"]\n   - If the user asks for \u201cnew\u201d or \u201cnew arrivals\u201d, use tags like [\"new\",\"new-drop\",\"new_arrival\",\"new_arrivals\"].\n   - If both are requested, prioritize best seller first, then top rated.\n5) If the user asks for a specific product name, search case-insensitively within product.title or handle and show only that product\u2019s in-stock sizes.\n6) Never invent data, prices, or links. Only use what the tool returns.\n7) Keep responses WhatsApp-friendly, scannable, and brief (max ~6 items). If more exist, say \u201cand more\u2026\u201d.\n8) If nothing matches or all matching sizes are out of stock, say it\u2019s currently out of stock and offer to show alternatives.\n9) Call the \u201cGet Products from Shopify\u201d tool at most once per user message. Do all filtering and formatting locally.\n\nOUTPUT FORMAT (STRICT)\n- Start with a one-line summary tailored to the query.\n- Then a bulleted list. For each product, print:\n  \u2022 {Product Title}\n  \u2022 Sizes in stock: {SIZE1} ({QTY1}), {SIZE2} ({QTY2}) \u2026\n- If the user asked \u201cbest seller\u201d or \u201ctop rated\u201d, add a short label after the title, e.g., \u201c(Best Seller)\u201d or \u201c(Top Rated)\u201d.\n- If a single product was requested, you may return just that product\u2019s line.\n\nALGORITHM (WHEN YOU REPLY)\n1) Parse the user\u2019s intent:\n   - Specific product name? (e.g., \u201cAurora\u201d, \u201cDo you have AURORA in XXL?\u201d)\n   - Category/interest? (e.g., \u201cbest sellers\u201d, \u201ctop rated\u201d, \u201cnew arrivals\u201d)\n   - Optional color/size hints (e.g., \u201cAsh Black\u201d, \u201cXXL\u201d).\n2) Call \u201cGet Products from Shopify\u201d.\n3) Filter to product.status == \"active\".\n4) If a product name/handle was mentioned, keep only those products (case-insensitive substring match).\n5) If \u201cbest sellers\u201d or \u201ctop rated\u201d were requested, filter by tags per policy.\n6) For each remaining product:\n   - Collect variants where inventory_quantity > 0.\n   - Group by Size (variant.option1). For each size, report the total inventory_quantity (or the variant\u2019s quantity if one variant per size).\n   - If no sizes remain after filtering, exclude that product from the list.\n7) Sort:\n   - If user asked best sellers \u2192 list best-seller tagged products first.\n   - If top rated \u2192 list top-rated tagged products first.\n   - Otherwise sort by most recently updated (descending) or by title ASC if no updated_at.\n8) Do not show products that are out of stock or no inventory for all its sizes\n9) Compose the WhatsApp reply using the OUTPUT FORMAT.\n\nEXAMPLES (FOLLOW EXACTLY THE FORMAT)\nUser: Do you have Aurora in XXL?\nReply:\nHere\u2019s what I found:\n\u2022 AURORA\n\u2022 Sizes in stock: XXL (9)\n\nUser: Show me best sellers in stock\nReply:\nOur best sellers available now:\n\u2022 AURORA (Best Seller)\n\u2022 Sizes in stock: XXL (9)\n(and more\u2026)\n\nUser: What are your top rated hoodies?\nReply:\nTop rated items in stock:\n\u2022 AURORA (Top Rated)\n\u2022 Sizes in stock: XXL (9)\n\nUser: What sizes are available for Aurora?\nReply:\nAvailable sizes for AURORA:\n\u2022 Sizes in stock: XXL (9)\n\nNOTES ON DATA FIELDS\n- Size is variant.option1.\n- Color is variant.option2 (use only if user mentions color).\n- Only show a product if it has at least one variant with inventory_quantity > 0.\n- Ignore non-active product statuses completely.\n\nIf at any step there is uncertainty, default to the safest truthful response (e.g., \u201cno active stock found for that item; want me to show similar items available now?\u201d) without inventing details."
        },
        "promptType": "define",
        "needsFallback": true,
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "c502f75d-cad0-42f7-8d10-bdf782e84d36",
      "name": "Get Customer from Shopify",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1472,
        880
      ],
      "parameters": {
        "url": "https://<YourStore>.myshopify.com/admin/api/2025-07/customers/search.json",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "query",
              "value": "=phone:{{ $json.contacts[0].wa_id }}"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "0da409a0-4e94-41b4-b5f6-dc8b6ee54e8f",
      "name": "Customer Details",
      "type": "n8n-nodes-base.set",
      "position": [
        -1248,
        880
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b320a461-bc21-43aa-bf55-d1dd583b447d",
              "name": "customerID",
              "type": "string",
              "value": "={{ $json.customers[0].id }}"
            },
            {
              "id": "352358ab-778a-4ada-af03-1374ca1361ca",
              "name": "customerName",
              "type": "string",
              "value": "={{ $json.customers[0].first_name }} {{ $json.customers[0].last_name }}"
            },
            {
              "id": "2268cc38-f580-4b33-b3cf-23f187df2fb4",
              "name": "lastOrderID",
              "type": "string",
              "value": "={{ $json.customers[0].last_order_id }}"
            },
            {
              "id": "c3155a8e-6ca7-4a32-9dc6-35f2e5d42402",
              "name": "CustomerPhone",
              "type": "string",
              "value": "={{ $('WhatsApp Trigger').item.json.contacts[0].wa_id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c9eeb7fe-162c-43da-b9c7-e353a2458df6",
      "name": "Get Customer Orders",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -128,
        544
      ],
      "parameters": {
        "url": "=https://<YourStore>.myshopify.com/admin/api/2025-07/customers/{{ $('Customer Details').item.json.customerID }}/orders.json",
        "options": {
          "redirect": {
            "redirect": {
              "followRedirects": false
            }
          }
        },
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "0d8eddf9-adcb-45e7-af25-0ae972e9f928",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        0,
        544
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"status\": \"fulfilled\",\n\t\"tracking_url\": \"/123254\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "b4b475fb-e3d0-4a95-9120-2b5ff9f4abfa",
      "name": "Structured Output Parser1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -64,
        1136
      ],
      "parameters": {
        "jsonSchemaExample": "[\n  {\n\t\"productName\": \"Product Name\",\n\t\"sizes\": \"XXXS (4) XXS (17) XS (29) S (102)\"\n  }\n]"
      },
      "typeVersion": 1.3
    },
    {
      "id": "a4aa7f20-2ef5-436a-835a-d0b8e2ad212e",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -400,
        544
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "78867e2c-05f6-4685-9cd8-edd7af5fd015",
      "name": "Send a message to support",
      "type": "n8n-nodes-base.slack",
      "position": [
        -320,
        1312
      ],
      "parameters": {
        "text": "={{ $('WhatsApp Trigger').item.json.messages[0].text.body }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09DP0XJ961",
          "cachedResultName": "customer-support"
        },
        "otherOptions": {
          "sendAsUser": "={{ $('Customer Details').item.json.customerName }}",
          "includeLinkToWorkflow": false
        }
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "87eef063-0bc0-4ba1-ba61-660f511e32e3",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -64,
        1312
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1d14573b-ca33-4a59-9a0e-fda3d93e996f",
      "name": "Welcome message",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        -384,
        48
      ],
      "parameters": {
        "textBody": "=Hello {{ $('Customer Details').item.json.customerName }}! Welcome. How can I assist you today?",
        "operation": "send",
        "phoneNumberId": "792860653905890",
        "additionalFields": {},
        "recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.contacts[0].wa_id}}"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "edce7929-b3e4-40c1-85c4-b8e9e523ecb0",
      "name": "Send Order Status",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        80,
        256
      ],
      "parameters": {
        "textBody": "={{ \n  \"Hi \" + ($('Customer Details').item.json.customerName || \"there\") + \",\\n\" +\n  \"I\u2019ve checked your order and it is currently \" + \n  $json[\"output\"][\"status\"].replace(/_/g, \" \") + \" \ud83d\ude9a.\\n\" +\n  \"You can follow its journey anytime using this link: \" + \n  $json[\"output\"][\"tracking_url\"] + \".\\n\" +\n  \"Thank you for your patience \u2014 your package is on the way! \ud83d\udc99\"\n}}\n",
        "operation": "send",
        "phoneNumberId": "792860653905890",
        "additionalFields": {},
        "recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.contacts[0].wa_id}}"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "eb8c54b5-ad12-401e-a3c2-a2f2d0ee7f6c",
      "name": "Send Products message",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        176,
        912
      ],
      "parameters": {
        "textBody": "={{\n(() => {\n  const products = ($node[\"Products Agent\"].json.output || []);\n\n  const lines = products.map(p => {\n    // sizes can be an array OR a comma-separated string; normalize to array\n    const arr = Array.isArray(p.sizes)\n      ? p.sizes\n      : (typeof p.sizes === 'string'\n          ? p.sizes.split(',').map(s => s.trim()).filter(Boolean)\n          : []);\n\n    const sizesText = arr.length ? \"Sizes: \" + arr.join(\", \") : \"\u274c Currently out of stock\";\n    return \"\u2728 \" + p.productName + \"\\n\" + sizesText;\n  });\n\n  return \"\ud83d\udc4b Hey there!\\nHere are our latest available pieces:\\n\\n\"\n    + lines.join(\"\\n\\n\");\n})()\n}}",
        "operation": "send",
        "phoneNumberId": "792860653905890",
        "additionalFields": {},
        "recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.contacts[0].wa_id}}"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2345427f-6889-4832-865d-3b836e4aa1b8",
      "name": "No Operation, do nothing1",
      "type": "n8n-nodes-base.noOp",
      "position": [
        400,
        912
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "89e578a3-e4ea-4586-a390-8db20665734e",
      "name": "No Operation, do nothing2",
      "type": "n8n-nodes-base.noOp",
      "position": [
        288,
        256
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "545d1354-b7c4-4a2b-bcac-bc772f18a119",
      "name": "No Operation, do nothing3",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -176,
        48
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "7eaa8330-1b6f-4ee9-a6bf-71895a0c28ec",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1488,
        656
      ],
      "parameters": {
        "color": 5,
        "width": 352,
        "height": 576,
        "content": "**Get Customer details from shopify** retrieves user information based on their WhatsApp number.\nIt fetches profile and order-related data from Shopify to identify the customer.\nThe details are then normalized to ensure consistent formatting for downstream workflow steps."
      },
      "typeVersion": 1
    },
    {
      "id": "755da7df-b610-4f08-ab26-f510bef9dc31",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1088,
        736
      ],
      "parameters": {
        "color": 3,
        "height": 448,
        "content": "**Normalize Input** ensures user queries are cleaned, standardized, and free of noise.  \nIt also categorizes the input, preparing it for accurate intent detection in the next step.  \n"
      },
      "typeVersion": 1
    },
    {
      "id": "88df567c-28c0-44d0-8075-5aaa795b9f27",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "color": 4,
        "width": 448,
        "height": 192,
        "content": "### Welcome whatsapp message\n![](https://ik.imagekit.io/tscnqj8zf/welcome.png?updatedAt=1757147294837)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c3069b7b-4689-4eea-8ab0-bcce59fdc72a",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        208
      ],
      "parameters": {
        "color": 4,
        "width": 560,
        "height": 352,
        "content": "### Order status whatsapp message\n![](https://ik.imagekit.io/tscnqj8zf/orders.png?updatedAt=1757147297281)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d37a5a15-30af-486a-acb9-fb92f49163a4",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        864
      ],
      "parameters": {
        "color": 4,
        "width": 560,
        "height": 352,
        "content": "### Products Info whatsapp message\n![](https://ik.imagekit.io/tscnqj8zf/products.png?updatedAt=1757147299171)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "22959921-9aa3-4865-89b8-7a5cc68c4834",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        1264
      ],
      "parameters": {
        "color": 4,
        "width": 560,
        "height": 352,
        "content": "### Slack message to Customer support\n![](https://ik.imagekit.io/tscnqj8zf/slackimage.png?updatedAt=1757147311870)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1f5a72de-8a8f-46aa-b00c-3bc22ea6180a",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1840,
        704
      ],
      "parameters": {
        "color": 6,
        "width": 272,
        "height": 512,
        "content": "**WhatsApp Trigger** listens for incoming customer messages on WhatsApp.  \nIt captures the text, sender ID, and metadata to initiate the workflow.  \nThis ensures every query received on WhatsApp is processed in real time.  \n"
      },
      "typeVersion": 1
    },
    {
      "id": "24c5a5e5-5623-4f7c-b67c-55015b52378a",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2592,
        368
      ],
      "parameters": {
        "width": 656,
        "height": 1184,
        "content": "# \ud83d\ude80 Try It Out!\n\nThis n8n template demonstrates how to build an **AI-powered WhatsApp & Shopify Support Copilot**.  \nIt integrates **WhatsApp Business API**, **Shopify API**, and **LLM Agents** to handle order status queries, product lookups, and customer support escalation.\n\n**Use cases**: Automate order tracking, respond with real-time product availability, or escalate complex issues to a Slack support channel.\n\n---\n\n## How it works\n- **Trigger**: A WhatsApp webhook activates on every new customer message.  \n- **Customer Lookup**: Fetches details from Shopify using the customer\u2019s WhatsApp number.  \n- **Input Normalization**: Cleans and categorizes user queries.  \n- **Intent Switch**: Routes requests to Order Agent, Product Agent, or Support.  \n- **Orders Agent**: Retrieves latest Shopify order data, parses, and sends status via WhatsApp.  \n- **Products Agent**: Pulls inventory & best sellers from Shopify and replies with sizes/availability.  \n- **Support Escalation**: Posts unresolved queries to Slack for human intervention.\n\n---\n\n## How to use\n- Configure **WhatsApp Business API**, **Shopify Admin API**, and **Slack OAuth** credentials in n8n.  \n- Sync products via Shopify API.  \n- Test with queries like \u201cWhere is my order?\u201d or \u201cShow me best sellers.\u201d  \n- Escalate unresolved issues directly to Slack with context.\n\n---\n\n## Requirements\n- WhatsApp Business API (Meta, Twilio, or Exotel)  \n- Shopify Admin API access  \n- LLM provider key (OpenAI / OpenRouter)  \n- Slack OAuth or webhook for human support  \n\n---\n\n\ud83d\udca1 Always open to feedback and improvements! **DM me**\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "c0897329-bdef-49a0-8e31-b1173351ef5a",
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "Welcome message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Orders Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Products Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send a message to support",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Orders Agent": {
      "main": [
        [
          {
            "node": "Send Order Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Products Agent",
            "type": "ai_memory",
            "index": 0
          },
          {
            "node": "Orders Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Products Agent": {
      "main": [
        [
          {
            "node": "Send Products message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Input": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Welcome message": {
      "main": [
        [
          {
            "node": "No Operation, do nothing3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Customer Details": {
      "main": [
        [
          {
            "node": "Normalize Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WhatsApp Trigger": {
      "main": [
        [
          {
            "node": "Get Customer from Shopify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Orders Agent",
            "type": "ai_languageModel",
            "index": 1
          },
          {
            "node": "Products Agent",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "Send Order Status": {
      "main": [
        [
          {
            "node": "No Operation, do nothing2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Customer Orders": {
      "ai_tool": [
        [
          {
            "node": "Orders Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Products Agent",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Orders Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Send Products message": {
      "main": [
        [
          {
            "node": "No Operation, do nothing1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Orders Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Get Customer from Shopify": {
      "main": [
        [
          {
            "node": "Customer Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Products from Shopify": {
      "ai_tool": [
        [
          {
            "node": "Products Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Send a message to support": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "Products Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}