{
  "nodes": [
    {
      "id": "847500b4-d1a6-4c2e-a715-1624e014efd1",
      "name": "Get Google Drive ID",
      "type": "n8n-nodes-base.set",
      "position": [
        304,
        160
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a1750d20-2f6e-4826-80b8-654d0985120d",
              "name": "final_google_drive_url",
              "type": "string",
              "value": "={{ $json['Media URL'].match(/https:\\/\\/drive\\.google\\.com\\/file\\/d\\/([A-Za-z0-9_-]+)/i)[1]  }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "41423ee5-fc57-4ab9-8056-151b258a5f4b",
      "name": "URL VIDEO to Post",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        288,
        -48
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TgAOn_dRUwEQFlWtNXFxXj72SVqPuMIMZ85dwsjcuG0/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1TgAOn_dRUwEQFlWtNXFxXj72SVqPuMIMZ85dwsjcuG0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TgAOn_dRUwEQFlWtNXFxXj72SVqPuMIMZ85dwsjcuG0/edit?usp=drivesdk",
          "cachedResultName": "Handsome warden TikTok"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "4dd84f04-219e-45e6-899f-f138ca4532fb",
      "name": "Upload Video to BLOTATO",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        160,
        368
      ],
      "parameters": {
        "mediaUrl": "=https://drive.google.com/uc?export=download&id={{ $('Get Google Drive ID').item.json.final_google_drive_url }}",
        "resource": "media"
      },
      "credentials": {
        "blotatoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "54ab6b91-a00d-4b9e-ba5c-2a069e2f747a",
      "name": "Tiktok",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        320,
        368
      ],
      "parameters": {
        "options": {},
        "platform": "tiktok",
        "accountId": {
          "__rl": true,
          "mode": "list",
          "value": "13117",
          "cachedResultUrl": "https://backend.blotato.com/v2/accounts/13117",
          "cachedResultName": "handsomewarden"
        },
        "postContentText": "={{ $('URL VIDEO to Post').item.json.Caption }}",
        "postContentMediaUrls": "={{ $json.url }}"
      },
      "credentials": {
        "blotatoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "b93a29c5-90bb-476f-a3b0-312d41701dac",
      "name": "Update Status to \"DONE\"",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        480,
        368
      ],
      "parameters": {
        "columns": {
          "value": {
            "ID": "={{ $('URL VIDEO to Post').item.json.ID }}",
            "Status": "posted"
          },
          "schema": [
            {
              "id": "ID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Title",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Media URL",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Media URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Caption",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Caption",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "ID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TgAOn_dRUwEQFlWtNXFxXj72SVqPuMIMZ85dwsjcuG0/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1TgAOn_dRUwEQFlWtNXFxXj72SVqPuMIMZ85dwsjcuG0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TgAOn_dRUwEQFlWtNXFxXj72SVqPuMIMZ85dwsjcuG0/edit?usp=drivesdk",
          "cachedResultName": "Handsome warden TikTok"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "0ddd42fb-83b9-45b1-94c1-c5440272425a",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        448,
        -48
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "bc74b0c2-aa46-4bcd-91f3-1eb6b0720167",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.Status }}",
              "rightValue": "pending"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e6949ebe-194e-4f50-97be-2c18ba1b0ffc",
      "name": "Limit",
      "type": "n8n-nodes-base.limit",
      "position": [
        160,
        160
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "67aa2b3d-e8a9-408b-bef0-bbee07ec10f3",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        128,
        -48
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours"
            }
          ]
        }
      },
      "executeOnce": false,
      "retryOnFail": false,
      "typeVersion": 1.2,
      "alwaysOutputData": false
    },
    {
      "id": "4b229309-888d-436b-91eb-a9b0eaa93372",
      "name": "Share file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        432,
        160
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.final_google_drive_url }}"
        },
        "options": {},
        "operation": "share",
        "permissionsUi": {
          "permissionsValues": {
            "role": "reader",
            "type": "anyone"
          }
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "fb83485a-ee84-459f-9c6d-3ade6f819d73",
      "name": "\ud83d\udccb DATA RETRIEVAL & FILTERING",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        -80
      ],
      "parameters": {
        "width": 464,
        "height": 736,
        "content": "**Data Retrieval & Filtering Section**\n\nThis section fetches video data from Google Sheets and filters for pending posts only.\n\n\u2022 Schedule Trigger: Runs every hour\n\u2022 Google Sheets: Retrieves video data\n\u2022 If Node: Filters for 'pending' status\n\u2022 Limit: Processes 1 video at a time to avoid rate limits\n\n**\u26a0\ufe0f IMPORTANT REQUIREMENTS**\n\n\u2022 **Self-hosted n8n only** (community nodes required)\n\u2022 Google Sheets with columns: ID, Title, Media URL, Caption, Status\n\u2022 Blotato API account for TikTok posting\n\u2022 Google Drive & Sheets OAuth2 credentials\n\u2022 Videos must be stored in Google Drive\n\u2022 Status must be set to 'pending' for processing\n\n**Video Processing Section**\n\nThis section handles video file preparation for posting.\n\n\u2022 Get Google Drive ID: Extracts file ID from URL\n\u2022 Share File: Makes Google Drive file publicly accessible\n\u2022 Upload to Blotato: Transfers video to Blotato platform\n\n**TikTok Posting & Tracking Section**\n\nThis section handles the actual posting and status updates.\n\n\u2022 TikTok Node: Posts video with caption to TikTok\n\u2022 Update Status: Marks post as 'posted' in Google Sheets\n\n**Note:** Ensure your Blotato API credentials are properly configured."
      },
      "typeVersion": 1
    },
    {
      "id": "8f6d83d3-4eb2-4331-b1d7-54b083c91221",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -928,
        -80
      ],
      "parameters": {
        "color": 5,
        "width": 528,
        "height": 640,
        "content": "## Muhammad Farooq Iqbal - Automation Expert & n8n Creator\n\nI am a passionate automation expert and recognized n8n Creator specializing in intelligent workflow automation. With extensive experience in n8n, AI automation, Zapier, and Make.com, I have created innovative workflow templates with 500+ downloads across the global automation community\n\n### Expertise\n- **Workflow Automation**: n8n, Zapier, Make.com, AI automation\n- **AI Integration**: Gemini AI, API integration, data processing\n- **Platform Mastery**: Google Sheets, Google Drive, custom scripts\n\n## Need Help with This Workflow?\n\nIf you face any issues with this workflow or need customization support, feel free to reach out:\n\n**\ud83d\udce7 Email**: mfarooqiqbal143@gmail.com  \n**\ud83d\udcf1 Phone**: +923036991118  \n**\ud83d\udcbc LinkedIn**: [Connect with me](https://linkedin.com/in/muhammadfarooqiqbal)  \n**\ud83c\udf10 Portfolio**: [View my work](https://mfarooqone.github.io/n8n/)\n\n*I'm always excited to help with automation challenges and workflow optimization!*\n"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "Get Google Drive ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tiktok": {
      "main": [
        [
          {
            "node": "Update Status to \"DONE\"",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Share file": {
      "main": [
        [
          {
            "node": "Upload Video to BLOTATO",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "URL VIDEO to Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "URL VIDEO to Post": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Google Drive ID": {
      "main": [
        [
          {
            "node": "Share file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Video to BLOTATO": {
      "main": [
        [
          {
            "node": "Tiktok",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}