{
  "name": "Send subscription renewal reminders via Telegram with Supabase",
  "nodes": [
    {
      "id": "c27c9a31-87c7-45c4-91d6-f76c1f5e459f",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -2032,
        -32
      ]
    },
    {
      "id": "e4709aa5-1ee7-4c7a-8cd9-d27071ce208d",
      "name": "Extract API Key",
      "type": "n8n-nodes-base.set",
      "position": [
        -1840,
        -32
      ]
    },
    {
      "id": "0c98d8f4-dc5b-4ef9-898e-0102d9e0df35",
      "name": "Authorized?",
      "type": "n8n-nodes-base.if",
      "position": [
        -1632,
        -32
      ]
    },
    {
      "id": "6b4ceea6-b888-4cfe-874d-0995182a6b20",
      "name": "Fetch Subscriptions",
      "type": "n8n-nodes-base.supabase",
      "position": [
        -1440,
        -32
      ]
    },
    {
      "id": "f5638554-9802-49a5-9947-06ee14dec899",
      "name": "Calculate Days",
      "type": "n8n-nodes-base.code",
      "position": [
        -1232,
        -32
      ]
    },
    {
      "id": "ef038b64-933a-48bc-97b7-dedfa0a2dab7",
      "name": "Expiring Soon?",
      "type": "n8n-nodes-base.if",
      "position": [
        -1040,
        -32
      ]
    },
    {
      "id": "3136b9a3-68de-4fc3-af9f-fac13d69b8aa",
      "name": "Create Telegram Message",
      "type": "n8n-nodes-base.set",
      "position": [
        -832,
        -32
      ]
    },
    {
      "id": "e52d93f6-d14c-42e6-ae9b-a332176a4fac",
      "name": "Send Telegram Reminder",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -640,
        -32
      ]
    },
    {
      "id": "fdd0c495-c9b6-4d59-a79a-fb6dd99a84d7",
      "name": "Telegram Sent?",
      "type": "n8n-nodes-base.if",
      "position": [
        -432,
        -32
      ]
    },
    {
      "id": "7317ad39-4685-472a-b56e-4d512882717f",
      "name": "Prepare Reminder Log",
      "type": "n8n-nodes-base.set",
      "position": [
        -240,
        -32
      ]
    },
    {
      "id": "a37b7f6f-fcf2-47b7-bc7b-d24bb166ad7a",
      "name": "Insert Reminder Log",
      "type": "n8n-nodes-base.supabase",
      "position": [
        -32,
        -32
      ]
    },
    {
      "id": "dbddf411-e753-470c-8160-9e49b49e3408",
      "name": "Compose Success Response",
      "type": "n8n-nodes-base.set",
      "position": [
        176,
        -32
      ]
    },
    {
      "id": "f579f71e-d319-4661-9541-a41e01084ef6",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        368,
        -32
      ]
    },
    {
      "id": "049b1ab5-006e-4690-9265-bc56cf0c40b8",
      "name": "Compose Error Response",
      "type": "n8n-nodes-base.set",
      "position": [
        -432,
        176
      ]
    },
    {
      "id": "945303cd-c6a3-4e57-a712-bb973f2d7940",
      "name": "Insert Error Log",
      "type": "n8n-nodes-base.supabase",
      "position": [
        -240,
        176
      ]
    },
    {
      "id": "29619ad1-576d-4a3e-9451-e3b0b89c9b61",
      "name": "🔔 Subscription Renewal Reminder – Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2736,
        -368
      ],
      "parameters": {
        "width": 550,
        "height": 738,
        "content": "## How it works\nThis workflow listens for an incoming webhook call to kick off a subscription-renewal check. After validating an API key, it queries a Supabase table that stores all active subscriptio"
      }
    },
    {
      "id": "99d33e26-9974-440c-82c7-1980a86208a1",
      "name": "🛡️ Trigger & Auth (Info)",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1984,
        -400
      ],
      "parameters": {
        "width": 610,
        "height": 702,
        "content": "## Trigger & Authentication\nThis block handles all incoming requests. The **Webhook Trigger** node exposes a public endpoint that external services can call. Immediately after triggering, the workflow"
      }
    },
    {
      "id": "b44c28e9-84d1-4786-aa5d-92a1592c913a",
      "name": "📊 Processing (Info)",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1296,
        -368
      ],
      "parameters": {
        "width": 738,
        "height": 654,
        "content": "## Processing & Filtering\nOnce a request is authorized, the workflow pulls current subscription rows from Supabase. The **Calculate Days** code snippet computes the remaining time until each subscript"
      }
    },
    {
      "id": "d60acb9e-730e-44d6-a347-f2e4761a0a59",
      "name": "📨 Notification & Logging (Info)",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        -288
      ],
      "parameters": {
        "width": 1010,
        "height": 638,
        "content": "## Notifications & Logging\nFor every imminent renewal, a personalized message is assembled and dispatched via the **Send Telegram Reminder** node. Successful sends trigger a logging sequence that writ"
      }
    }
  ],
  "connections": {
    "Authorized?": {
      "main": [
        [
          {
            "node": "Fetch Subscriptions",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Compose Error Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Days": {
      "main": [
        [
          {
            "node": "Expiring Soon?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Expiring Soon?": {
      "main": [
        [
          {
            "node": "Create Telegram Message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Compose Success Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Sent?": {
      "main": [
        [
          {
            "node": "Prepare Reminder Log",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Compose Error Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract API Key": {
      "main": [
        [
          {
            "node": "Authorized?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Extract API Key",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Subscriptions": {
      "main": [
        [
          {
            "node": "Calculate Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert Reminder Log": {
      "main": [
        [
          {
            "node": "Compose Success Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Reminder Log": {
      "main": [
        [
          {
            "node": "Insert Reminder Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compose Error Response": {
      "main": [
        [
          {
            "node": "Insert Error Log",
            "type": "main",
            "index": 0
          },
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Telegram Reminder": {
      "main": [
        [
          {
            "node": "Telegram Sent?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Telegram Message": {
      "main": [
        [
          {
            "node": "Send Telegram Reminder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compose Success Response": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}