{
  "name": "Auto Post Facebook từ Google Sheets",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [{ "field": "hours", "hoursInterval": 1 }]
        }
      },
      "id": "a1b2c3d4-1111-4aaa-bbbb-000000000001",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [260, 300]
    },
    {
      "parameters": {
        "operation": "read",
        "documentId": { "value": "YOUR_SHEET_ID" },
        "sheetName": { "value": "Sheet1" },
        "options": {
          "range": "A:D"
        }
      },
      "id": "a1b2c3d4-1111-4aaa-bbbb-000000000002",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [480, 300],
      "credentials": {
        "googleSheetsOAuth2Api": { "id": "1", "name": "Google Sheets account" }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": { "caseSensitive": true },
          "conditions": [
            {
              "leftValue": "={{ $json.status }}",
              "rightValue": "pending",
              "operator": { "type": "string", "operation": "equals" }
            }
          ]
        }
      },
      "id": "a1b2c3d4-1111-4aaa-bbbb-000000000003",
      "name": "Filter Pending",
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2,
      "position": [700, 300]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://graph.facebook.com/v18.0/{{ $json.page_id }}/feed",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            { "name": "message", "value": "={{ $json.content }}" },
            { "name": "access_token", "value": "={{ $json.access_token }}" }
          ]
        }
      },
      "id": "a1b2c3d4-1111-4aaa-bbbb-000000000004",
      "name": "Post to Facebook",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [920, 300]
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": { "value": "YOUR_SHEET_ID" },
        "sheetName": { "value": "Sheet1" },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "status": "posted",
            "posted_at": "={{ $now.toISO() }}"
          }
        }
      },
      "id": "a1b2c3d4-1111-4aaa-bbbb-000000000005",
      "name": "Update Status",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [1140, 300],
      "credentials": {
        "googleSheetsOAuth2Api": { "id": "1", "name": "Google Sheets account" }
      }
    }
  ],
  "connections": {
    "Schedule Trigger": { "main": [[{ "node": "Google Sheets", "type": "main", "index": 0 }]] },
    "Google Sheets": { "main": [[{ "node": "Filter Pending", "type": "main", "index": 0 }]] },
    "Filter Pending": { "main": [[{ "node": "Post to Facebook", "type": "main", "index": 0 }]] },
    "Post to Facebook": { "main": [[{ "node": "Update Status", "type": "main", "index": 0 }]] }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
