{
  "id": "0cuzFC47AFJslSZu",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Auto-Post Trending Tweets with AI Images using Gemini, FLUX & Buffer",
  "tags": [
    {
      "id": "8SQ9sFZ86SUKssJ9",
      "name": "Tweets",
      "createdAt": "2026-04-04T18:41:46.655Z",
      "updatedAt": "2026-04-04T18:41:46.655Z"
    }
  ],
  "nodes": [
    {
      "id": "19f03cb9-bc96-4fdc-823e-feb006352e13",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        1056,
        -240
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "=30 8,12,16 * * *"
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "cdb01e02-c630-49db-bc2c-d444c6999fc4",
      "name": "Create a data table",
      "type": "n8n-nodes-base.dataTable",
      "onError": "continueRegularOutput",
      "disabled": true,
      "position": [
        4032,
        -272
      ],
      "parameters": {
        "columns": {
          "column": [
            {
              "name": "trend"
            },
            {
              "name": "date"
            }
          ]
        },
        "options": {},
        "resource": "table",
        "operation": "create",
        "tableName": "table_name"
      },
      "executeOnce": false,
      "typeVersion": 1.1
    },
    {
      "id": "dfb23ad8-9889-4a7a-ac40-c7dc12bcedd6",
      "name": "Filter Last 24h",
      "type": "n8n-nodes-base.code",
      "onError": "continueRegularOutput",
      "position": [
        4528,
        -272
      ],
      "parameters": {
        "jsCode": "const allTrends = $input.all();\n\n// Get used trends from Get Used Trends (deduplicate by id)\nlet usedTrendsItems = [];\ntry {\n  const raw = $node[\"Get Used Trends\"].all();\n  // Deduplicate by id - keeps only first occurrence of each id\n  const seen = new Set();\n  usedTrendsItems = raw.filter(item => {\n    const id = item.json.id;\n    if (seen.has(id)) return false;\n    seen.add(id);\n    return true;\n  });\n} catch (e) {\n  usedTrendsItems = [];\n}\n\nconst oneDay = 24 * 60 * 60 * 1000;\nconst now = new Date();\n\nconst recentUsed = usedTrendsItems\n  .filter(item => {\n    if (!item.json.date) return false;\n    const d = new Date(item.json.date);\n    if (isNaN(d.getTime())) return false;\n    return (now - d) < oneDay;\n  })\n  .map(item => (item.json.trend || \"\").trim().toLowerCase());\n\nconst availableTrends = allTrends.filter(item => {\n  const trend = (item.json.trend || \"\").trim().toLowerCase();\n  return !recentUsed.includes(trend);\n});\n\nreturn availableTrends.map(item => ({ json: { trend: item.json.trend } }));"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "e8a3e24e-713c-4be5-8f0f-d1be0c897eba",
      "name": "Pick Trend",
      "type": "n8n-nodes-base.code",
      "onError": "continueRegularOutput",
      "position": [
        5136,
        -272
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\n\n// Pick the first 2 trends from the list\nconst picked = items.slice(0, 2);\n\nreturn picked.map(item => ({\n  json: {\n    trend: item.json?.trend?.json?.trend || item.json?.trend\n  }\n}));"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "07796504-f538-4a63-a4a7-24223c705b21",
      "name": "Get Used Trends",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        4288,
        -272
      ],
      "parameters": {
        "operation": "get",
        "returnAll": true,
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "yJnzJvRdKazvvCuY",
          "cachedResultUrl": "/projects/vXqhDNlXbSeCxe2L/datatables/yJnzJvRdKazvvCuY",
          "cachedResultName": "trend_table"
        }
      },
      "typeVersion": 1.1,
      "alwaysOutputData": true
    },
    {
      "id": "52c97b11-4258-4d79-9832-60e0166fe005",
      "name": "Prepare Trend Record",
      "type": "n8n-nodes-base.code",
      "position": [
        8096,
        -320
      ],
      "parameters": {
        "jsCode": "// Get the current trend from the loop (passed through Loop Over Items)\nconst currentTrend = $('Loop Over Items').item.json.trend;\n\nreturn [{\n  json: {\n    trend: currentTrend,\n    tweet: $input.first().json.content[0].text.text,\n    usedAt: new Date().toISOString()\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "ff76741f-7368-4087-bd4b-406fbb8d4cee",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        5840,
        -320
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "c48ef204-8293-4d77-812c-e0ee07fd9d4f",
      "name": "Run an Actor and get dataset",
      "type": "@apify/n8n-nodes-apify.apify",
      "onError": "continueRegularOutput",
      "position": [
        1264,
        -240
      ],
      "parameters": {
        "actorId": {
          "__rl": true,
          "mode": "list",
          "value": "VPeCKacMZL2Lgem5t",
          "cachedResultUrl": "https://console.apify.com/actors/VPeCKacMZL2Lgem5t/input",
          "cachedResultName": "Twitter Trending Topics Scraper \ud83c\udf0e (easyapi/twitter-trending-topics-scraper)"
        },
        "timeout": {},
        "operation": "Run actor and get dataset",
        "customBody": "{\n    \"country\": \"nigeria\",\n    \"proxyConfiguration\": {\n        \"useApifyProxy\": false\n    }\n}"
      },
      "credentials": {
        "apifyApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "98073d77-f2f4-42dc-8e8c-9d471ae1f52c",
      "name": "Extract Trends1",
      "type": "n8n-nodes-base.code",
      "onError": "continueRegularOutput",
      "position": [
        1488,
        -240
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\n\nconst firstItem = items[0]?.json;\nif (!firstItem || firstItem.error) {\n  return [{ json: { success: false, error: firstItem?.error || \"No data received\" } }];\n}\n\nconst seen = new Set();\nconst trends = items.flatMap(item => {\n  const data = item.json;\n  const records = Array.isArray(data) ? data : [data];\n  return records\n    .map(record => record.title?.trim())\n    .filter(title => {\n      if (!title || seen.has(title)) return false;\n      seen.add(title);\n      return true;\n    })\n    .map(title => ({ json: { trend: title } }));\n});\n\nif (trends.length === 0) {\n  return [{ json: { success: false, error: \"No valid trend data found\" } }];\n}\n\nreturn [{ json: { success: true, trends } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "d5ca20d9-e77e-4813-9785-edf162d754b6",
      "name": "Split Trend1",
      "type": "n8n-nodes-base.code",
      "position": [
        2800,
        -720
      ],
      "parameters": {
        "jsCode": "const trends = $json.trends;\n\nreturn trends.map(trend => ({\n  json: { trend }\n}));"
      },
      "typeVersion": 2
    },
    {
      "id": "53e97a37-ee7e-43b8-88db-1d6d03ce950f",
      "name": "Apify Success? (Primary)",
      "type": "n8n-nodes-base.if",
      "position": [
        1696,
        -240
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "163328ab-270c-4abe-a261-1c5acce7acb8",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.success }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "437a2170-75f8-484c-93c3-f17926d107fc",
      "name": "Generate Image with FLUX",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        7008,
        -288
      ],
      "parameters": {
        "url": "https://router.huggingface.co/hf-inference/models/black-forest-labs/FLUX.1-schnell",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        },
        "jsonBody": "={\n  \"inputs\": \"photorealistic image of {{ $('Extract Tweet Text').item.json.tweet }} ultra realistic, cinematic lighting, 8k, highly detailed, professional photography, few or no text\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "image/png"
            }
          ]
        },
        "nodeCredentialType": "huggingFaceApi"
      },
      "credentials": {
        "huggingFaceApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "862c4102-341f-4933-aa92-0a82b92795b7",
      "name": "Upload a file",
      "type": "n8n-nodes-base.dropbox",
      "position": [
        7168,
        -288
      ],
      "parameters": {
        "path": "=/n8n/{{ $('Loop Over Items').item.json.trend }}_{{ $itemIndex + 1 }}.png",
        "binaryData": true,
        "authentication": "oAuth2"
      },
      "credentials": {
        "dropboxOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "00547540-3e8f-40ae-accd-6090eafc59c5",
      "name": "Generate Tweet with Gemini",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "onError": "continueErrorOutput",
      "position": [
        6096,
        -288
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-flash",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "options": {
          "includeMergedResponse": false
        },
        "messages": {
          "values": [
            {
              "content": "= generate a short tweet base on this x.com trend: {{ $json.trend }} . The generated tweet must be base on live events, react to the contextuse pidgin + casual tone. only one otion, no **\\n, maximum of 275 characters."
            }
          ]
        },
        "builtInTools": {
          "googleSearch": true
        }
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1,
      "alwaysOutputData": false
    },
    {
      "id": "91076085-e23c-4598-9b79-c1198abbe6f2",
      "name": "Post to X via Buffer",
      "type": "@n8n/n8n-nodes-langchain.mcpClient",
      "notes": "Twiiter Auto post",
      "position": [
        7840,
        -96
      ],
      "parameters": {
        "tool": {
          "__rl": true,
          "mode": "list",
          "value": "create_post",
          "cachedResultName": "create_post"
        },
        "options": {},
        "parameters": {
          "value": {
            "text": "={{ $('Extract Tweet Text').item.json.tweet }}",
            "assets": "={\n    \"images\": [\n    {\n      \"url\": \"{{ $json.file_url }}\",\n      \"thumbnailUrl\": \"{{ $json.file_url }}\",\n      \"metadata\": {\n        \"altText\": \"{{ $('Extract Tweet Text').item.json.tweet }}\",\n        \"animatedThumbnail\": \"string\",\n        \"userTags\": [\n          {\n            \"handle\": \"string\",\n            \"x\": 0,\n            \"y\": 0\n          }\n        ],\n        \"dimensions\": {\n          \"width\": 0,\n          \"height\": 0\n        }\n      }\n    }\n  ]\n\n} ",
            "channelId": "69ce9bddaf47dacb6980757d",
            "schedulingType": "automatic"
          },
          "schema": [
            {
              "id": "channelId",
              "type": "string",
              "display": true,
              "removed": false,
              "required": true,
              "displayName": "channelId",
              "defaultMatch": false
            },
            {
              "id": "schedulingType",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "notification",
                  "value": "notification"
                },
                {
                  "name": "automatic",
                  "value": "automatic"
                }
              ],
              "removed": false,
              "required": true,
              "displayName": "schedulingType",
              "defaultMatch": false
            },
            {
              "id": "mode",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "addToQueue",
                  "value": "addToQueue"
                },
                {
                  "name": "shareNow",
                  "value": "shareNow"
                },
                {
                  "name": "shareNext",
                  "value": "shareNext"
                },
                {
                  "name": "customScheduled",
                  "value": "customScheduled"
                },
                {
                  "name": "recommendedTime",
                  "value": "recommendedTime"
                }
              ],
              "removed": true,
              "required": false,
              "displayName": "mode",
              "defaultMatch": false
            },
            {
              "id": "text",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "text",
              "defaultMatch": false
            },
            {
              "id": "dueAt",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "dueAt",
              "defaultMatch": false
            },
            {
              "id": "tagIds",
              "type": "array",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "tagIds",
              "defaultMatch": false,
              "defaultValue": "[\n  \"string\"\n]"
            },
            {
              "id": "assets",
              "type": "object",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "assets",
              "defaultMatch": false,
              "defaultValue": "{\n  \"images\": [\n    {\n      \"url\": \"string\",\n      \"thumbnailUrl\": \"string\",\n      \"metadata\": {\n        \"altText\": \"string\",\n        \"animatedThumbnail\": \"string\",\n        \"userTags\": [\n          {\n            \"handle\": \"string\",\n            \"x\": 0,\n            \"y\": 0\n          }\n        ],\n        \"dimensions\": {\n          \"width\": 0,\n          \"height\": 0\n        }\n      }\n    }\n  ],\n  \"videos\": [\n    {\n      \"url\": \"string\",\n      \"thumbnailUrl\": \"string\",\n      \"metadata\": {\n        \"thumbnailOffset\": 0,\n        \"title\": \"string\"\n      }\n    }\n  ],\n  \"documents\": [\n    {\n      \"url\": \"string\",\n      \"title\": \"string\",\n      \"thumbnailUrl\": \"string\"\n    }\n  ],\n  \"link\": {\n    \"url\": \"string\",\n    \"title\": \"string\",\n    \"description\": \"string\",\n    \"thumbnailUrl\": \"string\"\n  }\n}"
            },
            {
              "id": "metadata",
              "type": "object",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "metadata",
              "defaultMatch": false,
              "defaultValue": "{\n  \"instagram\": {\n    \"type\": \"story\",\n    \"link\": \"string\",\n    \"geolocation\": {\n      \"id\": \"string\",\n      \"text\": \"string\"\n    },\n    \"shouldShareToFeed\": false,\n    \"stickerFields\": {\n      \"text\": \"string\"\n    }\n  },\n  \"facebook\": {\n    \"type\": \"post\",\n    \"annotations\": [\n      {\n        \"content\": \"string\",\n        \"indices\": [\n          0\n        ],\n        \"text\": \"string\",\n        \"url\": \"string\"\n      }\n    ],\n    \"linkAttachment\": {\n      \"url\": \"string\"\n    }\n  },\n  \"linkedin\": {\n    \"annotations\": [\n      {\n        \"id\": \"string\",\n        \"link\": \"string\",\n        \"entity\": \"string\",\n        \"vanityName\": \"string\",\n        \"localizedName\": \"string\",\n        \"start\": 0,\n        \"length\": 0\n      }\n    ],\n    \"linkAttachment\": {\n      \"url\": \"string\"\n    }\n  },\n  \"twitter\": {\n    \"retweet\": {\n      \"id\": \"string\"\n    },\n    \"thread\": [\n      {\n        \"text\": \"string\",\n        \"assets\": {\n          \"images\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"altText\": \"string\",\n                \"animatedThumbnail\": \"string\",\n                \"userTags\": [\n                  {\n                    \"handle\": \"string\",\n                    \"x\": 0,\n                    \"y\": 0\n                  }\n                ],\n                \"dimensions\": {\n                  \"width\": 0,\n                  \"height\": 0\n                }\n              }\n            }\n          ],\n          \"videos\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"thumbnailOffset\": 0,\n                \"title\": \"string\"\n              }\n            }\n          ],\n          \"documents\": [\n            {\n              \"url\": \"string\",\n              \"title\": \"string\",\n              \"thumbnailUrl\": \"string\"\n            }\n          ],\n          \"link\": {\n            \"url\": \"string\",\n            \"title\": \"string\",\n            \"description\": \"string\",\n            \"thumbnailUrl\": \"string\"\n          }\n        }\n      }\n    ]\n  },\n  \"pinterest\": {\n    \"title\": \"string\",\n    \"url\": \"string\",\n    \"boardServiceId\": \"string\"\n  },\n  \"google\": {\n    \"type\": \"event\",\n    \"title\": \"string\",\n    \"detailsOffer\": {\n      \"title\": \"string\",\n      \"startDate\": \"string\",\n      \"endDate\": \"string\",\n      \"code\": \"string\",\n      \"link\": \"string\",\n      \"terms\": \"string\"\n    },\n    \"detailsEvent\": {\n      \"title\": \"string\",\n      \"startDate\": \"string\",\n      \"endDate\": \"string\",\n      \"isFullDayEvent\": false,\n      \"button\": \"none\",\n      \"link\": \"string\"\n    },\n    \"detailsWhatsNew\": {\n      \"button\": \"none\",\n      \"link\": \"string\"\n    }\n  },\n  \"youtube\": {\n    \"title\": \"string\",\n    \"categoryId\": \"string\",\n    \"privacy\": \"public\",\n    \"license\": \"youtube\",\n    \"notifySubscribers\": false,\n    \"embeddable\": false,\n    \"madeForKids\": false\n  },\n  \"mastodon\": {\n    \"thread\": [\n      {\n        \"text\": \"string\",\n        \"assets\": {\n          \"images\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"altText\": \"string\",\n                \"animatedThumbnail\": \"string\",\n                \"userTags\": [\n                  {\n                    \"handle\": \"string\",\n                    \"x\": 0,\n                    \"y\": 0\n                  }\n                ],\n                \"dimensions\": {\n                  \"width\": 0,\n                  \"height\": 0\n                }\n              }\n            }\n          ],\n          \"videos\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"thumbnailOffset\": 0,\n                \"title\": \"string\"\n              }\n            }\n          ],\n          \"documents\": [\n            {\n              \"url\": \"string\",\n              \"title\": \"string\",\n              \"thumbnailUrl\": \"string\"\n            }\n          ],\n          \"link\": {\n            \"url\": \"string\",\n            \"title\": \"string\",\n            \"description\": \"string\",\n            \"thumbnailUrl\": \"string\"\n          }\n        }\n      }\n    ],\n    \"spoilerText\": \"string\"\n  },\n  \"startPage\": {\n    \"link\": \"string\"\n  },\n  \"threads\": {\n    \"type\": \"post\",\n    \"thread\": [\n      {\n        \"text\": \"string\",\n        \"assets\": {\n          \"images\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"altText\": \"string\",\n                \"animatedThumbnail\": \"string\",\n                \"userTags\": [\n                  {\n                    \"handle\": \"string\",\n                    \"x\": 0,\n                    \"y\": 0\n                  }\n                ],\n                \"dimensions\": {\n                  \"width\": 0,\n                  \"height\": 0\n                }\n              }\n            }\n          ],\n          \"videos\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"thumbnailOffset\": 0,\n                \"title\": \"string\"\n              }\n            }\n          ],\n          \"documents\": [\n            {\n              \"url\": \"string\",\n              \"title\": \"string\",\n              \"thumbnailUrl\": \"string\"\n            }\n          ],\n          \"link\": {\n            \"url\": \"string\",\n            \"title\": \"string\",\n            \"description\": \"string\",\n            \"thumbnailUrl\": \"string\"\n          }\n        }\n      }\n    ],\n    \"linkAttachment\": {\n      \"url\": \"string\"\n    },\n    \"topic\": \"string\",\n    \"locationId\": \"string\",\n    \"locationName\": \"string\"\n  },\n  \"bluesky\": {\n    \"thread\": [\n      {\n        \"text\": \"string\",\n        \"assets\": {\n          \"images\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"altText\": \"string\",\n                \"animatedThumbnail\": \"string\",\n                \"userTags\": [\n                  {\n                    \"handle\": \"string\",\n                    \"x\": 0,\n                    \"y\": 0\n                  }\n                ],\n                \"dimensions\": {\n                  \"width\": 0,\n                  \"height\": 0\n                }\n              }\n            }\n          ],\n          \"videos\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"thumbnailOffset\": 0,\n                \"title\": \"string\"\n              }\n            }\n          ],\n          \"documents\": [\n            {\n              \"url\": \"string\",\n              \"title\": \"string\",\n              \"thumbnailUrl\": \"string\"\n            }\n          ],\n          \"link\": {\n            \"url\": \"string\",\n            \"title\": \"string\",\n            \"description\": \"string\",\n            \"thumbnailUrl\": \"string\"\n          }\n        }\n      }\n    ],\n    \"linkAttachment\": {\n      \"url\": \"string\"\n    }\n  },\n  \"tiktok\": {\n    \"title\": \"string\"\n  }\n}"
            },
            {
              "id": "saveToDraft",
              "type": "boolean",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "saveToDraft",
              "defaultMatch": false
            },
            {
              "id": "ideaId",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "ideaId",
              "defaultMatch": false
            },
            {
              "id": "draftId",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "draftId",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "endpointUrl": "https://mcp.buffer.com/mcp",
        "authentication": "bearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8f10fcdc-0a3e-4cd0-86a1-7ffef0f91399",
      "name": "Generate Download link",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        7376,
        -288
      ],
      "parameters": {
        "url": "https://api.dropboxapi.com/2/files/get_temporary_link",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"path\": \"{{ $json.path_lower }}\"\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "dropboxOAuth2Api"
      },
      "credentials": {
        "dropboxOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "eace3a98-7889-4184-a568-011b73447440",
      "name": "Extract Download Link",
      "type": "n8n-nodes-base.set",
      "position": [
        7584,
        -288
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a13822d5-0089-4a9d-8417-5076c6262420",
              "name": "file_url",
              "type": "string",
              "value": "={{ $json.link }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "0fd2b927-249b-42cf-804e-3331b0a5ebc8",
      "name": "Extract Trends2",
      "type": "n8n-nodes-base.code",
      "onError": "continueRegularOutput",
      "position": [
        2400,
        -480
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\n\nconst firstItem = items[0]?.json;\nif (!firstItem || firstItem.error) {\n  return [{ json: { success: false, error: firstItem?.error || \"No data received\" } }];\n}\n\nconst seen = new Set();\nconst trends = items.flatMap(item => {\n  const data = item.json;\n  const records = Array.isArray(data) ? data : [data];\n  return records\n    .map(record => record.title?.trim())\n    .filter(title => {\n      if (!title || seen.has(title)) return false;\n      seen.add(title);\n      return true;\n    })\n    .map(title => ({ json: { trend: title } }));\n});\n\nif (trends.length === 0) {\n  return [{ json: { success: false, error: \"No valid trend data found\" } }];\n}\n\nreturn [{ json: { success: true, trends } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "e2b9299a-8984-4f9a-b62e-43fc9b5d0598",
      "name": "Run an Actor and get dataset1",
      "type": "@apify/n8n-nodes-apify.apify",
      "onError": "continueRegularOutput",
      "position": [
        2080,
        -112
      ],
      "parameters": {
        "actorId": {
          "__rl": true,
          "mode": "list",
          "value": "VPeCKacMZL2Lgem5t",
          "cachedResultUrl": "https://console.apify.com/actors/VPeCKacMZL2Lgem5t/input",
          "cachedResultName": "Twitter Trending Topics Scraper \ud83c\udf0e (easyapi/twitter-trending-topics-scraper)"
        },
        "timeout": {},
        "operation": "Run actor and get dataset",
        "customBody": "{\n    \"country\": \"nigeria\",\n    \"proxyConfiguration\": {\n        \"useApifyProxy\": false\n    }\n}"
      },
      "credentials": {
        "apifyApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "08782332-47b3-4103-8b5e-4d6b650485bf",
      "name": "Apify Success? (Fallback)",
      "type": "n8n-nodes-base.if",
      "position": [
        2560,
        -576
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "163328ab-270c-4abe-a261-1c5acce7acb8",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.success }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "241bff52-c866-4e3a-bc3d-51e56425e6dc",
      "name": "Save Used Trend",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        8272,
        -320
      ],
      "parameters": {
        "columns": {
          "value": {
            "date": "={{ $json.usedAt }}",
            "trend": "={{ $json.trend }}"
          },
          "schema": [
            {
              "id": "trend",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "trend",
              "defaultMatch": false
            },
            {
              "id": "date",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "date",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "yJnzJvRdKazvvCuY",
          "cachedResultUrl": "/projects/vXqhDNlXbSeCxe2L/datatables/yJnzJvRdKazvvCuY",
          "cachedResultName": "trend_table"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "cf192f93-729d-437c-8987-04206aa011a9",
      "name": "\ud83d\udccb Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        -784
      ],
      "parameters": {
        "color": 4,
        "width": 780,
        "height": 1000,
        "content": "## \ud83d\udc26Generate & Post AI Tweets with Images from X Trending Topics (Gemini + FLUX + Buffer)\n\n**What this workflow does:**\nEvery day at 8:30am, 12:30pm, and 4:30pm it:\n1. Scrapes Nigeria's trending X topics via Apify\n2. Falls back to Gemini AI search if Apify fails\n3. Filters out trends used in the last 24h (deduplication)\n4. Picks 2 random unused trends\n5. Generates a pidgin-language tweet per trend using Gemini 2.5 Flash\n6. Generates a matching image using FLUX.1-schnell on HuggingFace\n7. Uploads image to Dropbox \u2192 gets a public link\n8. Posts tweet + image to X via Buffer MCP\n\n---\n### \ud83d\udd27 Setup Required\n- **Apify** \u2013 Connect your Apify API credential\n- **Google Gemini** \u2013 Connect your Google AI (Gemini) credential\n- **HuggingFace** \u2013 Create an HTTP Bearer Token credential with your HF token\n- **Dropbox** \u2013 Connect your Dropbox OAuth2 credential\n- **Buffer** \u2013 Connect your Buffer Bearer Token credential and set your Channel ID in the `Post to X via Buffer` node\n- **Data Table** \u2013 The `trend_table` Data Table must exist in your n8n project (run `Create a data table` once manually, then disable it)\n\n---\n### \u2699\ufe0f Customization\n- Change the `country` in the Apify nodes to scrape trends for a different country\n- Edit the tweet prompt in `Generate Tweet with Gemini` to change tone/language/style\n- Edit the FLUX prompt in `Generate Image with FLUX` to change image style\n- Adjust the schedule in `Schedule Trigger` (currently 3x/day)"
      },
      "typeVersion": 1
    },
    {
      "id": "23589edd-bffa-45b3-9128-c7036d082e4a",
      "name": "Section: Trend Fetching",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        896,
        -784
      ],
      "parameters": {
        "color": 7,
        "width": 2868,
        "height": 988,
        "content": "### 1\ufe0f\u20e3 Fetch Nigeria Trends\nApify scrapes X trending topics for Nigeria.\nIf Apify fails or returns no data, falls back to Gemini AI search.\nBoth paths merge at `Has Apify or Fallback Trends?`"
      },
      "typeVersion": 1
    },
    {
      "id": "c90b9a3d-9f32-48ee-bd6b-36a940a0c4f1",
      "name": "Section: Deduplication",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3888,
        -784
      ],
      "parameters": {
        "color": 7,
        "width": 1580,
        "height": 996,
        "content": "### 2\ufe0f\u20e3 Deduplication\nReads already-used trends from the `trend_table` Data Table.\nFilters out any trend used in the **last 24 hours**.\nThen picks 2 random trends from what's left."
      },
      "typeVersion": 1
    },
    {
      "id": "3c243578-7f28-4989-8a20-c07211d8f98f",
      "name": "Section: Generation & Posting",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5648,
        -800
      ],
      "parameters": {
        "color": 7,
        "width": 2804,
        "height": 1012,
        "content": "### 3\ufe0f\u20e3 Generate Tweet & Image (loops per trend)\nFor each picked trend:\n- Gemini generates a pidgin-English tweet (\u2264275 chars)\n- FLUX.1-schnell generates a matching photorealistic image\n- Image uploaded to Dropbox \u2192 temporary public URL extracted\n- Tweet + image posted to X via Buffer MCP\n- Trend saved to `trend_table` to prevent reuse"
      },
      "typeVersion": 1
    },
    {
      "id": "13fc2c27-dced-418b-bf4d-1c818cf3f0f0",
      "name": "\u26a0\ufe0f HuggingFace Setup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6752,
        -768
      ],
      "parameters": {
        "color": 3,
        "width": 400,
        "content": "\u26a0\ufe0f **HuggingFace Credential Required**\nCreate a new **HTTP Bearer Token** credential in n8n with your HuggingFace API token and select it in Generate Image with FLUX node.\n\nDo NOT paste the token directly in node parameters."
      },
      "typeVersion": 1
    },
    {
      "id": "d7266799-ebf6-474e-a391-3b80cb86f5b8",
      "name": "\u26a0\ufe0f Buffer Channel ID",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        7232,
        -768
      ],
      "parameters": {
        "color": 3,
        "width": 400,
        "content": "\ud83d\udccc **Buffer Setup**\nReplace `YOUR_BUFFER_CHANNEL_ID` in this node with your actual Buffer channel ID for your X (Twitter) account.\n\nFind it in your Buffer dashboard \u2192 Channel Settings."
      },
      "typeVersion": 1
    },
    {
      "id": "7747e20d-38d9-43c7-9928-08a9a795e040",
      "name": "Data Table Setup Tip",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4432,
        -768
      ],
      "parameters": {
        "color": 5,
        "width": 380,
        "height": 140,
        "content": "\ud83d\udee0\ufe0f **One-time setup:**\nRun `Create a data table` manually once to create the `trend_table`.\nThen **disable** that node \u2014 it only needs to run once."
      },
      "typeVersion": 1
    },
    {
      "id": "8c2f19e8-02a1-44e9-9610-7118ec5773c2",
      "name": "Post to facebook via Buffer1",
      "type": "@n8n/n8n-nodes-langchain.mcpClient",
      "notes": "Twiiter Auto post",
      "position": [
        7824,
        -464
      ],
      "parameters": {
        "tool": {
          "__rl": true,
          "mode": "list",
          "value": "create_post",
          "cachedResultName": "create_post"
        },
        "options": {},
        "parameters": {
          "value": {
            "text": "={{ $('Extract Tweet Text').item.json.tweet }}",
            "assets": "={\n    \"images\": [\n    {\n      \"url\": \"{{ $json.file_url }}\",\n      \"thumbnailUrl\": \"{{ $json.file_url }}\",\n      \"metadata\": {\n        \"altText\": \"{{ $('Extract Tweet Text').item.json.tweet }}\",\n        \"animatedThumbnail\": \"string\",\n        \"userTags\": [\n          {\n            \"handle\": \"string\",\n            \"x\": 0,\n            \"y\": 0\n          }\n        ],\n        \"dimensions\": {\n          \"width\": 0,\n          \"height\": 0\n        }\n      }\n    }\n  ]\n\n} ",
            "metadata": "{\n  \"facebook\": {\n    \"type\": \"post\"\n  }\n}",
            "channelId": "690c55cb5bd637c1835edc4d",
            "schedulingType": "automatic"
          },
          "schema": [
            {
              "id": "channelId",
              "type": "string",
              "display": true,
              "removed": false,
              "required": true,
              "displayName": "channelId",
              "defaultMatch": false
            },
            {
              "id": "schedulingType",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "notification",
                  "value": "notification"
                },
                {
                  "name": "automatic",
                  "value": "automatic"
                }
              ],
              "removed": false,
              "required": true,
              "displayName": "schedulingType",
              "defaultMatch": false
            },
            {
              "id": "mode",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "addToQueue",
                  "value": "addToQueue"
                },
                {
                  "name": "shareNow",
                  "value": "shareNow"
                },
                {
                  "name": "shareNext",
                  "value": "shareNext"
                },
                {
                  "name": "customScheduled",
                  "value": "customScheduled"
                },
                {
                  "name": "recommendedTime",
                  "value": "recommendedTime"
                }
              ],
              "removed": true,
              "required": false,
              "displayName": "mode",
              "defaultMatch": false
            },
            {
              "id": "text",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "text",
              "defaultMatch": false
            },
            {
              "id": "dueAt",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "dueAt",
              "defaultMatch": false
            },
            {
              "id": "tagIds",
              "type": "array",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "tagIds",
              "defaultMatch": false,
              "defaultValue": "[\n  \"string\"\n]"
            },
            {
              "id": "assets",
              "type": "object",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "assets",
              "defaultMatch": false,
              "defaultValue": "{\n  \"images\": [\n    {\n      \"url\": \"string\",\n      \"thumbnailUrl\": \"string\",\n      \"metadata\": {\n        \"altText\": \"string\",\n        \"animatedThumbnail\": \"string\",\n        \"userTags\": [\n          {\n            \"handle\": \"string\",\n            \"x\": 0,\n            \"y\": 0\n          }\n        ],\n        \"dimensions\": {\n          \"width\": 0,\n          \"height\": 0\n        }\n      }\n    }\n  ],\n  \"videos\": [\n    {\n      \"url\": \"string\",\n      \"thumbnailUrl\": \"string\",\n      \"metadata\": {\n        \"thumbnailOffset\": 0,\n        \"title\": \"string\"\n      }\n    }\n  ],\n  \"documents\": [\n    {\n      \"url\": \"string\",\n      \"title\": \"string\",\n      \"thumbnailUrl\": \"string\"\n    }\n  ],\n  \"link\": {\n    \"url\": \"string\",\n    \"title\": \"string\",\n    \"description\": \"string\",\n    \"thumbnailUrl\": \"string\"\n  }\n}"
            },
            {
              "id": "metadata",
              "type": "object",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "metadata",
              "defaultMatch": false,
              "defaultValue": "{\n  \"instagram\": {\n    \"type\": \"story\",\n    \"link\": \"string\",\n    \"geolocation\": {\n      \"id\": \"string\",\n      \"text\": \"string\"\n    },\n    \"shouldShareToFeed\": false,\n    \"stickerFields\": {\n      \"text\": \"string\"\n    }\n  },\n  \"facebook\": {\n    \"type\": \"post\",\n    \"annotations\": [\n      {\n        \"content\": \"string\",\n        \"indices\": [\n          0\n        ],\n        \"text\": \"string\",\n        \"url\": \"string\"\n      }\n    ],\n    \"linkAttachment\": {\n      \"url\": \"string\"\n    }\n  },\n  \"linkedin\": {\n    \"annotations\": [\n      {\n        \"id\": \"string\",\n        \"link\": \"string\",\n        \"entity\": \"string\",\n        \"vanityName\": \"string\",\n        \"localizedName\": \"string\",\n        \"start\": 0,\n        \"length\": 0\n      }\n    ],\n    \"linkAttachment\": {\n      \"url\": \"string\"\n    }\n  },\n  \"twitter\": {\n    \"retweet\": {\n      \"id\": \"string\"\n    },\n    \"thread\": [\n      {\n        \"text\": \"string\",\n        \"assets\": {\n          \"images\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"altText\": \"string\",\n                \"animatedThumbnail\": \"string\",\n                \"userTags\": [\n                  {\n                    \"handle\": \"string\",\n                    \"x\": 0,\n                    \"y\": 0\n                  }\n                ],\n                \"dimensions\": {\n                  \"width\": 0,\n                  \"height\": 0\n                }\n              }\n            }\n          ],\n          \"videos\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"thumbnailOffset\": 0,\n                \"title\": \"string\"\n              }\n            }\n          ],\n          \"documents\": [\n            {\n              \"url\": \"string\",\n              \"title\": \"string\",\n              \"thumbnailUrl\": \"string\"\n            }\n          ],\n          \"link\": {\n            \"url\": \"string\",\n            \"title\": \"string\",\n            \"description\": \"string\",\n            \"thumbnailUrl\": \"string\"\n          }\n        }\n      }\n    ]\n  },\n  \"pinterest\": {\n    \"title\": \"string\",\n    \"url\": \"string\",\n    \"boardServiceId\": \"string\"\n  },\n  \"google\": {\n    \"type\": \"event\",\n    \"title\": \"string\",\n    \"detailsOffer\": {\n      \"title\": \"string\",\n      \"startDate\": \"string\",\n      \"endDate\": \"string\",\n      \"code\": \"string\",\n      \"link\": \"string\",\n      \"terms\": \"string\"\n    },\n    \"detailsEvent\": {\n      \"title\": \"string\",\n      \"startDate\": \"string\",\n      \"endDate\": \"string\",\n      \"isFullDayEvent\": false,\n      \"button\": \"none\",\n      \"link\": \"string\"\n    },\n    \"detailsWhatsNew\": {\n      \"button\": \"none\",\n      \"link\": \"string\"\n    }\n  },\n  \"youtube\": {\n    \"title\": \"string\",\n    \"categoryId\": \"string\",\n    \"privacy\": \"public\",\n    \"license\": \"youtube\",\n    \"notifySubscribers\": false,\n    \"embeddable\": false,\n    \"madeForKids\": false\n  },\n  \"mastodon\": {\n    \"thread\": [\n      {\n        \"text\": \"string\",\n        \"assets\": {\n          \"images\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"altText\": \"string\",\n                \"animatedThumbnail\": \"string\",\n                \"userTags\": [\n                  {\n                    \"handle\": \"string\",\n                    \"x\": 0,\n                    \"y\": 0\n                  }\n                ],\n                \"dimensions\": {\n                  \"width\": 0,\n                  \"height\": 0\n                }\n              }\n            }\n          ],\n          \"videos\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"thumbnailOffset\": 0,\n                \"title\": \"string\"\n              }\n            }\n          ],\n          \"documents\": [\n            {\n              \"url\": \"string\",\n              \"title\": \"string\",\n              \"thumbnailUrl\": \"string\"\n            }\n          ],\n          \"link\": {\n            \"url\": \"string\",\n            \"title\": \"string\",\n            \"description\": \"string\",\n            \"thumbnailUrl\": \"string\"\n          }\n        }\n      }\n    ],\n    \"spoilerText\": \"string\"\n  },\n  \"startPage\": {\n    \"link\": \"string\"\n  },\n  \"threads\": {\n    \"type\": \"post\",\n    \"thread\": [\n      {\n        \"text\": \"string\",\n        \"assets\": {\n          \"images\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"altText\": \"string\",\n                \"animatedThumbnail\": \"string\",\n                \"userTags\": [\n                  {\n                    \"handle\": \"string\",\n                    \"x\": 0,\n                    \"y\": 0\n                  }\n                ],\n                \"dimensions\": {\n                  \"width\": 0,\n                  \"height\": 0\n                }\n              }\n            }\n          ],\n          \"videos\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"thumbnailOffset\": 0,\n                \"title\": \"string\"\n              }\n            }\n          ],\n          \"documents\": [\n            {\n              \"url\": \"string\",\n              \"title\": \"string\",\n              \"thumbnailUrl\": \"string\"\n            }\n          ],\n          \"link\": {\n            \"url\": \"string\",\n            \"title\": \"string\",\n            \"description\": \"string\",\n            \"thumbnailUrl\": \"string\"\n          }\n        }\n      }\n    ],\n    \"linkAttachment\": {\n      \"url\": \"string\"\n    },\n    \"topic\": \"string\",\n    \"locationId\": \"string\",\n    \"locationName\": \"string\"\n  },\n  \"bluesky\": {\n    \"thread\": [\n      {\n        \"text\": \"string\",\n        \"assets\": {\n          \"images\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"altText\": \"string\",\n                \"animatedThumbnail\": \"string\",\n                \"userTags\": [\n                  {\n                    \"handle\": \"string\",\n                    \"x\": 0,\n                    \"y\": 0\n                  }\n                ],\n                \"dimensions\": {\n                  \"width\": 0,\n                  \"height\": 0\n                }\n              }\n            }\n          ],\n          \"videos\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"thumbnailOffset\": 0,\n                \"title\": \"string\"\n              }\n            }\n          ],\n          \"documents\": [\n            {\n              \"url\": \"string\",\n              \"title\": \"string\",\n              \"thumbnailUrl\": \"string\"\n            }\n          ],\n          \"link\": {\n            \"url\": \"string\",\n            \"title\": \"string\",\n            \"description\": \"string\",\n            \"thumbnailUrl\": \"string\"\n          }\n        }\n      }\n    ],\n    \"linkAttachment\": {\n      \"url\": \"string\"\n    }\n  },\n  \"tiktok\": {\n    \"title\": \"string\"\n  }\n}"
            },
            {
              "id": "saveToDraft",
              "type": "boolean",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "saveToDraft",
              "defaultMatch": false
            },
            {
              "id": "ideaId",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "ideaId",
              "defaultMatch": false
            },
            {
              "id": "draftId",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "draftId",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "endpointUrl": "https://mcp.buffer.com/mcp",
        "authentication": "bearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c292733a-a7bb-40da-a9fd-dc5b006ffaeb",
      "name": "Post to thread via Buffer1",
      "type": "@n8n/n8n-nodes-langchain.mcpClient",
      "notes": "Twiiter Auto post",
      "position": [
        7840,
        -304
      ],
      "parameters": {
        "tool": {
          "__rl": true,
          "mode": "list",
          "value": "create_post",
          "cachedResultName": "create_post"
        },
        "options": {},
        "parameters": {
          "value": {
            "text": "={{ $('Extract Tweet Text').item.json.tweet }}",
            "assets": "={\n    \"images\": [\n    {\n      \"url\": \"{{ $json.file_url }}\",\n      \"thumbnailUrl\": \"{{ $json.file_url }}\",\n      \"metadata\": {\n        \"altText\": \"{{ $('Extract Tweet Text').item.json.tweet }}\",\n        \"animatedThumbnail\": \"string\",\n        \"userTags\": [\n          {\n            \"handle\": \"string\",\n            \"x\": 0,\n            \"y\": 0\n          }\n        ],\n        \"dimensions\": {\n          \"width\": 0,\n          \"height\": 0\n        }\n      }\n    }\n  ]\n\n} ",
            "channelId": "69d3b3f4031bfa423cd55a9f",
            "schedulingType": "automatic"
          },
          "schema": [
            {
              "id": "channelId",
              "type": "string",
              "display": true,
              "removed": false,
              "required": true,
              "displayName": "channelId",
              "defaultMatch": false
            },
            {
              "id": "schedulingType",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "notification",
                  "value": "notification"
                },
                {
                  "name": "automatic",
                  "value": "automatic"
                }
              ],
              "removed": false,
              "required": true,
              "displayName": "schedulingType",
              "defaultMatch": false
            },
            {
              "id": "mode",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "addToQueue",
                  "value": "addToQueue"
                },
                {
                  "name": "shareNow",
                  "value": "shareNow"
                },
                {
                  "name": "shareNext",
                  "value": "shareNext"
                },
                {
                  "name": "customScheduled",
                  "value": "customScheduled"
                },
                {
                  "name": "recommendedTime",
                  "value": "recommendedTime"
                }
              ],
              "removed": true,
              "required": false,
              "displayName": "mode",
              "defaultMatch": false
            },
            {
              "id": "text",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "text",
              "defaultMatch": false
            },
            {
              "id": "dueAt",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "dueAt",
              "defaultMatch": false
            },
            {
              "id": "tagIds",
              "type": "array",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "tagIds",
              "defaultMatch": false,
              "defaultValue": "[\n  \"string\"\n]"
            },
            {
              "id": "assets",
              "type": "object",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "assets",
              "defaultMatch": false,
              "defaultValue": "{\n  \"images\": [\n    {\n      \"url\": \"string\",\n      \"thumbnailUrl\": \"string\",\n      \"metadata\": {\n        \"altText\": \"string\",\n        \"animatedThumbnail\": \"string\",\n        \"userTags\": [\n          {\n            \"handle\": \"string\",\n            \"x\": 0,\n            \"y\": 0\n          }\n        ],\n        \"dimensions\": {\n          \"width\": 0,\n          \"height\": 0\n        }\n      }\n    }\n  ],\n  \"videos\": [\n    {\n      \"url\": \"string\",\n      \"thumbnailUrl\": \"string\",\n      \"metadata\": {\n        \"thumbnailOffset\": 0,\n        \"title\": \"string\"\n      }\n    }\n  ],\n  \"documents\": [\n    {\n      \"url\": \"string\",\n      \"title\": \"string\",\n      \"thumbnailUrl\": \"string\"\n    }\n  ],\n  \"link\": {\n    \"url\": \"string\",\n    \"title\": \"string\",\n    \"description\": \"string\",\n    \"thumbnailUrl\": \"string\"\n  }\n}"
            },
            {
              "id": "metadata",
              "type": "object",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "metadata",
              "defaultMatch": false,
              "defaultValue": "{\n  \"instagram\": {\n    \"type\": \"story\",\n    \"link\": \"string\",\n    \"geolocation\": {\n      \"id\": \"string\",\n      \"text\": \"string\"\n    },\n    \"shouldShareToFeed\": false,\n    \"stickerFields\": {\n      \"text\": \"string\"\n    }\n  },\n  \"facebook\": {\n    \"type\": \"post\",\n    \"annotations\": [\n      {\n        \"content\": \"string\",\n        \"indices\": [\n          0\n        ],\n        \"text\": \"string\",\n        \"url\": \"string\"\n      }\n    ],\n    \"linkAttachment\": {\n      \"url\": \"string\"\n    }\n  },\n  \"linkedin\": {\n    \"annotations\": [\n      {\n        \"id\": \"string\",\n        \"link\": \"string\",\n        \"entity\": \"string\",\n        \"vanityName\": \"string\",\n        \"localizedName\": \"string\",\n        \"start\": 0,\n        \"length\": 0\n      }\n    ],\n    \"linkAttachment\": {\n      \"url\": \"string\"\n    }\n  },\n  \"twitter\": {\n    \"retweet\": {\n      \"id\": \"string\"\n    },\n    \"thread\": [\n      {\n        \"text\": \"string\",\n        \"assets\": {\n          \"images\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"altText\": \"string\",\n                \"animatedThumbnail\": \"string\",\n                \"userTags\": [\n                  {\n                    \"handle\": \"string\",\n                    \"x\": 0,\n                    \"y\": 0\n                  }\n                ],\n                \"dimensions\": {\n                  \"width\": 0,\n                  \"height\": 0\n                }\n              }\n            }\n          ],\n          \"videos\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"thumbnailOffset\": 0,\n                \"title\": \"string\"\n              }\n            }\n          ],\n          \"documents\": [\n            {\n              \"url\": \"string\",\n              \"title\": \"string\",\n              \"thumbnailUrl\": \"string\"\n            }\n          ],\n          \"link\": {\n            \"url\": \"string\",\n            \"title\": \"string\",\n            \"description\": \"string\",\n            \"thumbnailUrl\": \"string\"\n          }\n        }\n      }\n    ]\n  },\n  \"pinterest\": {\n    \"title\": \"string\",\n    \"url\": \"string\",\n    \"boardServiceId\": \"string\"\n  },\n  \"google\": {\n    \"type\": \"event\",\n    \"title\": \"string\",\n    \"detailsOffer\": {\n      \"title\": \"string\",\n      \"startDate\": \"string\",\n      \"endDate\": \"string\",\n      \"code\": \"string\",\n      \"link\": \"string\",\n      \"terms\": \"string\"\n    },\n    \"detailsEvent\": {\n      \"title\": \"string\",\n      \"startDate\": \"string\",\n      \"endDate\": \"string\",\n      \"isFullDayEvent\": false,\n      \"button\": \"none\",\n      \"link\": \"string\"\n    },\n    \"detailsWhatsNew\": {\n      \"button\": \"none\",\n      \"link\": \"string\"\n    }\n  },\n  \"youtube\": {\n    \"title\": \"string\",\n    \"categoryId\": \"string\",\n    \"privacy\": \"public\",\n    \"license\": \"youtube\",\n    \"notifySubscribers\": false,\n    \"embeddable\": false,\n    \"madeForKids\": false\n  },\n  \"mastodon\": {\n    \"thread\": [\n      {\n        \"text\": \"string\",\n        \"assets\": {\n          \"images\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"altText\": \"string\",\n                \"animatedThumbnail\": \"string\",\n                \"userTags\": [\n                  {\n                    \"handle\": \"string\",\n                    \"x\": 0,\n                    \"y\": 0\n                  }\n                ],\n                \"dimensions\": {\n                  \"width\": 0,\n                  \"height\": 0\n                }\n              }\n            }\n          ],\n          \"videos\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"thumbnailOffset\": 0,\n                \"title\": \"string\"\n              }\n            }\n          ],\n          \"documents\": [\n            {\n              \"url\": \"string\",\n              \"title\": \"string\",\n              \"thumbnailUrl\": \"string\"\n            }\n          ],\n          \"link\": {\n            \"url\": \"string\",\n            \"title\": \"string\",\n            \"description\": \"string\",\n            \"thumbnailUrl\": \"string\"\n          }\n        }\n      }\n    ],\n    \"spoilerText\": \"string\"\n  },\n  \"startPage\": {\n    \"link\": \"string\"\n  },\n  \"threads\": {\n    \"type\": \"post\",\n    \"thread\": [\n      {\n        \"text\": \"string\",\n        \"assets\": {\n          \"images\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"altText\": \"string\",\n                \"animatedThumbnail\": \"string\",\n                \"userTags\": [\n                  {\n                    \"handle\": \"string\",\n                    \"x\": 0,\n                    \"y\": 0\n                  }\n                ],\n                \"dimensions\": {\n                  \"width\": 0,\n                  \"height\": 0\n                }\n              }\n            }\n          ],\n          \"videos\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"thumbnailOffset\": 0,\n                \"title\": \"string\"\n              }\n            }\n          ],\n          \"documents\": [\n            {\n              \"url\": \"string\",\n              \"title\": \"string\",\n              \"thumbnailUrl\": \"string\"\n            }\n          ],\n          \"link\": {\n            \"url\": \"string\",\n            \"title\": \"string\",\n            \"description\": \"string\",\n            \"thumbnailUrl\": \"string\"\n          }\n        }\n      }\n    ],\n    \"linkAttachment\": {\n      \"url\": \"string\"\n    },\n    \"topic\": \"string\",\n    \"locationId\": \"string\",\n    \"locationName\": \"string\"\n  },\n  \"bluesky\": {\n    \"thread\": [\n      {\n        \"text\": \"string\",\n        \"assets\": {\n          \"images\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"altText\": \"string\",\n                \"animatedThumbnail\": \"string\",\n                \"userTags\": [\n                  {\n                    \"handle\": \"string\",\n                    \"x\": 0,\n                    \"y\": 0\n                  }\n                ],\n                \"dimensions\": {\n                  \"width\": 0,\n                  \"height\": 0\n                }\n              }\n            }\n          ],\n          \"videos\": [\n            {\n              \"url\": \"string\",\n              \"thumbnailUrl\": \"string\",\n              \"metadata\": {\n                \"thumbnailOffset\": 0,\n                \"title\": \"string\"\n              }\n            }\n          ],\n          \"documents\": [\n            {\n              \"url\": \"string\",\n              \"title\": \"string\",\n              \"thumbnailUrl\": \"string\"\n            }\n          ],\n          \"link\": {\n            \"url\": \"string\",\n            \"title\": \"string\",\n            \"description\": \"string\",\n            \"thumbnailUrl\": \"string\"\n          }\n        }\n      }\n    ],\n    \"linkAttachment\": {\n      \"url\": \"string\"\n    }\n  },\n  \"tiktok\": {\n    \"title\": \"string\"\n  }\n}"
            },
            {
              "id": "saveToDraft",
              "type": "boolean",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "saveToDraft",
              "defaultMatch": false
            },
            {
              "id": "ideaId",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "ideaId",
              "defaultMatch": false
            },
            {
              "id": "draftId",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "draftId",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "endpointUrl": "https://mcp.buffer.com/mcp",
        "authentication": "bearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d5993762-e26e-46ca-93f5-e6ca1800e345",
      "name": "Data Table Setup Tip1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4880,
        -768
      ],
      "parameters": {
        "color": 5,
        "width": 380,
        "height": 140,
        "content": "\ud83d\udee0\ufe0f **Numbers of tweets per cycle setup :**\nAt Pick Trend Node. At \"const picked = items.slice(0, 2);\n\nChange 2 to the number of tweets you want per cycle **i.e if you want 5 tweets per cycle, change 2 to 5**."
      },
      "typeVersion": 1
    },
    {
      "id": "329f7dbd-4c44-4087-a9c9-b50509a1077c",
      "name": "Extract Tweet Text",
      "type": "n8n-nodes-base.code",
      "position": [
        6848,
        -320
      ],
      "parameters": {
        "jsCode": "const content = $json.content;\n\n// Handle direct text response\nif (content?.parts?.[0]?.text) {\n  return [{ json: { tweet: content.parts[0].text } }];\n}\n\n// Handle when Gemini used a tool/function call - text may be in a different part\nif (Array.isArray(content?.parts)) {\n  const textPart = content.parts.find(p => p.text);\n  if (textPart) {\n    return [{ json: { tweet: textPart.text } }];\n  }\n}\n\n// Fallback: check candidates structure (some Gemini versions return this)\nif ($json.candidates?.[0]?.content?.parts?.[0]?.text) {\n  return [{ json: { tweet: $json.candidates[0].content.parts[0].text } }];\n}\n\nthrow new Error('Could not extract tweet text from Gemini response. Raw: ' + JSON.stringify($json).slice(0, 300));"
      },
      "typeVersion": 2
    },
    {
      "id": "493b0682-ea33-4b79-bb15-1fa6315d1c80",
      "name": "Generate Tweet (HTTP Fallback)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        6704,
        -144
      ],
      "parameters": {
        "url": "=https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"contents\": [\n    {\n      \"role\": \"user\",\n      \"parts\": [\n        {\n          \"text\": \"=Based on what you know about the current real-world context of this trending topic: '{{ $json.trend }}', generate a complete, ready-to-post tweet. Use pidgin + casual tone, react to recent events around the trend. Rules: only one tweet, no **, no newlines, no incomplete sentences, must be a complete thought, maximum 275 characters. Output only the tweet text, nothing else.\"\n        }\n      ]\n    }\n  ],\n  \"generationConfig\": {\n    \"maxOutputTokens\": 1024,\n    \"stopSequences\": []\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "nodeCredentialType": "googlePalmApi"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "763c950e-b3fa-4ae0-90c7-42a0d3192b1d",
      "name": "Gemini Success",
      "type": "n8n-nodes-base.if",
      "position": [
        6544,
        -304
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cc9b1349-c799-4ad9-94b8-55f2c31135a4",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "=={{ $json.content.parts[0].text }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "43e5c6a2-cc2d-462e-9d03-5fa46d359684",
      "name": "\u26a0\ufe0f HuggingFace Setup1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6304,
        -768
      ],
      "parameters": {
        "color": 3,
        "width": 400,
        "content": "\u26a0\ufe0f **Gemini Credential Required**\nCreate a new **Google PaLM API** credential in n8n with your Gemini API token and select it in Generate Tweet with Gemini and  Generate Tweet (HTTP Fallback) node.\n\nDo NOT paste the token directly in node parameters."
      },
      "typeVersion": 1
    },
    {
      "id": "0c9aad79-6ee7-4c8f-a535-52a14876fa4a",
      "name": "Get Daily x trends1",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "onError": "continueErrorOutput",
      "position": [
        2576,
        -304
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-flash",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "pull today Nigeria specific trends of https://x.com/explore from to various third party trend tracking sites on search. Only output the trend words or phrases themselves, one per line. \n- Do NOT include descriptions, explanations, hashtags about other things, or any extra text. \n- Include both hashtags and plain words if trending, if none for x.com trends, get trends of other social media or google search or google trending. \n- Output format example:\n\nTrend1\nTrend2\nTrend3\n..."
            }
          ]
        },
        "builtInTools": {
          "urlContext": false,
          "googleSearch": true
        }
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1,
      "alwaysOutputData": true
    },
    {
      "id": "f34691d7-86a3-4405-bfdb-61f999863d2a",
      "name": "Extract Trends4",
      "type": "n8n-nodes-base.code",
      "position": [
        3232,
        -256
      ],
      "parameters": {
        "jsCode": "// Get the text from AI node\nconst text = $json[\"content\"]?.parts?.[0]?.text;\n\nif (!text) {\n    throw new Error(\"AI output not found. Check the node name or output structure.\");\n}\n\n// Split by newlines, trim each line, and remove empty lines\nconst trends = text\n    .split('\\n')\n    .map(t => t.trim())\n    .filter(Boolean);\n\n// Return as a single item\nreturn [{ json: { trends } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "f1342b8f-88c6-459e-a570-20c647f5fc6e",
      "name": "Generate Tweet (HTTP Fallback)1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3120,
        -32
      ],
      "parameters": {
        "url": "=https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"contents\": [\n    {\n      \"role\": \"user\",\n      \"parts\": [\n        {\n          \"text\": \"pull today or recent Nigeria specific trends of https://x.com/ from to various trend tracking sites on google search, if none search for other trending trends of other social media or google trending.List ONLY current or recent Nigeria trending topics.\\n\\nRules:\\n- Output ONLY the trend words or phrases.\\n- One trend per line.\\n- No explanations, no numbering, no bullets, no extra text.\\n- Do not add anything before or after the list.\\n- Include hashtags if they are part of the trend.\\n- If no Nigeria trends are found, return general global trends.\\n\\nOutput example:\\nTrend1\\nTrend2\\nTrend3\"\n        }\n      ]\n    }\n  ],\n  \"generationConfig\": {\n    \"maxOutputTokens\": 512,\n    \"temperature\": 0.2,\n    \"stopSequences\": [\"\\n\\n\"]\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "nodeCredentialType": "googlePalmApi"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "fa5b145c-055b-4cf0-bc06-70428e36604a",
      "name": "Gemini Success1",
      "type": "n8n-nodes-base.if",
      "position": [
        3008,
        -240
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cc9b1349-c799-4ad9-94b8-55f2c31135a4",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{$json[\"content\"][\"parts\"][0][\"text\"]}}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "bbfd860e-ad98-49ef-82d0-d06712b286a5",
      "name": "Split Trend2",
      "type": "n8n-nodes-base.code",
      "position": [
        3392,
        -256
      ],
      "parameters": {
        "jsCode": "const trends = $json.trends;\n\nreturn trends.map(trend => ({\n  json: { trend }\n}));"
      },
      "typeVersion": 2
    },
    {
      "id": "4f206e7b-943b-421c-96ad-86c0f1eedfeb",
      "name": "Merge Trends",
      "type": "n8n-nodes-base.merge",
      "position": [
        3616,
        -272
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "fa301591-2a56-4b7a-9a82-3e6964e332fc",
      "name": "Remove Used Trends",
      "type": "n8n-nodes-base.code",
      "onError": "continueRegularOutput",
      "position": [
        4752,
        -272
      ],
      "parameters": {
        "jsCode": "// Get used trends from previous node\nconst used = $input.all().map(i => i.json.trend || \"\");\n\n// Get current trends from \"Split Trend\" node\nconst current = $items(\"Merge Trends\") || []; // Make sure node name matches\n\n// Filter out used ones\nconst filtered = current.filter(item => !used.includes(item.json.trend));\n\n// Return empty array if none left\nreturn filtered.length > 0 ? filtered : [];"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    }
  ],
  "active": true,
  "settings": {
    "timezone": "Africa/Lagos",
    "binaryMode": "separate",
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "DA0gEOqh5l3BIuPx",
    "timeSavedMode": "fixed",
    "availableInMCP": true,
    "executionOrder": "v1"
  },
  "versionId": "7f529050-e3fa-499f-ab7f-cbee627acec5",
  "connections": {
    "Pick Trend": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Trends": {
      "main": [
        [
          {
            "node": "Create a data table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Trend1": {
      "main": [
        [
          {
            "node": "Merge Trends",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Trend2": {
      "main": [
        [
          {
            "node": "Merge Trends",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Upload a file": {
      "main": [
        [
          {
            "node": "Generate Download link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Success": {
      "main": [
        [
          {
            "node": "Extract Tweet Text",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate Tweet (HTTP Fallback)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Trends1": {
      "main": [
        [
          {
            "node": "Apify Success? (Primary)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Trends2": {
      "main": [
        [
          {
            "node": "Apify Success? (Fallback)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Trends4": {
      "main": [
        [
          {
            "node": "Split Trend2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Last 24h": {
      "main": [
        [
          {
            "node": "Remove Used Trends",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Success1": {
      "main": [
        [
          {
            "node": "Extract Trends4",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate Tweet (HTTP Fallback)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Used Trends": {
      "main": [
        [
          {
            "node": "Filter Last 24h",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Generate Tweet with Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Used Trend": {
      "main": [
        []
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Run an Actor and get dataset",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Tweet Text": {
      "main": [
        [
          {
            "node": "Generate Image with FLUX",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Used Trends": {
      "main": [
        [
          {
            "node": "Pick Trend",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a data table": {
      "main": [
        [
          {
            "node": "Get Used Trends",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Daily x trends1": {
      "main": [
        [
          {
            "node": "Gemini Success1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate Tweet (HTTP Fallback)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to X via Buffer": {
      "main": [
        [
          {
            "node": "Prepare Trend Record",
            "type": "main",
            "index": 0
          },
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Trend Record": {
      "main": [
        [
          {
            "node": "Save Used Trend",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Download Link": {
      "main": [
        [
          {
            "node": "Post to X via Buffer",
            "type": "main",
            "index": 0
          },
          {
            "node": "Post to facebook via Buffer1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Post to thread via Buffer1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Download link": {
      "main": [
        [
          {
            "node": "Extract Download Link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apify Success? (Primary)": {
      "main": [
        [
          {
            "node": "Split Trend1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Run an Actor and get dataset1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Image with FLUX": {
      "main": [
        [
          {
            "node": "Upload a file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apify Success? (Fallback)": {
      "main": [
        [
          {
            "node": "Split Trend1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Daily x trends1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Tweet with Gemini": {
      "main": [
        [
          {
            "node": "Gemini Success",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate Tweet (HTTP Fallback)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run an Actor and get dataset": {
      "main": [
        [
          {
            "node": "Extract Trends1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run an Actor and get dataset1": {
      "main": [
        [
          {
            "node": "Extract Trends2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Tweet (HTTP Fallback)": {
      "main": [
        [
          {
            "node": "Extract Tweet Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Tweet (HTTP Fallback)1": {
      "main": [
        [
          {
            "node": "Extract Trends4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}