{
  "name": "\u00d3ptica - Notificaci\u00f3n Cotizaci\u00f3n",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "cotizacion",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "node-webhook",
      "name": "Webhook Cotizaci\u00f3n",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const telefono = $input.first().json.body.telefono;\nconst mensaje = $input.first().json.body.mensaje;\nconst mensajeUrl = mensaje.replace(/\\n/g, '%0A').replace(/ /g, '%20');\nconst waLink = `https://wa.me/${telefono}?text=${mensajeUrl}`;\nreturn [{ json: { telefono, mensaje, waLink } }];"
      },
      "id": "node-code",
      "name": "Armar Link WhatsApp",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        480,
        300
      ]
    },
    {
      "parameters": {
        "chatId": "5976689478",
        "text": "=\ud83d\udd14 Nueva cotizacion\n\nTelefono: {{ $json.telefono }}\n\n{{ $json.mensaje }}\n\n\ud83d\udc46 Responder: {{ $json.waLink }}",
        "additionalFields": {}
      },
      "id": "node-telegram",
      "name": "Enviar Telegram",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1,
      "position": [
        720,
        300
      ],
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "{\"ok\": true}",
        "options": {}
      },
      "id": "node-response",
      "name": "Respuesta OK",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        720,
        480
      ]
    }
  ],
  "connections": {
    "Webhook Cotizaci\u00f3n": {
      "main": [
        [
          {
            "node": "Armar Link WhatsApp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Armar Link WhatsApp": {
      "main": [
        [
          {
            "node": "Enviar Telegram",
            "type": "main",
            "index": 0
          },
          {
            "node": "Respuesta OK",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "tags": [
    "optica"
  ]
}