{
  "name": "Encuentra clientes · Prospectos con demo y primer mensaje",
  "nodes": [
    {
      "parameters": {
        "authentication": "none",
        "formTitle": "Encuentra clientes",
        "formDescription": "Busca negocios en Google Maps, lee su web y sus reseñas, y te deja en la hoja Prospectos los que más necesitan una recepcionista con IA, cada uno con su demo y su primer mensaje.",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Nicho",
              "fieldName": "nicho",
              "fieldType": "text",
              "defaultValue": "dentista",
              "requiredField": true
            },
            {
              "fieldLabel": "Ciudad",
              "fieldName": "ciudad",
              "fieldType": "text",
              "placeholder": "Guadalajara, Jalisco",
              "requiredField": true
            },
            {
              "fieldLabel": "Zonas (una por línea; cada zona trae hasta 60 negocios)",
              "fieldName": "zonas",
              "fieldType": "textarea",
              "placeholder": "Providencia\nChapultepec\nZapopan Centro"
            },
            {
              "fieldLabel": "¿Cuántos prospectos quieres en la hoja?",
              "fieldName": "cuantos",
              "fieldType": "number",
              "defaultValue": "20"
            }
          ]
        },
        "responseMode": "onReceived",
        "options": {
          "path": "encuentra-clientes",
          "buttonLabel": "Buscar",
          "respondWithOptions": {
            "values": {
              "respondWith": "text",
              "formSubmittedText": "Listo. En unos minutos tienes tus prospectos en la hoja Prospectos."
            }
          }
        }
      },
      "id": "1656bb7d-3e34-46e9-a0bd-fa5366d2a75f",
      "name": "Busca clientes",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.6,
      "position": [
        0,
        380
      ],
      "webhookId": "a2d40103-91c9-4ea7-a7ba-c0957fb90414"
    },
    {
      "parameters": {
        "mode": "manual",
        "assignments": {
          "assignments": [
            {
              "id": "e3da4b6c-32b8-437e-a675-1edfc933157b",
              "name": "tuNombre",
              "value": "Tu nombre",
              "type": "string"
            },
            {
              "id": "fc73b36b-91e4-4ecc-ac7a-cc88e88a36b5",
              "name": "demoUrl",
              "value": "={{ $execution.resumeUrl.replace(/\\/webhook-waiting\\/.*$/, '') }}/webhook/demo-recepcionista",
              "type": "string"
            },
            {
              "id": "b41afe7d-d4c8-414e-a918-35720527f237",
              "name": "idioma",
              "value": "es",
              "type": "string"
            },
            {
              "id": "0807c054-1d9f-467b-a09c-228f37f9b5f6",
              "name": "region",
              "value": "MX",
              "type": "string"
            },
            {
              "id": "9b01e3f5-8970-47cd-ad85-f90195a6d5b8",
              "name": "maxInvestigar",
              "value": 200,
              "type": "number"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "id": "89703390-a034-43e6-ad4c-c8606f0488cb",
      "name": "Tus datos",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        220,
        380
      ]
    },
    {
      "parameters": {
        "jsCode": "// One Google Maps text search per zone: \"<nicho> en <zona>, <ciudad>\" (max 30 zones per run).\n// Without zones, a single search for the whole city.\nconst f = $('Tus datos').first().json;\nconst limpia = (s) => String(s ?? '').replace(/\\s+/g, ' ').trim();\nconst nicho = limpia(f.nicho) || 'dentista';\nconst ciudad = limpia(f.ciudad);\nconst vistas = new Set();\nconst zonas = String(f.zonas ?? '')\n  .split(/[\\n;]+/)\n  .map(limpia)\n  .filter((z) => {\n    const clave = z.toLowerCase();\n    if (!z || vistas.has(clave)) return false;\n    vistas.add(clave);\n    return true;\n  })\n  .slice(0, 30);\nconst consultas = zonas.length ? zonas.map((z) => `${nicho} en ${z}${ciudad ? ', ' + ciudad : ''}`) : [`${nicho} en ${ciudad}`];\nreturn consultas.map((textQuery) => ({ json: { textQuery } }));"
      },
      "id": "f89f7e54-8dbc-4a51-a413-61b7486e2362",
      "name": "Arma las búsquedas",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        440,
        380
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://places.googleapis.com/v1/places:searchText",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "specifyHeaders": "keypair",
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Goog-FieldMask",
              "value": "places.id,places.displayName,places.formattedAddress,places.internationalPhoneNumber,places.nationalPhoneNumber,places.websiteUri,places.googleMapsUri,places.rating,places.userRatingCount,places.regularOpeningHours,places.reviews,places.businessStatus,nextPageToken"
            }
          ]
        },
        "sendBody": true,
        "contentType": "json",
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ textQuery: $json.textQuery, languageCode: $('Tus datos').first().json.idioma, regionCode: $('Tus datos').first().json.region, pageSize: 20 }) }}",
        "options": {
          "batching": {
            "batch": {
              "batchSize": 1,
              "batchInterval": 300
            }
          },
          "pagination": {
            "pagination": {
              "paginationMode": "updateAParameterInEachRequest",
              "parameters": {
                "parameters": [
                  {
                    "type": "body",
                    "name": "pageToken",
                    "value": "={{ $response.body.nextPageToken }}"
                  }
                ]
              },
              "paginationCompleteWhen": "other",
              "completeExpression": "={{ !$response.body.nextPageToken }}",
              "limitPagesFetched": true,
              "maxRequests": 3,
              "requestInterval": 1000
            }
          }
        }
      },
      "id": "b0149388-10e2-4c6b-ae50-a3fef1e26d15",
      "name": "Busca en Google Maps",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        660,
        380
      ]
    },
    {
      "parameters": {
        "jsCode": "// Every page of every search -> one list of places: no repeats, only open businesses, capped at maxInvestigar.\n// Websites that are only a social profile are not read (they say nothing about chat), but they count as a signal.\nconst cfg = $('Tus datos').first().json;\nconst maximo = Math.max(1, Math.min(500, Number(cfg.maxInvestigar) || 200));\nconst corta = (s, n) => String(s ?? '').replace(/\\s+/g, ' ').trim().slice(0, n);\nconst SOCIAL = /^(https?:\\/\\/)?([a-z0-9-]+\\.)*(facebook\\.com|fb\\.com|instagram\\.com|linktr\\.ee|wa\\.me|whatsapp\\.com|tiktok\\.com|twitter\\.com|x\\.com|youtube\\.com|google\\.com|business\\.site|g\\.page)(\\/|$)/i;\nconst vistos = new Set();\nconst out = [];\nfor (const { json: respuesta } of $input.all()) {\n  for (const p of Array.isArray(respuesta.places) ? respuesta.places : []) {\n    if (!p || !p.id || vistos.has(p.id)) continue;\n    if (p.businessStatus && p.businessStatus !== 'OPERATIONAL') continue;\n    vistos.add(p.id);\n    const web = /^https?:\\/\\//i.test(String(p.websiteUri ?? '')) ? String(p.websiteUri).trim() : '';\n    const social = !!web && SOCIAL.test(web);\n    out.push({\n      json: {\n        placeId: p.id,\n        nombre: corta(p.displayName?.text, 100),\n        direccion: corta(p.formattedAddress, 200),\n        telefono: corta(p.internationalPhoneNumber || p.nationalPhoneNumber, 30),\n        web,\n        social,\n        webParaLeer: social ? '' : web,\n        maps: String(p.googleMapsUri ?? ''),\n        rating: Number(p.rating) || 0,\n        total: Number(p.userRatingCount) || 0,\n        horario: p.regularOpeningHours && typeof p.regularOpeningHours === 'object' ? p.regularOpeningHours : null,\n        resenas: (Array.isArray(p.reviews) ? p.reviews : [])\n          .map((r) => ({\n            estrellas: Number(r.rating) || 0,\n            hace: corta(r.relativePublishTimeDescription, 40),\n            texto: corta(r.originalText?.text || r.text?.text, 1200),\n          }))\n          .filter((r) => r.texto),\n      },\n    });\n    if (out.length >= maximo) return out;\n  }\n}\nreturn out;"
      },
      "id": "5026c848-207a-48fb-adef-0689e0f21450",
      "name": "Junta las clínicas",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        900,
        380
      ]
    },
    {
      "parameters": {
        "method": "GET",
        "url": "={{ $json.webParaLeer }}",
        "authentication": "none",
        "sendHeaders": true,
        "specifyHeaders": "keypair",
        "headerParameters": {
          "parameters": [
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (compatible; EncuentraClientes/1.0)"
            },
            {
              "name": "Accept-Language",
              "value": "es"
            }
          ]
        },
        "options": {
          "allowUnauthorizedCerts": true,
          "timeout": 10000,
          "batching": {
            "batch": {
              "batchSize": 10,
              "batchInterval": 0
            }
          },
          "response": {
            "response": {
              "responseFormat": "text",
              "outputPropertyName": "html"
            }
          }
        }
      },
      "id": "33f073bd-5e0f-4771-a347-0ab7b53ce201",
      "name": "Lee su web",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1120,
        380
      ],
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "jsCode": "// Joins each place with its website (same order as \"Lee su web\") and computes the signals the reel shows:\n// closing time, chat or online booking on the website, WhatsApp on the website, and reviews (3 stars or less)\n// that complain nobody answers. preNota (0-10) is a fixed score: tie-breaker and fallback for the AI's grade.\nconst cfg = $('Tus datos').first().json;\nconst lugares = $('Junta las clínicas').all().map((i) => i.json);\nconst webs = $input.all().map((i) => i.json);\nconst corta = (s, n) => String(s ?? '').replace(/\\s+/g, ' ').trim().slice(0, n);\n\nconst ENTIDADES = { nbsp: ' ', amp: '&', quot: '\"', apos: \"'\", lt: '<', gt: '>', aacute: 'á', eacute: 'é', iacute: 'í', oacute: 'ó', uacute: 'ú', ntilde: 'ñ', uuml: 'ü', Aacute: 'Á', Eacute: 'É', Iacute: 'Í', Oacute: 'Ó', Uacute: 'Ú', Ntilde: 'Ñ', iexcl: '¡', iquest: '¿' };\nconst caracter = (n) => (n > 0 && n <= 0x10ffff ? String.fromCodePoint(n) : ' ');\nconst textoVisible = (html) =>\n  String(html)\n    .replace(/<(script|style|noscript|svg|template)\\b[\\s\\S]*?<\\/\\1>/gi, ' ')\n    .replace(/<!--[\\s\\S]*?-->/g, ' ')\n    .replace(/<[^>]+>/g, ' ')\n    .replace(/&#(\\d+);/g, (_, n) => caracter(Number(n)))\n    .replace(/&#x([0-9a-f]+);/gi, (_, n) => caracter(parseInt(n, 16)))\n    .replace(/&([a-z]+);/gi, (m, n) => ENTIDADES[n] ?? m)\n    .replace(/\\s+/g, ' ')\n    .trim();\n\nconst CHATS = [\n  ['Tawk.to', /embed\\.tawk\\.to/i], ['Tidio', /code\\.tidio\\.co/i], ['Crisp', /client\\.crisp\\.chat/i], ['Intercom', /widget\\.intercom\\.io|intercomcdn\\.com/i],\n  ['Zendesk', /static\\.zdassets\\.com|zopim/i], ['LiveChat', /cdn\\.livechatinc\\.com/i], ['JivoChat', /code\\.jivosite\\.com|jivochat/i], ['Smartsupp', /smartsuppchat\\.com/i],\n  ['HubSpot', /js\\.usemessages\\.com/i], ['ManyChat', /manychat\\.com/i], ['Botpress', /botpress/i], ['Landbot', /landbot\\.io/i], ['Chatbase', /chatbase\\.co/i],\n  ['n8n', /@n8n\\/chat/i], ['Drift', /js\\.driftt\\.com/i], ['Freshchat', /wchat\\.freshchat\\.com/i], ['Kommo', /kommo\\.com/i], ['Callbell', /callbell\\.eu/i],\n  ['Wati', /wati\\.io/i], ['Respond.io', /respond\\.io/i], ['Leadsales', /leadsales\\.io/i], ['Olark', /static\\.olark\\.com/i], ['Userlike', /userlike-cdn|userlike\\.com/i],\n  ['Messenger', /xfbml\\.customerchat/i],\n];\nconst AGENDA = /doctoralia|docplanner|calendly\\.com|agendapro|cal\\.com\\/|reservo\\.cl|simplybook|setmore|acuityscheduling|booksy|fresha\\.com|youcanbook|dentalink|(agenda|reserva)r?\\s+(tu\\s+|su\\s+|una\\s+)?cita\\s+en\\s+l[ií]nea|(agenda|reserva)\\s+en\\s+l[ií]nea/i;\nconst WA = /(?:wa\\.me\\/|api\\.whatsapp\\.com\\/send\\/?\\?(?:[^\"'\\s>]*?&(?:amp;)?)?phone=|whatsapp\\.com\\/send\\?phone=)\\+?(\\d{8,15})/i;\n// \"nobody answers\" complaints; only counted in reviews of 3 stars or less\nconst QUEJAS = [\n  /\\b(no|nunca|jam[aá]s|nadie)\\b[^.,;!?\\n]{0,20}?\\b(contest|respond)\\w*/i,\n  /\\b(no|nunca|jam[aá]s|nadie)\\s+(me\\s+|nos\\s+|les\\s+|te\\s+)?atiend\\w*\\s+(el\\s+|los\\s+|la\\s+|las\\s+|al\\s+)?(tel[eé]fono|whats\\w*|mensajes?|llamadas?|celular)/i,\n  /\\bno\\s+(me\\s+|nos\\s+|te\\s+)?(regres|devolv|devuelv)\\w*\\s+(la\\s+|las\\s+)?llamadas?/i,\n  /sin\\s+respuesta|dej\\w*\\s+en\\s+visto|imposible\\s+(comunicar|contactar|localizar)|dif[ií]cil\\s+(comunicar|contactar)|tardan?\\w*\\s+[^.,;!?\\n]{0,25}?(contestar|responder)/i,\n];\nconst frases = (t) => String(t).split(/(?<=[.!?¡¿…])\\s+|\\n+/).map((f) => f.trim()).filter(Boolean);\nconst hhmm = (m) => `${String(Math.floor(m / 60) % 24).padStart(2, '0')}:${String(m % 60).padStart(2, '0')}`;\nconst leeHorario = (oh) => {\n  const periodos = Array.isArray(oh?.periods) ? oh.periods : [];\n  if (!periodos.length) return { cierraMin: null, abreDomingo: null, siempre: false };\n  const p0 = periodos[0];\n  if (periodos.length === 1 && p0.open && p0.open.day === 0 && !(p0.open.hour ?? 0) && !(p0.open.minute ?? 0) && !p0.close) {\n    return { cierraMin: 24 * 60, abreDomingo: true, siempre: true };\n  }\n  let cierra = null;\n  for (const p of periodos) {\n    const a = p.open;\n    const c = p.close;\n    if (!a || !c || a.day < 1 || a.day > 5) continue; // Monday to Friday\n    let min = (c.hour ?? 0) * 60 + (c.minute ?? 0);\n    if (c.day !== a.day) min += 24 * 60;\n    cierra = cierra === null ? min : Math.max(cierra, min);\n  }\n  return { cierraMin: cierra, abreDomingo: periodos.some((p) => p.open && p.open.day === 0), siempre: false };\n};\n\nreturn lugares.map((l, i) => {\n  const r = webs[i] ?? {};\n  const html = !r.error && typeof r.html === 'string' ? r.html : '';\n  const leida = html.length > 200;\n  const textoWeb = leida ? corta(textoVisible(html), 2500) : '';\n  const chat = leida ? (CHATS.find(([, re]) => re.test(html)) ?? [''])[0] : '';\n  const agenda = AGENDA.test(l.web) || (leida && (AGENDA.test(html) || AGENDA.test(textoWeb)));\n  const wa = (leida ? html.match(WA) : null) ?? (l.social ? l.web.match(WA) : null);\n  const h = leeHorario(l.horario);\n  const quejas = [];\n  for (const rv of l.resenas) {\n    if (rv.estrellas > 3) continue;\n    const f = frases(rv.texto).find((x) => QUEJAS.some((re) => re.test(x)));\n    if (f) quejas.push(corta(f, 160));\n  }\n\n  let preNota = 0;\n  if (quejas.length) preNota += 3;\n  if (quejas.length > 1) preNota += 2;\n  if (leida && !chat) preNota += 2;\n  else if (!l.web || l.social) preNota += 1;\n  if (h.cierraMin !== null && h.cierraMin < 20 * 60) preNota += 1;\n  if (h.abreDomingo === false) preNota += 1;\n  if (l.total >= 40) preNota += 1;\n  preNota = Math.min(10, preNota);\n\n  const cierra = h.siempre ? '24 h' : h.cierraMin !== null ? hhmm(h.cierraMin) : '';\n  const webEstado = !l.web ? 'no tiene' : l.social ? `solo redes sociales (${l.web})` : leida ? l.web : `${l.web} (no se pudo leer)`;\n  const partes = [];\n  if (h.siempre) partes.push('Abre 24 h');\n  else if (cierra) partes.push(`Cierra ${cierra}`);\n  if (!l.web) partes.push('Sin web');\n  else if (l.social) partes.push('Solo redes, sin web propia');\n  else if (!leida) partes.push('No se pudo leer su web');\n  else partes.push(chat ? `Chat en la web (${chat})` : 'Sin chat en la web');\n  if (agenda) partes.push('Agenda en línea');\n  if (quejas.length) partes.push(`${quejas.length} ${quejas.length === 1 ? 'reseña dice' : 'reseñas dicen'} que no contestan`);\n  if (l.rating) partes.push(`★${l.rating} (${l.total} reseñas)`);\n\n  const horarioTexto = Array.isArray(l.horario?.weekdayDescriptions) ? l.horario.weekdayDescriptions.join(' · ') : '';\n  const contexto = [\n    `Negocio: ${l.nombre}`,\n    `Dirección: ${l.direccion || 'sin dato'}`,\n    `Calificación en Google: ${l.rating ? `${l.rating} (${l.total} reseñas)` : 'sin calificación'}`,\n    `Horario: ${horarioTexto || 'sin dato'}`,\n    `Web: ${webEstado}`,\n    `Chat o bot en la web: ${leida ? chat || 'no se encontró' : 'no se sabe'}`,\n    `Agenda en línea: ${agenda ? 'sí' : 'no se encontró'}`,\n    `Botón de WhatsApp en la web: ${wa ? 'sí' : 'no se encontró'}`,\n    `Reseñas (las más relevantes según Google, máximo 5):`,\n    ...(l.resenas.length ? l.resenas.map((rv, k) => `${k + 1}. ${rv.estrellas}★${rv.hace ? ' · ' + rv.hace : ''}: \"${rv.texto}\"`) : ['(sin reseñas)']),\n    `Texto de su web (inicio):`,\n    textoWeb || '(no disponible)',\n  ].join('\\n');\n\n  return {\n    json: {\n      placeId: l.placeId,\n      nombre: l.nombre,\n      direccion: l.direccion,\n      telefono: l.telefono,\n      whatsapp: wa ? wa[1] : '',\n      web: l.web,\n      maps: l.maps,\n      rating: l.rating,\n      total: l.total,\n      horarioTexto,\n      cierra,\n      chat,\n      agenda,\n      webLeida: leida,\n      quejas,\n      resenas: l.resenas,\n      textoWeb,\n      preNota,\n      senales: partes.join(' · '),\n      contexto,\n      nicho: String(cfg.nicho ?? '').trim() || 'dentista',\n      ciudad: String(cfg.ciudad ?? '').trim(),\n    },\n  };\n});"
      },
      "id": "78001c1c-d200-4e38-a36c-b0e215ec0d45",
      "name": "Señales",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1340,
        380
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Trabajas para alguien que vende recepcionistas con IA (contestan el WhatsApp a cualquier hora, agendan citas y avisan urgencias) a negocios de tipo \"{{ $json.nicho }}\".\n\nCalifica del 1 al 10 qué tanto necesita ESTE negocio una recepcionista así, solo con los datos de abajo.\n- Sube la nota: reseñas que se quejan de que no contestan el teléfono o el WhatsApp, o de que es difícil agendar; no tener chat ni agenda en línea; cerrar temprano o no abrir en fin de semana; muchas reseñas (tiene volumen de pacientes).\n- Baja la nota: ya tiene chat o agenda en línea; reseñas que elogian lo rápido que contestan; muy pocas reseñas.\n\nResponde con:\n- nota: entero del 1 al 10.\n- motivo: una frase de máximo 120 caracteres, para el vendedor, con la razón principal.\n- evidencia: un fragmento copiado EXACTO (sin cambiar ni una letra) de una sola reseña, de máximo 160 caracteres, donde alguien se queja de que no le contestan o no lo atienden. Si ninguna reseña lo dice, deja \"\".\n- servicios: hasta 8 servicios que aparezcan escritos en el texto de su web (por ejemplo \"Ortodoncia\"), copiados tal cual. Si no hay texto de la web o no aparecen, deja [].\nNunca inventes datos.\n\n{{ $json.contexto }}",
        "hasOutputParser": true,
        "batching": {
          "batchSize": 5,
          "delayBetweenBatches": 0
        }
      },
      "id": "f8a2371b-c5ee-4c51-afa0-08999bae860b",
      "name": "Califica con IA",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.9,
      "position": [
        1580,
        380
      ],
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "claude-haiku-5-5"
        },
        "options": {
          "maxTokensToSample": 1024,
          "thinkingMode": "disabled"
        }
      },
      "id": "5b348c86-ca4d-41d8-aba0-636c691f1ee1",
      "name": "Claude rápido",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.6,
      "position": [
        1520,
        620
      ]
    },
    {
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"nota\": {\n      \"type\": \"integer\",\n      \"minimum\": 1,\n      \"maximum\": 10\n    },\n    \"motivo\": {\n      \"type\": \"string\",\n      \"description\": \"Razón principal, máximo 120 caracteres\"\n    },\n    \"evidencia\": {\n      \"type\": \"string\",\n      \"description\": \"Fragmento exacto de una reseña, o vacío\"\n    },\n    \"servicios\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      },\n      \"description\": \"Servicios escritos en su web, máximo 8\"\n    }\n  },\n  \"required\": [\n    \"nota\",\n    \"motivo\",\n    \"evidencia\",\n    \"servicios\"\n  ]\n}"
      },
      "id": "7216e613-00a9-47c8-a6a6-7bf083c7e6a3",
      "name": "Formato de la calificación",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        1680,
        620
      ]
    },
    {
      "parameters": {
        "jsCode": "// Joins each place with the AI's grade (same order as \"Califica con IA\") and keeps only what can be proved:\n// - the quote must appear word for word in one of its reviews (else the flow's own complaint sentence, or none)\n// - services must appear in the text of its website\n// - grade 1-10 from the AI; if the AI failed, the fixed preNota\n// Then sorts and keeps the best N, each with a short stable ID and its demo link.\nconst cfg = $('Tus datos').first().json;\nconst base = $('Señales').all().map((i) => i.json);\nconst ia = $input.all().map((i) => i.json);\nconst cuantos = Math.max(1, Math.min(100, Math.round(Number(cfg.cuantos) || 20)));\nconst corta = (s, n) => String(s ?? '').replace(/\\s+/g, ' ').trim().slice(0, n);\nconst plano = (s) => String(s ?? '').normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase().replace(/[«»\"“”'‘’]/g, '').replace(/\\s+/g, ' ').trim();\n// FNV-1a, twice with different seeds -> 12 URL-safe characters\nconst fnv = (s, seed) => {\n  let h = seed >>> 0;\n  for (let k = 0; k < s.length; k++) {\n    h ^= s.charCodeAt(k);\n    h = Math.imul(h, 16777619) >>> 0;\n  }\n  return h.toString(36).padStart(7, '0').slice(-6);\n};\nconst idDe = (placeId) => fnv(placeId, 2166136261) + fnv(placeId, 3735928559);\nconst demoBase = String(cfg.demoUrl ?? '').trim();\nconst demoDe = (id) => (demoBase ? `${demoBase}${demoBase.includes('?') ? '&' : '?'}c=${id}` : '');\n\nconst filas = base.map((b, i) => {\n  const r = ia[i] ?? {};\n  const o = r.output && typeof r.output === 'object' ? r.output : {};\n  const notaIA = Math.round(Number(o.nota));\n  const valida = !r.error && Number.isFinite(notaIA) && notaIA >= 1 && notaIA <= 10;\n\n  const cita = corta(o.evidencia, 300);\n  const enResena = cita.length >= 12 && b.resenas.some((rv) => plano(rv.texto).includes(plano(cita)));\n  const evidencia = enResena ? corta(cita, 160) : b.quejas[0] ?? '';\n\n  const web = plano(b.textoWeb);\n  const servicios = [];\n  for (const s of Array.isArray(o.servicios) ? o.servicios : []) {\n    const t = corta(s, 40);\n    if (t.length >= 3 && web.includes(plano(t)) && !servicios.some((x) => plano(x) === plano(t))) servicios.push(t);\n    if (servicios.length >= 8) break;\n  }\n\n  const id = idDe(b.placeId);\n  return {\n    id,\n    nota: valida ? notaIA : b.preNota,\n    notaDeIA: valida,\n    preNota: b.preNota,\n    motivo: corta(o.motivo, 140) || b.senales,\n    evidencia,\n    servicios: servicios.join(', '),\n    demo: demoDe(id),\n    nombre: b.nombre,\n    direccion: b.direccion,\n    telefono: b.telefono,\n    whatsapp: b.whatsapp,\n    web: b.web,\n    maps: b.maps,\n    total: b.total,\n    horario: b.horarioTexto,\n    cierra: b.cierra,\n    chat: b.chat,\n    webLeida: b.webLeida,\n    senales: b.senales,\n    nicho: b.nicho,\n    ciudad: b.ciudad,\n  };\n});\n\nfilas.sort((a, b) => b.nota - a.nota || b.preNota - a.preNota || b.total - a.total || a.nombre.localeCompare(b.nombre));\nreturn filas.slice(0, cuantos).map((json) => ({ json }));"
      },
      "id": "b7cae17f-7231-4d81-a69b-55582ac24df9",
      "name": "Elige las mejores",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1860,
        380
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Escribe el primer mensaje de WhatsApp que {{ $('Tus datos').first().json.tuNombre }} le va a mandar a {{ $json.nombre }} ({{ $json.nicho }}{{ $json.ciudad ? ' en ' + $json.ciudad : '' }}). {{ $('Tus datos').first().json.tuNombre }} arma recepcionistas con IA que contestan el WhatsApp a cualquier hora, agendan citas y avisan urgencias.\n\nLo que sabemos de {{ $json.nombre }}:\n- Observación principal: {{ $json.motivo }}\n- Señales: {{ $json.senales }}\n{{ $json.evidencia ? '- Un paciente escribió en Google: «' + $json.evidencia + '»' : '- No hay reseñas que se quejen de que no contestan.' }}\n\nReglas:\n- Trátalos de usted. Máximo 70 palabras. Español neutro, cálido y directo; que no suene a publicidad. Sin emojis o, como mucho, uno.\n- Empieza saludando al equipo de {{ $json.nombre }}.\n- Menciona UNA observación concreta de arriba. Si hay reseña, cita como máximo 12 palabras de ella entre « ».\n- Di que les preparaste una recepcionista de prueba con su nombre y su horario, para que la prueben esta noche como si fueran un paciente, y escribe exactamente {DEMO} donde va el link.\n- No menciones precios, porcentajes ni resultados prometidos. No critiques al negocio.\n- Termina con una pregunta corta y firma como {{ $('Tus datos').first().json.tuNombre }}.",
        "hasOutputParser": true,
        "batching": {
          "batchSize": 5,
          "delayBetweenBatches": 0
        }
      },
      "id": "8b77167a-08f7-4d06-a4ed-c78e83ac293b",
      "name": "Escribe el primer mensaje",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.9,
      "position": [
        2100,
        380
      ],
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "claude-opus-5-5"
        },
        "options": {
          "maxTokensToSample": 2048,
          "thinkingMode": "adaptive",
          "effort": "low"
        }
      },
      "id": "b0a99a49-78ed-43c8-a3f8-55d508e1aed4",
      "name": "Claude",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.6,
      "position": [
        2040,
        620
      ]
    },
    {
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"mensaje\": {\n      \"type\": \"string\",\n      \"description\": \"El mensaje de WhatsApp, con {DEMO} donde va el link\"\n    }\n  },\n  \"required\": [\n    \"mensaje\"\n  ]\n}"
      },
      "id": "7235028a-2d41-4213-a34a-5e3072033920",
      "name": "Formato del mensaje",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        2200,
        620
      ]
    },
    {
      "parameters": {
        "jsCode": "// Final message for each prospect (same order as \"Escribe el primer mensaje\"):\n// - sentences with prices or amounts are removed (the first message never talks money), and so is any link the\n//   AI wrote; {DEMO} always closes its own piece, so removing the sentence after it never takes the demo with it\n// - the demo link goes where the AI wrote {DEMO}; if the AI failed or its message lost {DEMO}, a short fixed\n//   message built from the same data\n// - \"Abrir en WhatsApp\": a wa.me link with the message already written, so you only press send\nconst cfg = $('Tus datos').first().json;\nconst base = $('Elige las mejores').all().map((i) => i.json);\nconst ia = $input.all().map((i) => i.json);\nconst firma = String(cfg.tuNombre ?? '').trim();\nconst limpia = (s) => String(s ?? '').replace(/\\r/g, '').replace(/[ \\t]+/g, ' ').replace(/ *\\n */g, '\\n').replace(/\\n{3,}/g, '\\n\\n').trim();\nconst DINERO = /(US\\$|\\$|USD|MXN|COP|ARS|CLP|PEN|€)\\s?\\d|\\d[\\d.,]*\\s?(USD|MXN|COP|ARS|CLP|PEN|€|d[oó]lares|pesos|euros)\\b|\\b\\d+\\s?%/i;\n\nreturn base.map((b, i) => {\n  const r = ia[i] ?? {};\n  const o = r.output && typeof r.output === 'object' ? r.output : {};\n  let m = !r.error ? limpia(o.mensaje) : '';\n  // drop every sentence that talks money or carries a link, keeping the line breaks between the others\n  const partes = m.split(/((?<=[.!?…]|\\{DEMO\\})[ \\t]+|[ \\t]*\\n+[ \\t]*|[ \\t]+(?=[¿¡]))/);\n  let limpio = '';\n  for (let k = 0; k < partes.length; k += 2) {\n    if (!DINERO.test(partes[k]) && !/https?:\\/\\/|www\\./i.test(partes[k])) limpio += partes[k] + (partes[k + 1] ?? '');\n  }\n  m = limpia(limpio);\n  const deIA = m.length >= 40 && m.includes('{DEMO}');\n\n  if (!deIA) {\n    const observacion = b.evidencia\n      ? `un paciente escribió en Google: «${b.evidencia.replace(/[\\s.!…]+$/, '')}»`\n      : b.cierra && b.cierra !== '24 h'\n        ? `cierran a las ${b.cierra}${b.webLeida && !b.chat ? ' y en su web no hay chat' : ''}`\n        : 'los mensajes que llegan fuera de horario se quedan sin respuesta hasta el día siguiente';\n    m = [\n      `Hola, equipo de ${b.nombre}. Vi que ${observacion}.`,\n      `Les preparé una recepcionista con IA de prueba, con su nombre y su horario, para que la prueben esta noche como si fueran un paciente: {DEMO}`,\n      `¿Me dicen qué les parece?`,\n      firma,\n    ].filter(Boolean).join('\\n\\n');\n  }\n  m = limpia(m.split('{DEMO}').join(b.demo || '[link de la demo]')).slice(0, 1000);\n\n  const numero = String(b.whatsapp || b.telefono || '').replace(/\\D/g, '');\n  const abrir = numero.length >= 10 && numero.length <= 15 ? `https://wa.me/${numero}?text=${encodeURIComponent(m)}` : '';\n  return { json: { ...b, mensaje: m, abrirWhatsApp: abrir, mensajeDeIA: deIA } };\n});"
      },
      "id": "b65d912a-8f45-40d3-a06d-cbc7f5f0070e",
      "name": "Revisa el mensaje",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2380,
        380
      ]
    },
    {
      "parameters": {
        "resource": "sheet",
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "value": "",
          "mode": "list"
        },
        "sheetName": {
          "__rl": true,
          "value": "Prospectos",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "ID": "={{ $json.id }}",
            "Nota": "={{ $json.nota }}",
            "Clínica": "={{ $json.nombre }}",
            "Motivo": "={{ $json.motivo }}",
            "Evidencia": "={{ $json.evidencia }}",
            "Señales": "={{ $json.senales }}",
            "Teléfono": "={{ $json.telefono }}",
            "WhatsApp": "={{ $json.whatsapp }}",
            "Web": "={{ $json.web }}",
            "Google Maps": "={{ $json.maps }}",
            "Dirección": "={{ $json.direccion }}",
            "Horario": "={{ $json.horario }}",
            "Servicios": "={{ $json.servicios }}",
            "Nicho": "={{ $json.nicho }}",
            "Demo": "={{ $json.demo }}",
            "Mensaje": "={{ $json.mensaje }}",
            "Abrir en WhatsApp": "={{ $json.abrirWhatsApp }}",
            "Buscado": "={{ $now.toFormat('yyyy-MM-dd HH:mm') }}"
          },
          "matchingColumns": [
            "ID"
          ],
          "schema": [
            {
              "id": "ID",
              "displayName": "ID",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Nota",
              "displayName": "Nota",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Clínica",
              "displayName": "Clínica",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Motivo",
              "displayName": "Motivo",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Evidencia",
              "displayName": "Evidencia",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Señales",
              "displayName": "Señales",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Teléfono",
              "displayName": "Teléfono",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "WhatsApp",
              "displayName": "WhatsApp",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Web",
              "displayName": "Web",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Google Maps",
              "displayName": "Google Maps",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Dirección",
              "displayName": "Dirección",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Horario",
              "displayName": "Horario",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Servicios",
              "displayName": "Servicios",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Nicho",
              "displayName": "Nicho",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Demo",
              "displayName": "Demo",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Mensaje",
              "displayName": "Mensaje",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Abrir en WhatsApp",
              "displayName": "Abrir en WhatsApp",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Buscado",
              "displayName": "Buscado",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ]
        },
        "options": {
          "cellFormat": "RAW"
        }
      },
      "id": "3d0e7dde-140b-4172-a473-51056cd8ac7c",
      "name": "Guarda en Prospectos",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        2600,
        380
      ]
    },
    {
      "parameters": {
        "multipleMethods": true,
        "httpMethod": [
          "GET",
          "POST"
        ],
        "path": "demo-recepcionista",
        "authentication": "none",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "459e40cc-2ece-4a2b-a1b9-042f1cd566e0",
      "name": "Demo",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.2,
      "position": [
        0,
        1100
      ],
      "webhookId": "4d1e04b4-a650-45dd-aae7-37059dce1692"
    },
    {
      "parameters": {
        "mode": "manual",
        "assignments": {
          "assignments": [
            {
              "id": "e3da4b6c-32b8-437e-a675-1edfc933157b",
              "name": "tuNombre",
              "value": "Tu nombre",
              "type": "string"
            },
            {
              "id": "b17c90bf-1e28-444b-aaa5-3afd18d3db0e",
              "name": "tuWhatsApp",
              "value": "5215500000000",
              "type": "string"
            },
            {
              "id": "06ab79b8-285b-4207-af28-e8acd9c20ca0",
              "name": "zonaHoraria",
              "value": "America/Mexico_City",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "id": "d4e220c0-c294-486a-a4dd-4ea94776a596",
      "name": "Datos de la demo",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        240,
        1100
      ]
    },
    {
      "parameters": {
        "resource": "sheet",
        "operation": "read",
        "documentId": {
          "__rl": true,
          "value": "",
          "mode": "list"
        },
        "sheetName": {
          "__rl": true,
          "value": "Prospectos",
          "mode": "name"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "ID",
              "lookupValue": "={{ String($('Datos de la demo').first().json.query?.c || '').trim() || '-' }}"
            }
          ]
        },
        "options": {
          "returnFirstMatch": true
        }
      },
      "id": "b1f2e849-905e-40c2-a377-dca769c1b32d",
      "name": "Lee la clínica",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        460,
        1100
      ],
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "jsCode": "// The demo link (…/webhook/demo-recepcionista?c=<ID>) is the page (GET) and, at the same address, each chat\n// message (POST with { sesion, mensaje }). Finds the prospect by its ID in Prospectos.\n// The page's text goes in through `config` (JSON, safe inside <script>) and `tituloHtml` (escaped), never raw.\n// \"Datos de la demo\" carries the request: reading the webhook node itself would only see its GET output\nconst req = $('Datos de la demo').first().json;\nconst cfg = req;\nconst body = req.body && typeof req.body === 'object' ? req.body : {};\nconst esMensaje = typeof body.mensaje === 'string';\nconst id = String(req.query?.c ?? '').trim().slice(0, 40);\nconst corta = (s, n) => String(s ?? '').replace(/\\s+/g, ' ').trim().slice(0, n);\nconst fila = id ? $input.all().map((i) => i.json).find((r) => r && String(r.ID ?? '').trim() === id) : null;\nconst clinica = fila ? corta(fila['Clínica'], 100) : '';\nconst nicho = fila ? corta(fila.Nicho, 60) || 'consultorio' : '';\nconst escapa = (s) => String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;');\nconst pruebas = /dent|odont/i.test(nicho)\n  ? ['Me duele muchísimo una muela', '¿Tienen cita para limpieza mañana?', '¿Cuánto cuesta un blanqueamiento?']\n  : ['¿Tienen cita para mañana?', 'Es urgente, ¿me pueden atender hoy?', '¿Cuánto cuesta una consulta?'];\nconst config = {\n  existe: !!fila,\n  clinica,\n  tuNombre: corta(cfg.tuNombre, 60),\n  tuWhatsApp: String(cfg.tuWhatsApp ?? '').replace(/\\D/g, ''),\n  pruebas,\n};\nreturn [{\n  json: {\n    esMensaje,\n    existe: !!fila,\n    id,\n    clinica,\n    nicho,\n    direccion: fila ? corta(fila['Dirección'], 200) : '',\n    telefono: fila ? corta(fila['Teléfono'], 30) : '',\n    horario: fila ? corta(fila.Horario, 600) : '',\n    servicios: fila ? corta(fila.Servicios, 400) : '',\n    mensaje: esMensaje ? String(body.mensaje).trim().slice(0, 1000) : '',\n    sesion: `${id}:${String(body.sesion ?? '').replace(/[^\\w-]/g, '').slice(0, 64) || 'sin-sesion'}`,\n    tituloHtml: escapa(clinica ? `Recepcionista con IA · ${clinica}` : 'Recepcionista con IA · Demo'),\n    config: JSON.stringify(config).replace(/</g, '\\\\u003c').replace(/>/g, '\\\\u003e').replace(/&/g, '\\\\u0026').replace(/\\u2028/g, '\\\\u2028').replace(/\\u2029/g, '\\\\u2029'),\n  },\n}];"
      },
      "id": "820fdf52-bbf6-4a05-ad07-b4ca83d23818",
      "name": "Prepara la demo",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        680,
        1100
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "0488ba91-e0e6-4914-a474-3e4378e9f7a3",
              "leftValue": "={{ $json.esMensaje }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "b70dacd6-ae25-49d5-a056-3a0b521ba83d",
      "name": "¿Es un mensaje?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        900,
        1100
      ]
    },
    {
      "parameters": {
        "respondWith": "text",
        "responseBody": "=<!doctype html>\n<html lang=\"es\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\">\n  <meta name=\"robots\" content=\"noindex, nofollow\">\n  <title>{{ $json.tituloHtml }}</title>\n  <meta property=\"og:title\" content=\"{{ $json.tituloHtml }}\">\n  <meta property=\"og:description\" content=\"Pruébela como si fuera un paciente: contesta al instante, a cualquier hora.\">\n  <style>\n    :root {\n      --marca: #0f766e;\n      --tinta: #14201e;\n      --suave: #5b6b68;\n      --fondo: #eef3f1;\n      --tarjeta: #ffffff;\n      --chat: #f6faf9;\n      --linea: #dce5e2;\n      --chip: #e3efec;\n    }\n    * { box-sizing: border-box; }\n    html, body { height: 100%; margin: 0; }\n    body {\n      font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n      color: var(--tinta);\n      background: var(--fondo);\n      -webkit-font-smoothing: antialiased;\n    }\n    .marco { height: 100dvh; display: flex; flex-direction: column; background: var(--tarjeta); }\n    @media (min-width: 640px) {\n      body { display: grid; place-items: center; padding: 24px; }\n      .marco {\n        width: 420px;\n        height: min(860px, calc(100dvh - 48px));\n        border-radius: 28px;\n        overflow: hidden;\n        box-shadow: 0 24px 60px rgba(20, 32, 30, .18), 0 0 0 1px rgba(20, 32, 30, .06);\n      }\n    }\n    header {\n      padding: max(16px, env(safe-area-inset-top)) 18px 14px;\n      background: var(--marca);\n      color: #fff;\n      display: flex; align-items: center; gap: 12px;\n    }\n    .avatar {\n      width: 44px; height: 44px; flex: none; border-radius: 50%;\n      background: rgba(255, 255, 255, .18);\n      display: grid; place-items: center; font-weight: 700; font-size: 18px;\n    }\n    .titulos { min-width: 0; }\n    .titulos h1 { margin: 0; font-size: 17px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n    .titulos p { margin: 2px 0 0; font-size: 13px; opacity: .85; display: flex; align-items: center; gap: 6px; }\n    .punto { width: 8px; height: 8px; border-radius: 50%; background: #7cf0b5; box-shadow: 0 0 0 3px rgba(124, 240, 181, .25); }\n    .aviso { margin: 0; padding: 10px 18px; font-size: 13px; line-height: 1.4; color: var(--suave); background: var(--chat); border-bottom: 1px solid var(--linea); }\n    .aviso b { color: var(--tinta); }\n    .mensajes {\n      flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: 16px 14px;\n      list-style: none; display: flex; flex-direction: column; gap: 8px;\n      background: var(--chat);\n    }\n    .mensajes li {\n      max-width: 84%; padding: 9px 12px; border-radius: 16px;\n      font-size: 15px; line-height: 1.42; white-space: pre-wrap; overflow-wrap: anywhere;\n    }\n    .bot { align-self: flex-start; background: var(--tarjeta); border: 1px solid var(--linea); border-top-left-radius: 4px; }\n    .tu { align-self: flex-end; background: var(--marca); color: #fff; border-top-right-radius: 4px; }\n    .falla { color: #9a3412; }\n    .resumen {\n      margin-top: 8px; padding: 9px 11px; border-radius: 10px;\n      background: #fff8e6; border: 1px solid #f3dfa8; font-size: 14px;\n    }\n    .resumen b { display: block; font-size: 12px; letter-spacing: .02em; color: #8a6414; margin-bottom: 2px; }\n    .escribiendo { display: flex; gap: 4px; padding: 12px 14px; }\n    .escribiendo i { width: 7px; height: 7px; border-radius: 50%; background: #9aaba7; animation: salta 1s infinite ease-in-out; }\n    .escribiendo i:nth-child(2) { animation-delay: .15s; }\n    .escribiendo i:nth-child(3) { animation-delay: .3s; }\n    @keyframes salta { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }\n    .pruebas { display: flex; gap: 8px; overflow-x: auto; padding: 10px 14px; border-top: 1px solid var(--linea); scrollbar-width: none; }\n    .pruebas::-webkit-scrollbar { display: none; }\n    .pruebas button {\n      flex: none; border: 0; border-radius: 999px; padding: 8px 12px;\n      font: inherit; font-size: 13px; color: var(--marca); background: var(--chip); cursor: pointer;\n    }\n    .escribe { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--linea); }\n    .escribe textarea {\n      flex: 1; resize: none; max-height: 120px; padding: 10px 14px;\n      border: 1px solid var(--linea); border-radius: 20px; background: var(--chat);\n      font: inherit; font-size: 15px; line-height: 1.35; color: var(--tinta);\n    }\n    .escribe textarea:focus { outline: 2px solid var(--marca); outline-offset: -1px; }\n    .escribe button {\n      width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%;\n      background: var(--marca); color: #fff; display: grid; place-items: center; cursor: pointer;\n    }\n    .escribe button:disabled { opacity: .45; cursor: default; }\n    button:focus-visible, a:focus-visible { outline: 2px solid var(--marca); outline-offset: 2px; }\n    footer {\n      padding: 10px 16px max(12px, env(safe-area-inset-bottom));\n      border-top: 1px solid var(--linea);\n      font-size: 13px; color: var(--suave);\n      display: flex; align-items: center; justify-content: space-between; gap: 10px;\n    }\n    footer a { flex: none; color: #fff; background: var(--tinta); text-decoration: none; font-weight: 600; padding: 8px 12px; border-radius: 10px; }\n    .inactivo { margin: auto; padding: 24px; max-width: 300px; text-align: center; color: var(--suave); font-size: 15px; line-height: 1.5; }\n    [hidden] { display: none !important; }\n  </style>\n</head>\n<body>\n  <main class=\"marco\">\n    <header>\n      <div class=\"avatar\" data-inicial aria-hidden=\"true\">C</div>\n      <div class=\"titulos\">\n        <h1 data-nombre>Recepcionista con IA</h1>\n        <p><span class=\"punto\" aria-hidden=\"true\"></span>Recepcionista con IA · responde al instante</p>\n      </div>\n    </header>\n    <p class=\"aviso\"><b>Demo para su clínica.</b> Escríbale como si fuera un paciente, a cualquier hora.</p>\n    <ol class=\"mensajes\" aria-live=\"polite\" aria-label=\"Conversación\"></ol>\n    <div class=\"pruebas\" aria-label=\"Mensajes de prueba\"></div>\n    <form class=\"escribe\">\n      <textarea rows=\"1\" maxlength=\"1000\" placeholder=\"Escribe tu mensaje…\" aria-label=\"Tu mensaje\"></textarea>\n      <button type=\"submit\" aria-label=\"Enviar\">\n        <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M3.4 20.4 21 12 3.4 3.6 3.4 10l12 2-12 2z\"/></svg>\n      </button>\n    </form>\n    <footer>\n      <span data-autor></span>\n      <a data-contacto href=\"#\" target=\"_blank\" rel=\"noopener\">La quiero en mi WhatsApp</a>\n    </footer>\n  </main>\n\n  <script>window.DEMO = {{ $json.config }};</script>\n  <script>\n    (function () {\n      var D = window.DEMO || {};\n      var q = function (s) { return document.querySelector(s); };\n      var lista = q(\".mensajes\");\n      var pruebas = q(\".pruebas\");\n      var form = q(\".escribe\");\n      var campo = form.querySelector(\"textarea\");\n      var boton = form.querySelector(\"button\");\n      var nombre = D.clinica || \"su clínica\";\n\n      if (D.clinica) {\n        q(\"[data-nombre]\").textContent = nombre;\n        // the initial of the distinctive word: \"Clínica Dental Sonrisa\" -> S\n        var GENERICAS = /^(cl[ií]nica|consultorio|centro|dental|dentista|odontol[oó]gic[oa]|odontolog[ií]a|est[eé]tica|m[eé]dic[oa]|veterinaria|dr\\.?|dra\\.?|de|del|la|el|los|las)$/i;\n        var palabras = nombre.split(/\\s+/).filter(Boolean);\n        var propia = palabras.filter(function (p) { return !GENERICAS.test(p); })[0] || palabras[0] || \"C\";\n        q(\"[data-inicial]\").textContent = propia.charAt(0).toUpperCase();\n      } else {\n        q(\"[data-inicial]\").textContent = \"IA\";\n        q(\".aviso\").hidden = true;\n      }\n      q(\"[data-autor]\").textContent = D.tuNombre ? \"Demo preparada por \" + D.tuNombre : \"\";\n      var contacto = q(\"[data-contacto]\");\n      if (D.tuWhatsApp) {\n        contacto.href = \"https://wa.me/\" + D.tuWhatsApp + \"?text=\" + encodeURIComponent(\"Hola, \" + (D.tuNombre || \"\") + \". Probé la recepcionista de \" + nombre + \" y quiero saber más.\");\n      } else {\n        contacto.hidden = true;\n      }\n\n      if (!D.existe) {\n        var aviso = document.createElement(\"p\");\n        aviso.className = \"inactivo\";\n        aviso.textContent = \"Este link de prueba ya no está activo. Pídele uno nuevo a quien te lo mandó.\";\n        lista.replaceWith(aviso);\n        pruebas.hidden = true;\n        form.hidden = true;\n        return;\n      }\n\n      // one conversation per open page: the flow keeps the memory under this key\n      var bytes = new Uint8Array(12);\n      crypto.getRandomValues(bytes);\n      var sesion = Array.prototype.map.call(bytes, function (b) { return (\"0\" + b.toString(16)).slice(-2); }).join(\"\");\n\n      function burbuja(texto, quien) {\n        var li = document.createElement(\"li\");\n        li.className = quien;\n        var corte = quien === \"bot\" ? texto.indexOf(\"📋\") : -1;\n        if (corte < 0) {\n          li.textContent = texto;\n        } else {\n          // \"📋 Así le llegaría a la clínica: …\" se ve como el aviso que recibiría la clínica\n          li.appendChild(document.createTextNode(texto.slice(0, corte).trim()));\n          var resumen = document.createElement(\"div\");\n          resumen.className = \"resumen\";\n          var titulo = document.createElement(\"b\");\n          titulo.textContent = \"📋 Así le llegaría a la clínica\";\n          resumen.appendChild(titulo);\n          resumen.appendChild(document.createTextNode(texto.slice(corte).replace(/^📋\\s*Así le llegaría a la clínica:?\\s*/i, \"\")));\n          li.appendChild(resumen);\n        }\n        lista.appendChild(li);\n        lista.scrollTop = lista.scrollHeight;\n        return li;\n      }\n\n      function enviar(texto) {\n        texto = String(texto || \"\").trim();\n        if (!texto || boton.disabled) return;\n        pruebas.hidden = true;\n        burbuja(texto, \"tu\");\n        campo.value = \"\";\n        ajusta();\n        boton.disabled = true;\n        var espera = document.createElement(\"li\");\n        espera.className = \"bot escribiendo\";\n        espera.setAttribute(\"aria-label\", \"Escribiendo\");\n        espera.innerHTML = \"<i></i><i></i><i></i>\";\n        lista.appendChild(espera);\n        lista.scrollTop = lista.scrollHeight;\n        fetch(location.href, {\n          method: \"POST\",\n          headers: { \"Content-Type\": \"application/json\" },\n          body: JSON.stringify({ sesion: sesion, mensaje: texto }),\n        })\n          .then(function (r) { return r.ok ? r.json() : Promise.reject(r.status); })\n          .then(function (d) { espera.remove(); burbuja(d.respuesta || \"Perdona, ¿me lo escribes otra vez?\", \"bot\"); })\n          .catch(function () { espera.remove(); burbuja(\"No me llegó tu mensaje. ¿Lo intentas otra vez?\", \"bot falla\"); })\n          .then(function () { boton.disabled = false; campo.focus(); });\n      }\n\n      function ajusta() {\n        campo.style.height = \"auto\";\n        campo.style.height = Math.min(campo.scrollHeight + 2, 120) + \"px\";\n      }\n      campo.addEventListener(\"input\", ajusta);\n      campo.addEventListener(\"keydown\", function (e) {\n        if (e.key === \"Enter\" && !e.shiftKey) { e.preventDefault(); enviar(campo.value); }\n      });\n      form.addEventListener(\"submit\", function (e) { e.preventDefault(); enviar(campo.value); });\n\n      burbuja(\"¡Hola! 👋 Soy la recepcionista virtual de \" + nombre + \". ¿En qué te puedo ayudar?\", \"bot\");\n      (D.pruebas || []).forEach(function (texto) {\n        var b = document.createElement(\"button\");\n        b.type = \"button\";\n        b.textContent = texto;\n        b.addEventListener(\"click\", function () { enviar(texto); });\n        pruebas.appendChild(b);\n      });\n      if (!pruebas.children.length) pruebas.hidden = true;\n    })();\n  </script>\n</body>\n</html>\n",
        "options": {
          "responseHeaders": {
            "entries": [
              {
                "name": "Content-Type",
                "value": "text/html; charset=utf-8"
              },
              {
                "name": "Cache-Control",
                "value": "no-store"
              },
              {
                "name": "X-Robots-Tag",
                "value": "noindex"
              }
            ]
          }
        }
      },
      "id": "1542c84d-2bc4-4f55-a75c-7ca038c0bb42",
      "name": "Página de la demo",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        1140,
        1300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "1bd95b7c-6b6c-433a-af4c-f3de7f949263",
              "leftValue": "={{ $json.existe }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "22bdc1e5-f839-4b24-aa50-ba25a4f1f191",
      "name": "¿Existe la clínica?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1140,
        1000
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Fecha y hora actual en la clínica: {{ $now.setZone($('Datos de la demo').first().json.zonaHoraria).setLocale('es').toFormat(\"cccc d 'de' LLLL 'de' yyyy, HH:mm\") }}\nMensaje del paciente: {{ $('Prepara la demo').first().json.mensaje }}",
        "options": {
          "systemMessage": "=Eres la recepcionista virtual de {{ $('Prepara la demo').first().json.clinica }} (negocio de tipo \"{{ $('Prepara la demo').first().json.nicho }}\"). Esta conversación es una DEMO: quien escribe probablemente es alguien del equipo de la clínica probando cómo atenderías a sus pacientes de noche. Atiéndelo exactamente como a un paciente real.\n\nDatos de la clínica (de su perfil de Google y su web)\n- Dirección: {{ $('Prepara la demo').first().json.direccion || 'sin dato' }}\n- Teléfono: {{ $('Prepara la demo').first().json.telefono || 'sin dato' }}\n- Horario: {{ $('Prepara la demo').first().json.horario || 'sin dato' }}\n- Servicios: {{ $('Prepara la demo').first().json.servicios || 'no los conoces; no inventes ninguno' }}\n\nTu trabajo\n1. Entender qué necesita la persona, aunque escriba informal o con errores.\n2. Detectar urgencias (en una clínica dental: dolor fuerte, sangrado que no para, cara inflamada, golpe o diente roto, fiebre; en otro tipo de negocio, lo equivalente). Si hay urgencia, dilo con calma y ofrece primero el horario más cercano.\n3. Pedir su nombre y ofrecer 2 horarios para la cita, dentro del horario de la clínica y nunca en el pasado. En esta demo no tienes acceso a la agenda real: propón horarios razonables dentro del horario.\n4. Cuando elija uno, confírmale la cita en una frase. Después, en un párrafo aparte que empiece con \"📋 Así le llegaría a la clínica:\", resume en una línea: nombre, motivo, si es urgente y el horario.\n\nLímites\n- No des diagnósticos ni recomiendes medicamentos. Ante una emergencia grave (dificultad para respirar o tragar, inflamación que avanza rápido), indícale que acuda a urgencias de inmediato.\n- No inventes precios ni servicios. Si preguntan cuánto cuesta algo, di que la clínica se lo confirma en la valoración.\n- Si preguntan quién hizo esta recepcionista, cuánto cuesta o cómo tenerla en su WhatsApp, responde que la preparó {{ $('Datos de la demo').first().json.tuNombre }} y que pueden escribirle directo por WhatsApp al +{{ $('Datos de la demo').first().json.tuWhatsApp }}.\n\nEstilo: como un mensaje de WhatsApp. Breve (máximo 3 frases, más el resumen cuando aplique), cálido, en español neutro, sin formato markdown y con un emoji como máximo.",
          "maxIterations": 4,
          "enableStreaming": false
        }
      },
      "id": "eebc0226-7170-457d-aa20-fe95fe28656e",
      "name": "Recepcionista de la demo",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        1380,
        920
      ],
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "claude-opus-5-5"
        },
        "options": {
          "maxTokensToSample": 2048,
          "thinkingMode": "adaptive",
          "effort": "low"
        }
      },
      "id": "95368eea-1af9-472d-a83d-0ee0aee2aa5a",
      "name": "Claude (demo)",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.6,
      "position": [
        1320,
        1140
      ]
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Prepara la demo').first().json.sesion }}",
        "contextWindowLength": 15
      },
      "id": "31eb3ab5-10f6-4eae-adf3-8f786ab7de3e",
      "name": "Memoria (demo)",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.4,
      "position": [
        1480,
        1140
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ respuesta: $json.output || 'Perdona, tuve un problema para responderte. ¿Me lo escribes otra vez?' }) }}",
        "options": {}
      },
      "id": "57d5c9ab-4771-451b-a81c-ef1047a4278f",
      "name": "Responde en la demo",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        1700,
        920
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ respuesta: 'Este link de prueba ya no está activo. Pídele uno nuevo a quien te lo mandó 🙂' }) }}",
        "options": {}
      },
      "id": "5d43f0ff-7ca2-4349-aa7c-d3e1e4789a8c",
      "name": "Link no válido",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        1380,
        1120
      ]
    },
    {
      "parameters": {
        "content": "## 1 · Busca\nLlenas el formulario (nicho, ciudad y zonas). El flujo busca en Google Maps zona por zona con la API oficial de Google Places: hasta 60 negocios por zona.",
        "height": 720,
        "width": 900,
        "color": 5
      },
      "id": "a085da98-b713-46cc-a19d-2449c8d01534",
      "name": "Nota 1",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -80,
        100
      ]
    },
    {
      "parameters": {
        "content": "## 2 · Investiga\nDe cada negocio junta el horario, la web y hasta 5 reseñas. Lee su web para ver si tiene chat, agenda en línea o botón de WhatsApp, y marca las reseñas que se quejan de que no contestan.",
        "height": 720,
        "width": 640,
        "color": 3
      },
      "id": "eaa1aa14-1ef2-4b20-af37-10d8a07a92d6",
      "name": "Nota 2",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        840,
        100
      ]
    },
    {
      "parameters": {
        "content": "## 3 · Califica\nLa IA le pone una nota del 1 al 10 a cada negocio. La cita de la reseña tiene que aparecer palabra por palabra y los servicios tienen que estar en su web: lo que no se puede comprobar se descarta. Quedan los mejores.",
        "height": 720,
        "width": 520,
        "color": 4
      },
      "id": "1f1a10cb-be32-42df-a8ef-17392c614bec",
      "name": "Nota 3",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1500,
        100
      ]
    },
    {
      "parameters": {
        "content": "## 4 · Prepara\nA cada uno le arma su demo y le escribe el primer mensaje (con lo que vio en sus reseñas y el link de la demo). Todo queda en la hoja Prospectos con el botón *Abrir en WhatsApp*: **el flujo no manda nada, tú lo mandas.**",
        "height": 720,
        "width": 700,
        "color": 6
      },
      "id": "1df865f4-35a5-435a-a25b-eb4184aa1e84",
      "name": "Nota 4",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        2040,
        100
      ]
    },
    {
      "parameters": {
        "content": "## Demo · la recepcionista de cada clínica\nCada prospecto recibe el link de su propia demo, y la página la sirve este mismo n8n: no hay nada que subir. **Demo** muestra la página (GET) y recibe cada mensaje del chat (POST) en la misma dirección. El flujo busca la clínica en Prospectos y la recepcionista atiende con su nombre, su horario y sus servicios. Es una demo: propone horarios, pero no toca ninguna agenda real.",
        "height": 620,
        "width": 1960,
        "color": 2
      },
      "id": "f3ac82d4-9f6e-4dc4-aee6-672f5c9f46af",
      "name": "Nota demo",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -80,
        860
      ]
    },
    {
      "parameters": {
        "content": "## Antes de publicar\n1. Un Google Sheet con una pestaña **Prospectos** y estos encabezados en la fila 1: ID, Nota, Clínica, Motivo, Evidencia, Señales, Teléfono, WhatsApp, Web, Google Maps, Dirección, Horario, Servicios, Nicho, Demo, Mensaje, Abrir en WhatsApp, Buscado, Estado.\n2. Credenciales: *Header Auth* en **Busca en Google Maps** (Name `X-Goog-Api-Key`, Value: tu API key de Google Maps); Anthropic en los tres nodos Claude; Google en **Guarda en Prospectos** y **Lee la clínica**, con tu hoja elegida.\n3. Llena **Tus datos** (tu nombre y tu país) y **Datos de la demo** (tu nombre, tu WhatsApp y tu zona horaria).\n4. Publica el flujo (*Publish*). El link de cada demo se arma solo con la dirección de tu n8n.\n5. Abre la URL de producción del formulario **Busca clientes** y haz tu primera búsqueda.",
        "height": 560,
        "width": 900,
        "color": 7
      },
      "id": "4b96affa-6792-4e3f-aac5-afbce44c4131",
      "name": "Nota configuración",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -80,
        -500
      ]
    }
  ],
  "connections": {
    "Busca clientes": {
      "main": [
        [
          {
            "node": "Tus datos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tus datos": {
      "main": [
        [
          {
            "node": "Arma las búsquedas",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Arma las búsquedas": {
      "main": [
        [
          {
            "node": "Busca en Google Maps",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Busca en Google Maps": {
      "main": [
        [
          {
            "node": "Junta las clínicas",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Junta las clínicas": {
      "main": [
        [
          {
            "node": "Lee su web",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Lee su web": {
      "main": [
        [
          {
            "node": "Señales",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Señales": {
      "main": [
        [
          {
            "node": "Califica con IA",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude rápido": {
      "ai_languageModel": [
        [
          {
            "node": "Califica con IA",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Formato de la calificación": {
      "ai_outputParser": [
        [
          {
            "node": "Califica con IA",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Califica con IA": {
      "main": [
        [
          {
            "node": "Elige las mejores",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Elige las mejores": {
      "main": [
        [
          {
            "node": "Escribe el primer mensaje",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude": {
      "ai_languageModel": [
        [
          {
            "node": "Escribe el primer mensaje",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Formato del mensaje": {
      "ai_outputParser": [
        [
          {
            "node": "Escribe el primer mensaje",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Escribe el primer mensaje": {
      "main": [
        [
          {
            "node": "Revisa el mensaje",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Revisa el mensaje": {
      "main": [
        [
          {
            "node": "Guarda en Prospectos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Demo": {
      "main": [
        [
          {
            "node": "Datos de la demo",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Datos de la demo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Datos de la demo": {
      "main": [
        [
          {
            "node": "Lee la clínica",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Lee la clínica": {
      "main": [
        [
          {
            "node": "Prepara la demo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepara la demo": {
      "main": [
        [
          {
            "node": "¿Es un mensaje?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "¿Es un mensaje?": {
      "main": [
        [
          {
            "node": "¿Existe la clínica?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Página de la demo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "¿Existe la clínica?": {
      "main": [
        [
          {
            "node": "Recepcionista de la demo",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Link no válido",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude (demo)": {
      "ai_languageModel": [
        [
          {
            "node": "Recepcionista de la demo",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Memoria (demo)": {
      "ai_memory": [
        [
          {
            "node": "Recepcionista de la demo",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Recepcionista de la demo": {
      "main": [
        [
          {
            "node": "Responde en la demo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "timezone": "America/Mexico_City",
    "callerPolicy": "workflowsFromSameOwner"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}
