{ "name": "get_order_data", "description": "IMPORTANT: Always reply to the customer in their own language — the exact language they write in. Never switch to Polish unless the customer writes in Polish.\n\nPobierz dane zamówienia z WooCommerce. Opcjonalnie podaj numer zamówienia. Email klienta jest pobierany automatycznie z bloku [CONTACT_INFO] w wiadomości — NIE musisz go podawać jako parametr ani pytać użytkownika w normalnym flow.\n\nWYJĄTEK — retry po ORDER EMAIL MISMATCH: gdy wcześniej dostałeś ORDER EMAIL MISMATCH i klient odpowiedział emailem z zamówienia — podaj TEN email (wpisany przez klienta w jego odpowiedzi, po '---') jako parametr email. NIE podawaj emaila z bloku [CONTACT_INFO] — ten już nie przeszedł weryfikacji.\n\nZawsze przekazuj parametr language z wykrytym językiem klienta, aby wartości były w odpowiedniej walucie.", "color": "linear-gradient(rgb(240,47,97), rgb(220,77,142))", "iconSrc": "", "schema": "[{\"id\":0,\"property\":\"orderNumber\",\"description\":\"Numer zamówienia WooCommerce (opcjonalny)\",\"type\":\"string\",\"required\":false},{\"id\":1,\"property\":\"email\",\"description\":\"Adres e-mail do weryfikacji zamówienia. Normalnie NIE podawaj — pobierany automatycznie z bloku [CONTACT_INFO]. Po ORDER EMAIL MISMATCH: podaj DOKŁADNIE email wpisany przez klienta w odpowiedzi (nie z [CONTACT_INFO]).\",\"type\":\"string\",\"required\":false},{\"id\":2,\"property\":\"language\",\"description\":\"Kod języka WPML wykryty z wiadomości klienta (np. pl, de, en, fr, cs, tr). Wymagany do podania wartości zamówienia w odpowiedniej walucie.\",\"type\":\"string\",\"required\":false},{\"id\":3,\"property\":\"currency\",\"description\":\"Nadpisanie waluty — podaj kod ISO 4217 (np. EUR, CZK, PLN) gdy użytkownik wyraźnie prosi o wartości zamówienia w konkretnej walucie. Opcjonalne.\",\"type\":\"string\",\"required\":false}]", "func": "const fetch = require('node-fetch')\n\nconst base = String(($vars && ($vars.relay_base || $vars.webhook_base)) || 'http://localhost:8080').replace(/\\/$/,'')\nconst secret = String(($vars && $vars.relay_shared_secret) || '')\n\nconst orderNumber = typeof $orderNumber !== 'undefined' && $orderNumber ? String($orderNumber) : ''\nconst language = typeof $language !== 'undefined' && $language ? String($language) : ''\nconst currency = typeof $currency !== 'undefined' && $currency ? String($currency).toUpperCase().trim() : ''\n\n// Email resolution priority:\n// 1. Explicit $email parameter from LLM (used in ORDER EMAIL MISMATCH retry)\n// 2. contact_email extracted from [CONTACT_INFO] block in the input (normal flow)\n// 3. $vars.sender_email fallback (Flowise variable, if configured)\nconst explicitEmail = (typeof $email !== 'undefined' && $email) ? String($email).trim() : ''\nconst inputText = ($flow && $flow.input) || ''\nconst contactEmailMatch = /contact_email:\\s*([^\\n\\]]+)/.exec(inputText)\nconst contactEmail = contactEmailMatch ? contactEmailMatch[1].trim() : String(($vars && $vars.sender_email) || '')\nconst email = explicitEmail || contactEmail\n\nif (!email) return 'Error: unable to determine customer email address required for identity verification.'\nif (!secret) return 'Error: missing $vars.relay_shared_secret'\n\ntry {\n const body = { email }\n if (orderNumber) body.orderNumber = orderNumber\n if (language) body.language = language\n if (currency) body.currency = currency\n\n const res = await fetch(`${base}/tools/get_order_data`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${secret}`\n },\n body: JSON.stringify(body)\n })\n const data = await res.json()\n if (data.ok) {\n const currencyNote = data.currency_fallback && data.currency_note ? '\\n[NOTE: ' + data.currency_note + ']' : ''\n return JSON.stringify(data.data, null, 2) + currencyNote\n }\n if (data.code === 'UNAUTHORIZED') {\n return `[ORDER EMAIL MISMATCH] contact_email='${email}' does not match order #${orderNumber}. The order was placed with a different email address. [INSTRUCTION: Inform the customer IN THEIR OWN LANGUAGE that you checked their email (${email}) but it does not match order #${orderNumber}. Ask them what email they used when placing this order. When they reply, pass their answer as the email parameter and call this tool again. Do NOT pass '${email}' as email again — it already failed.]`\n }\n return `Error: ${data.message || JSON.stringify(data)}`\n} catch (error) {\n return `Connection error: ${error?.message || String(error)}`\n}\n", "workspaceId": "048a397e-3529-48c7-9f65-ae59eb7bd783" }