{
  "meta": {
    "instanceId": "bb58de5a5031a6915d56b6838fb3b3b84efbdb51f48c823505ab47d6641ee185",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "d343874d-2389-40c9-ab46-47f02a7ea77d",
      "name": "Download New Video",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        272,
        -128
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('New Video?').item.json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "credential-id",
          "name": "googleDriveOAuth2Api Credential"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "84c6f604-08f9-407c-9935-b4e8c9b03add",
      "name": "New Video?",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -928,
        -208
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "1vAZ6zUlbqqaFv2_sPZXx_yeNQcjrfcvy",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1vAZ6zUlbqqaFv2_sPZXx_yeNQcjrfcvy",
          "cachedResultName": "All Motivatioanl video"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "credential-id",
          "name": "googleDriveOAuth2Api Credential"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "28445d38-79c3-4d7c-8aaa-9a30ee298bfe",
      "name": "Create Description",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -624,
        -224
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-nano",
          "cachedResultName": "GPT-4.1-NANO"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional copywriter.\nYou receive the transcript of an economics-related video.\n\nYour task is to write a detailed but concise summary (in paragraphs) about the content of the video. The output will be used as the YouTube video description.\n\n✍️ Writing Guidelines:\n\nStart with an engaging opening like:\n“In this video…” or “In this episode…”\n\nWrite entirely from my perspective, using phrases such as “in my opinion,” “in my view,” “I explain why,” or “I discuss how.”\n\nNever say phrases like “the speaker says,” “they mention,” or “in this episode, I learn.” Everything must sound like my own explanation.\n\nUse clear, assertive, and confident statements — avoid uncertain terms such as “might,” “could,” “possibly,” or “maybe.”\n\nInclude 2–4 relevant emojis to make the tone more dynamic and expressive.\n\nEnd with 2–5 broad, relevant hashtags (e.g., #economics #business #money #success #motivation).\n\n⚙️ Input:\n\nThe transcript will come from the uploaded video (added separately).\n\n🎯 Output:\n\nA polished, first-person YouTube description that summarizes the video’s key economic or motivational insights — confident, engaging, and ready to publish."
            },
            {
              "content": "=Here is the Scence:{{ $json.originalFilename }}"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "credential-id",
          "name": "openAiApi Credential"
        }
      },
      "typeVersion": 1.7
    },
    {
      "id": "b0cbd1ba-77ca-4874-bdfd-cd76c2a56892",
      "name": "2.5FlashPrev",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -352,
        -64
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "credential-id",
          "name": "googlePalmApi Credential"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0b75f8c6-64a2-447e-bae4-05c5d4e8a0c3",
      "name": "YT Tags",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -352,
        -224
      ],
      "parameters": {
        "text": "=Now follows the actual topic/transcript. Give me the YouTube tags for it:\n{{ $json.message.content }}",
        "options": {
          "systemMessage": "You are a YouTube SEO and motivational content specialist.\nYour task is to generate only YouTube tags (no description, no hashtags) based on the given video topic or transcript.\n\n✍️ Guidelines:\n\nOutput only comma-separated tags — no extra text, no formatting.\n\nTags should combine motivation, mindset, life lessons, money, success, and economics themes depending on the input.\n\nFocus on high-performing, searchable keywords that match motivational and economic growth content.\n\nInclude a mix of broad and specific tags (e.g., motivation, mindset, personal growth, economics, success, wealth, discipline, resilience).\n\nKeep total tags around 20–30 per response.\n\n⚙️ Input:\n\nVideo topic or transcript (added separately).\n\n🎯 Output:\n\nOnly a clean list of YouTube tags, comma-separated — no hashtags, no extra commentary."
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "2d1d7fb2-95e0-4190-a7fc-4947d097745a",
      "name": "YT Title",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -80,
        -224
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-nano",
          "cachedResultName": "GPT-4.1-NANO"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional copywriter for SEO-optimized YouTube titles."
            },
            {
              "content": "=Write me a suitable SEO YouTube title for the transcript of the following video transcript. Only the title, nothing else. Max 40 characters, so keep it short."
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "credential-id",
          "name": "openAiApi Credential"
        }
      },
      "typeVersion": 1.7
    },
    {
      "id": "ddc63e6b-8cff-4949-b97a-747d481c2253",
      "name": "Upload to youtube",
      "type": "n8n-nodes-base.youTube",
      "position": [
        -592,
        224
      ],
      "parameters": {
        "title": "={{ $json.message.content }}",
        "options": {
          "description": "=🚀 Self-hosted n8n setup — 100% working like n8n.io cloud.\nHosted on your server, fully configured & ready to automate.\nVisit: Evalinfo.com\nWhatsApp: +923250754569 | +923321997882\n\n{{ $('Create Description').item.json.message.content }}\n\n\n#myreelgen #evalinfo #muhammadnouman #ai #aiagents #n8n #selfhostedn8n\n\n{{ $('YT Tags').item.json.output }}",
          "privacyStatus": "public"
        },
        "resource": "video",
        "operation": "upload",
        "categoryId": "22",
        "regionCode": "IN",
        "binaryProperty": "=data"
      },
      "credentials": {
        "youTubeOAuth2Api": {
          "id": "credential-id",
          "name": "youTubeOAuth2Api Credential"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e352184f-beb2-4e07-9eb3-d7aaafd83b6a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1008,
        -368
      ],
      "parameters": {
        "color": 6,
        "width": 352,
        "height": 416,
        "content": "## Get video from Drive Folder\n**Double click** to edit me. [Guide](https://docs.n8n.io/workflows/sticky-notes/)"
      },
      "typeVersion": 1
    },
    {
      "id": "ef946b76-9232-4d4e-b970-f8f24b38a336",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -368
      ],
      "parameters": {
        "color": 3,
        "width": 816,
        "height": 416,
        "content": "## Generate Meta data \n**Double click** to edit me. [Guide](https://docs.n8n.io/workflows/sticky-notes/)"
      },
      "typeVersion": 1
    },
    {
      "id": "59aa6d9e-9e07-414d-9159-676f365c9a8e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        -368
      ],
      "parameters": {
        "color": 3,
        "width": 224,
        "height": 416,
        "content": "## Download Video  \n**Double click** to edit me. [Guide](https://docs.n8n.io/workflows/sticky-notes/)"
      },
      "typeVersion": 1
    },
    {
      "id": "5281a05f-2357-4881-a996-ac9d9dc17c19",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        64
      ],
      "parameters": {
        "color": 3,
        "width": 816,
        "height": 416,
        "content": "## Upload Video\n**Double click** to edit me. [Guide](https://docs.n8n.io/workflows/sticky-notes/)"
      },
      "typeVersion": 1
    },
    {
      "id": "e631fb6d-a7a3-485f-a7b8-c535275cb9f7",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        64
      ],
      "parameters": {
        "color": 3,
        "width": 224,
        "height": 416,
        "content": "## Delete Video  \n**Double click** to edit me. [Guide](https://docs.n8n.io/workflows/sticky-notes/)"
      },
      "typeVersion": 1
    },
    {
      "id": "5e6af056-bd53-4a85-a10f-c30416a039a0",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        64
      ],
      "parameters": {
        "color": 6,
        "width": 352,
        "height": 416,
        "content": "## Send Notfication\n**Double click** to edit me. [Guide](https://docs.n8n.io/workflows/sticky-notes/)"
      },
      "typeVersion": 1
    },
    {
      "id": "5d150d6e-8d28-4503-9565-cd42fc08d4ed",
      "name": "Delete video from Upload Folder1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        256,
        224
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('New Video?').item.json.id }}"
        },
        "options": {},
        "operation": "deleteFile"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "credential-id",
          "name": "googleDriveOAuth2Api Credential"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "3a7f4655-5fef-4209-93f8-e50fa3fecb44",
      "name": "Send a text message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        512,
        224
      ],
      "webhookId": "6544dd10-e8a9-47f2-8c98-5c0c3a839928",
      "parameters": {
        "text": "=🎬 Your video has been uploaded to YouTube channel **\"Eval Info\"!**\n\n• 🆔 Upload ID: {{ $('Upload to youtube').item.json.uploadId }}\n• 🗑️ Drive file deleted: {{ $json.success ? '✅ Yes' : '❌ No' }}\n• 🎯 Title: {{ $('YT Title').item.json.message.content }}\n",
        "chatId": "123456789",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "credential-id",
          "name": "telegramApi Credential"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "223440f4-14e1-4d87-914e-a148ff75639f",
      "name": "Post to Instagram",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -608,
        640
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v19.0/<YOUR PAGE ID HERE>/media",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "form-urlencoded",
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "image_url",
              "value": "<YOUR IMAGE URL HERE>"
            },
            {
              "name": "caption",
              "value": "<YOUR CAPTION HERE>"
            }
          ]
        },
        "nodeCredentialType": "facebookGraphApi"
      },
      "typeVersion": 4.2
    },
    {
      "id": "952eb838-7b36-4169-9c97-1660a4d7c139",
      "name": "Publish instagram post",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -272,
        640
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v19.0/17841404935066235/media_publish",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "form-urlencoded",
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "creation_id",
              "value": "={{ $json.id }}"
            }
          ]
        },
        "nodeCredentialType": "facebookGraphApi"
      },
      "typeVersion": 4.2
    },
    {
      "id": "6663b262-9207-4d34-8470-a60f9e783294",
      "name": "Post to Facebook",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        240,
        640
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v19.0/266271423823110/photos",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "form-urlencoded",
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "url",
              "value": "https://images.pexels.com/photos/5475816/pexels-photo-5475816.jpeg?auto=compress&cs=tinysrgb&fit=crop&h=627&w=1200"
            },
            {
              "name": "caption",
              "value": "This is the caption for the post"
            },
            {
              "name": "access_token",
              "value": "={{ $json.data[0].access_token }}"
            }
          ]
        },
        "nodeCredentialType": "facebookGraphApi"
      },
      "typeVersion": 4.2
    },
    {
      "id": "a94f3725-1eaf-4491-8958-d812f83fe35b",
      "name": "Use System token to get page token",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -96,
        640
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v19.0/me/accounts",
        "options": {},
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "facebookGraphApi"
      },
      "typeVersion": 4.2
    },
    {
      "id": "22179199-f09d-4456-bf1c-45bb7a2531f3",
      "name": "Get Correct Page Token",
      "type": "n8n-nodes-base.code",
      "position": [
        64,
        640
      ],
      "parameters": {
        "jsCode": "const page = $json.data.find(p => p.id === '266271423823110');\nreturn [{ json: { access_token: page.access_token } }];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "f3f681e0-cea6-48ce-9891-c7a4c62dcaee",
      "name": "Wait 2 Second",
      "type": "n8n-nodes-base.wait",
      "position": [
        -448,
        640
      ],
      "webhookId": "c40b180e-016c-4648-898a-5942b8a9b00d",
      "parameters": {
        "amount": 2
      },
      "typeVersion": 1.1
    },
    {
      "id": "7caacc2c-fcf6-4b39-ad05-81235611e68f",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -656,
        496
      ],
      "parameters": {
        "color": 5,
        "width": 1072,
        "height": 360,
        "content": "Using the permanant never expire token"
      },
      "typeVersion": 1
    },
    {
      "id": "0541f012-b217-4854-9b11-f04636165f20",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1360,
        112
      ],
      "parameters": {
        "width": 680,
        "height": 1220,
        "content": " How to Create a Permanent System User Token (Recommended)\n\nThis token doesn’t expire and is best for automation use cases\n\n1. Verify Your Business\n\nGo to https://business.facebook.com/settings/info\n\nComplete business verification under Business Info tab\n\nSubmit your business documents and wait for approval (Sometimes you just have to submit an EIN/Tax-ID.\n\nApproval can take 1-5 Business days\n\nOnce Approved do the following.\n\n2. Create a System User\n\nIn Business Settings\n\nGo to System Users > Click Add\n\nAssign a name (e.g. n8n-bot) and select Admin access\n\n3. Assign Assets to System User\n\nIn the same System User view, assign:\n\nYour Facebook Page (with Full Control)\n\nYour Instagram Account (linked via Page)\n\nYour App\n\n4. Generate a Token\n\nClick Generate Token\n\nSelect your App\n\nSet expiration to Never\n\nGrant these permissions:\n\npages_show_list\n\npages_read_engagement\n\npages_manage_posts\n\ninstagram_basic\n\ninstagram_content_publish\n\n-If instagram_content_publish is not visible, you may need to request it via App Review under the App dashboard.\n\n5. Use This Token\n\nStore it in the Facebook Graph API\n\n"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "YT Tags": {
      "main": [
        [
          {
            "node": "YT Title",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "YT Title": {
      "main": [
        [
          {
            "node": "Download New Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New Video?": {
      "main": [
        [
          {
            "node": "Create Description",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2.5FlashPrev": {
      "ai_languageModel": [
        [
          {
            "node": "YT Tags",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Wait 2 Second": {
      "main": [
        [
          {
            "node": "Publish instagram post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to Instagram": {
      "main": [
        [
          {
            "node": "Wait 2 Second",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to youtube": {
      "main": [
        [
          {
            "node": "Delete video from Upload Folder1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Description": {
      "main": [
        [
          {
            "node": "YT Tags",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download New Video": {
      "main": [
        [
          {
            "node": "Upload to youtube",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a text message": {
      "main": [
        []
      ]
    },
    "Get Correct Page Token": {
      "main": [
        [
          {
            "node": "Post to Facebook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Publish instagram post": {
      "main": [
        [
          {
            "node": "Use System token to get page token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete video from Upload Folder1": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Use System token to get page token": {
      "main": [
        [
          {
            "node": "Get Correct Page Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}