{
  "name": "Tinylytics \u2014 Poll Uptime Status",
  "nodes": [
    {
      "parameters": {
        "content": "## Tinylytics uptime poll\\n\\nPush alerts via webhooks are better for downtime. Use this only if you want a scheduled status check.\\n\\nRequires an active subscription and uptime enabled on the site.\\n\\n1. Replace `SITE_ID` and `REPLACE_WITH_API_KEY` (`tly-ro-...`).\\n2. Connect the Format node to your notifier.\\n\\nEndpoint: `GET /api/v1/sites/:id/uptime` (404 if uptime is not enabled).",
        "height": 300,
        "width": 520,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -720,
        -160
      ],
      "id": "393ef981-35d8-4436-990c-3a9e68948b8b",
      "name": "Setup"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 30
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -420,
        80
      ],
      "id": "b55ee7b4-4b79-41f4-b68e-51e44cb3d97c",
      "name": "Every 30 Minutes"
    },
    {
      "parameters": {
        "method": "GET",
        "url": "https://tinylytics.app/api/v1/sites/SITE_ID/uptime",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer REPLACE_WITH_API_KEY"
            },
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -180,
        80
      ],
      "id": "c429ca70-3ef7-4896-8894-3130e28a893a",
      "name": "Get Uptime"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "99aa48ea-2c83-4a64-a568-a8236b8815f1",
              "leftValue": "={{ $json.monitor.is_down }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        60,
        80
      ],
      "id": "25396706-7e2b-4088-be8b-297cfd813b37",
      "name": "Is Down?"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "dbc40325-572c-41ce-bf1e-35ad29867bd7",
              "name": "message",
              "value": "=Uptime check: {{ $json.monitor.url }} is DOWN\\nStatus: {{ $json.monitor.status_description }}\\nError: {{ $json.monitor.last_error_message }}\\nLast check: {{ $json.monitor.last_check_at }}",
              "type": "string"
            },
            {
              "id": "4bfa288c-3c78-4218-b7c6-d85a85e111da",
              "name": "is_down",
              "value": "={{ $json.monitor.is_down }}",
              "type": "boolean"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        300,
        0
      ],
      "id": "d8fa12a2-8446-4cfc-b3ec-b14871c6c196",
      "name": "Format Down Alert"
    },
    {
      "parameters": {
        "content": "Only the **true** branch formats an alert. Prefer Tinylytics `monitor_down` / `monitor_up` webhooks for immediate alerts instead of polling.",
        "height": 140,
        "width": 300,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        540,
        -20
      ],
      "id": "7b089795-deee-4ab6-8224-e10286d4fb03",
      "name": "Note"
    }
  ],
  "pinData": {},
  "connections": {
    "Every 30 Minutes": {
      "main": [
        [
          {
            "node": "Get Uptime",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Uptime": {
      "main": [
        [
          {
            "node": "Is Down?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Down?": {
      "main": [
        [
          {
            "node": "Format Down Alert",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "tags": []
}
