{
  "name": "Pick a daily Facebook comment contest winner with OpenAI, Airtable and Telegram",
  "nodes": [
    {
      "id": "f90317ed-250a-40cd-89eb-9debba6de03d",
      "name": "Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -624,
        -896
      ],
      "parameters": {
        "width": 532,
        "height": 662,
        "content": "# Facebook Community Contest Automator\n\n## How it works\n### This workflow automates the selection of a daily contest winner from your Facebook posts. It triggers every night at 9 PM, fetches the lates"
      }
    },
    {
      "id": "63f723ea-7a08-41f2-83da-5873246b8274",
      "name": "Sticky Note - Ingestion",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -192
      ],
      "parameters": {
        "width": 780,
        "height": 450,
        "content": "## 1. Data Ingestion\n\n**Scheduled Fetch**\nTriggers automatically every day at 21:00 (9 PM). \n\n**Context Retrieval**\nSimultaneously fetches fresh comments from the Facebook API and the list of previous"
      }
    },
    {
      "id": "67394214-d304-4712-811f-d29b57789595",
      "name": "Sticky Note - Filter",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        -192
      ],
      "parameters": {
        "width": 560,
        "height": 450,
        "content": "## 2. Pre-Processing & Filter\n\n**Fairness Logic**\nExecutes custom code to create a \"Blocklist\" of users who have won in the last 30 days, ensuring prize distribution is fair.\n\n**Spam Protection**\nFilt"
      }
    },
    {
      "id": "244c77de-e58d-45dc-b4ef-5f049ef95096",
      "name": "Sticky Note - AI",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1312,
        -256
      ],
      "parameters": {
        "width": 720,
        "height": 642,
        "content": "## 3. AI Analysis & Selection\n\n**Sentiment Engine**\nUses GPT-4o-mini to analyze the context of every eligible comment. It filters strictly for \"Positive\" sentiment to reward constructive community eng"
      }
    },
    {
      "id": "ffcf2f46-2ce9-490c-a3aa-c2156ea6f155",
      "name": "Sticky Note - Storage",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2096,
        -256
      ],
      "parameters": {
        "width": 850,
        "height": 620,
        "content": "## 4. Storage & Notifications\n\n**Database Sync**\nWrites the winner's details (Name, ID, Comment) into Airtable for long-term record keeping.\n\n**Multi-Channel Alerting**\nIf successful, sends a celebrat"
      }
    },
    {
      "id": "5c7e05fc-b073-4c56-a731-2375086d9771",
      "name": "Daily Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -32,
        64
      ]
    },
    {
      "id": "956ba77c-273b-4d47-b6bf-d59bc95b40f3",
      "name": "Pre-Filter (Blocklist)",
      "type": "n8n-nodes-base.code",
      "position": [
        832,
        64
      ]
    },
    {
      "id": "a5c7f7f0-128d-4ded-a7ec-2ca0a754ad07",
      "name": "Any Eligible?",
      "type": "n8n-nodes-base.if",
      "position": [
        1056,
        64
      ]
    },
    {
      "id": "c8018d6e-b8fc-41fe-8047-19132c0321d0",
      "name": "Pick Random Winner",
      "type": "n8n-nodes-base.code",
      "position": [
        1744,
        32
      ]
    },
    {
      "id": "c1a4d98b-f55c-4143-90e3-4ffa500a0326",
      "name": "Get Past Winners",
      "type": "n8n-nodes-base.airtable",
      "position": [
        480,
        64
      ]
    },
    {
      "id": "d370b18b-fd5e-49c3-880c-cfd310ad5033",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1344,
        272
      ]
    },
    {
      "id": "50f3dc87-b4ac-4a1e-a0e5-5b0c7a39a320",
      "name": "Create a record",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1904,
        32
      ]
    },
    {
      "id": "bd006cda-3183-4782-a7ec-9d54a3cd5b01",
      "name": "Notify Admin (Error)1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2592,
        160
      ]
    },
    {
      "id": "7e1ee7ea-cce9-4df2-94a8-d8aaa6fe6bb1",
      "name": "Log Error (Supabase) ",
      "type": "n8n-nodes-base.supabase",
      "position": [
        2416,
        176
      ]
    },
    {
      "id": "9a277ea7-db35-46e9-879b-3c9973f9e521",
      "name": "Send a text message1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2448,
        -32
      ]
    },
    {
      "id": "39010b0f-a1e4-4807-9842-0b7575bda075",
      "name": "Saved?",
      "type": "n8n-nodes-base.if",
      "position": [
        2160,
        64
      ]
    },
    {
      "id": "ae99e7fe-be6c-4d33-ad7b-cdae5333c4ee",
      "name": "Sentiment Analysis",
      "type": "@n8n/n8n-nodes-langchain.sentimentAnalysis",
      "position": [
        1344,
        48
      ]
    },
    {
      "id": "d3d0e5ed-6575-443b-81aa-f549c79466c9",
      "name": "Get FB Comments",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        224,
        64
      ]
    }
  ],
  "connections": {
    "Saved?": {
      "main": [
        [
          {
            "node": "Send a text message1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log Error (Supabase) ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Any Eligible?": {
      "main": [
        [],
        [
          {
            "node": "Sentiment Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily Trigger": {
      "main": [
        [
          {
            "node": "Get FB Comments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a record": {
      "main": [
        [
          {
            "node": "Saved?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get FB Comments": {
      "main": [
        [
          {
            "node": "Get Past Winners",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Past Winners": {
      "main": [
        [
          {
            "node": "Pre-Filter (Blocklist)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Sentiment Analysis",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Pick Random Winner": {
      "main": [
        [
          {
            "node": "Create a record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sentiment Analysis": {
      "main": [
        [
          {
            "node": "Pick Random Winner",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Error (Supabase) ": {
      "main": [
        [
          {
            "node": "Notify Admin (Error)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pre-Filter (Blocklist)": {
      "main": [
        [
          {
            "node": "Any Eligible?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}