{
  "name": "Recordatorio 72h - AutomatizaTech",
  "nodes": [
    {
      "parameters": {
        "triggerTimes": {
          "item": [
            {
              "hour": 9
            },
            {
              "hour": 18
            }
          ]
        }
      },
      "name": "Cron",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "url": "https://automatizatech.shop/wp-json/automatiza-tech/v1/leads/reminders/72h",
        "options": {
          "splitIntoItems": true
        }
      },
      "name": "Get Leads 72h",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        660,
        300
      ]
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {}
      },
      "name": "SplitInBatches",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        860,
        300
      ]
    },
    {
      "parameters": {
        "fromEmail": "Automatiza Tech <info@automatizatech.shop>",
        "toEmail": "={{$node[\"SplitInBatches\"].json[\"email\"]}}",
        "subject": "Recordatorio de Agendamiento (72h)",
        "html": "={{ '<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><style>body { font-family: \"Poppins\", Arial, sans-serif; background-color: #f9f9f9; margin: 0; padding: 0; color: #333333; } .container { max-width: 600px; margin: 20px auto; background-color: #ffffff; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,0.1); } .header { background-color: #1e40af; padding: 40px 20px; text-align: center; } .header img { max-height: 80px; width: auto; margin-bottom: 15px; } .header h1 { margin: 0; font-size: 24px; color: #ffffff; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; } .content { padding: 40px 30px; line-height: 1.6; } .cta-container { text-align: center; margin: 30px 0; } .btn { display: inline-block; padding: 12px 24px; margin: 5px; color: #ffffff !important; text-decoration: none; border-radius: 50px; font-weight: bold; font-size: 14px; transition: all 0.3s ease; } .btn-confirm { background-color: #06d6a0; box-shadow: 0 4px 6px rgba(6, 214, 160, 0.3); } .btn-reject { background-color: #fca311; color: #fff !important; box-shadow: 0 4px 6px rgba(252, 163, 17, 0.3); } .footer { background-color: #f1f1f1; padding: 20px; text-align: center; font-size: 12px; color: #888888; } .footer a { color: #1e40af; text-decoration: none; }</style></head><body><div class=\"container\"><div class=\"header\"><img src=\"https://automatizatech.shop/wp-content/themes/automatiza-tech/assets/images/logo-automatiza-tech.png\" alt=\"Automatiza Tech\" style=\"display: block; margin: 0 auto;\"><h1>Recordatorio de Reuni\u00f3n</h1></div><div class=\"content\"><p>Hola <strong>' + $node[\"SplitInBatches\"].json[\"name\"] + '</strong>,</p><p>Esperamos que est\u00e9s teniendo un excelente d\u00eda.</p><p>Te escribimos para recordarte tu cita agendada para el <strong>' + $node[\"SplitInBatches\"].json[\"scheduled_date\"].split(\"-\").reverse().join(\"-\") + '</strong> a las <strong>' + $node[\"SplitInBatches\"].json[\"scheduled_time\"] + ' hrs.</strong>.</p><p>Para ayudarnos a organizar mejor nuestra agenda, te agradecemos confirmar tu asistencia haciendo clic en uno de los siguientes botones:</p><div class=\"cta-container\"><a href=\"https://automatizatech.shop/wp-json/automatiza-tech/v1/leads/action?id=' + $node[\"SplitInBatches\"].json[\"id\"] + '&token=' + $node[\"SplitInBatches\"].json[\"token\"] + '&action=confirm&reminder_type=72h\" class=\"btn btn-confirm\">Confirmar Asistencia</a> <a href=\"https://automatizatech.shop/wp-json/automatiza-tech/v1/leads/action?id=' + $node[\"SplitInBatches\"].json[\"id\"] + '&token=' + $node[\"SplitInBatches\"].json[\"token\"] + '&action=reject\" class=\"btn btn-reject\">No podr\u00e9 asistir</a></div><p style=\"font-size: 13px; color: #666; margin-top: 20px; text-align: center;\">Si necesitas cancelar definitivamente, puedes hacerlo aqu\u00ed: <a href=\"https://automatizatech.shop/wp-json/automatiza-tech/v1/leads/action?id=' + $node[\"SplitInBatches\"].json[\"id\"] + '&token=' + $node[\"SplitInBatches\"].json[\"token\"] + '&action=delete\" style=\"color: #dc3545;\">Cancelar Cita</a></p></div><div class=\"footer\"><p>&copy; 2025 Automatiza Tech. Todos los derechos reservados.</p><p>Conectamos tus ventas, web y CRM.</p></div></div></body></html>' }}",
        "options": {}
      },
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 1,
      "position": [
        1060,
        300
      ],
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://automatizatech.shop/wp-json/automatiza-tech/v1/leads/update-reminder/{{$node[\"SplitInBatches\"].json[\"id\"]}}/72h",
        "sendBody": true,
        "bodyParameters": {
          "parameters": []
        },
        "options": {}
      },
      "name": "Mark Sent",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        1260,
        300
      ]
    }
  ],
  "connections": {
    "Cron": {
      "main": [
        [
          {
            "node": "Get Leads 72h",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Leads 72h": {
      "main": [
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SplitInBatches": {
      "main": [
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Email": {
      "main": [
        [
          {
            "node": "Mark Sent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark Sent": {
      "main": [
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}