{
  "nodes": [
    {
      "id": "fb534f68-03ac-4d75-ad01-25490a4251b3",
      "name": "Daily Collection Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -2048,
        2096
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 18
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "48efbbc6-fe12-4ad5-9ee4-997190939ecf",
      "name": "Weekly Report Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -2048,
        2316
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "daysInterval": 7,
              "triggerAtHour": 10
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "90076c39-2082-4ab2-afd5-9bc823b17fdf",
      "name": "Scrape Instagram Posts",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        -1824,
        2096
      ],
      "parameters": {
        "actorId": {
          "__rl": true,
          "mode": "list",
          "value": "shu8hvrXbJbY3Eb9W",
          "cachedResultUrl": "https://console.apify.com/actors/shu8hvrXbJbY3Eb9W/input",
          "cachedResultName": "Instagram Scraper (apify/instagram-scraper)"
        },
        "timeout": {},
        "operation": "Run actor and get dataset",
        "customBody": "{\n  \"directUrls\": [\n    \"https://www.instagram.com/explore/tags/AIart/\",\n    \"https://www.instagram.com/explore/tags/midjourney/\",\n    \"https://www.instagram.com/explore/tags/stablediffusion/\",\n    \"https://www.instagram.com/explore/tags/aiartwork/\",\n    \"https://www.instagram.com/explore/tags/generativeart/\",\n    \"https://www.instagram.com/explore/tags/aiartcommunity/\"\n  ],\n  \"resultsType\": \"posts\",\n  \"resultsLimit\": 20,\n  \"searchType\": \"hashtag\",\n  \"searchLimit\": 1,\n  \"addParentData\": false\n}",
        "authentication": "apifyOAuth2Api"
      },
      "typeVersion": 1
    },
    {
      "id": "58c8d5bc-19b9-449f-90df-d736ac6b27c0",
      "name": "Save to Database",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1600,
        2096
      ],
      "parameters": {
        "columns": {
          "value": {
            "url": "={{ $json.url }}",
            "likes": "={{ $json.likesCount }}",
            "caption": "={{ $json.caption }}",
            "post_id": "={{ $json.id }}",
            "comments": "={{ $json.commentsCount }}",
            "hashtags": "={{ $json.hashtags ? $json.hashtags.join(', ') : '' }}",
            "art_style": "",
            "image_url": "={{ $json.displayUrl }}",
            "timestamp": "={{ $json.timestamp }}",
            "ai_analysis": "",
            "collected_at": "={{ $now.toISO() }}",
            "color_palette": "",
            "sent_to_slack": "false",
            "owner_username": "={{ $json.ownerUsername }}",
            "engagement_score": "",
            "sent_to_telegram": "false"
          },
          "mappingMode": "defineBelow"
        },
        "options": {
          "cellFormat": "USER_ENTERED"
        },
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "Posts",
          "cachedResultUrl": "",
          "cachedResultName": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "={{ $credentials.sheetId }}",
          "cachedResultUrl": "",
          "cachedResultName": ""
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "934dc07b-ca3e-43f9-a69d-301a7a4acd3f",
      "name": "Get Existing Posts",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1376,
        2096
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "Posts",
          "cachedResultUrl": "",
          "cachedResultName": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "={{ $credentials.sheetId }}",
          "cachedResultUrl": "",
          "cachedResultName": ""
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "fe3fc817-0084-48b4-8d8c-951ab1c1505b",
      "name": "Check Duplicates",
      "type": "n8n-nodes-base.merge",
      "position": [
        -1152,
        2112
      ],
      "parameters": {
        "mode": "combine",
        "options": {
          "fuzzyCompare": false,
          "multipleMatches": "first",
          "disableDotNotation": false
        }
      },
      "typeVersion": 3
    },
    {
      "id": "b235c47a-5472-4adc-b7d9-6a66442b6b8f",
      "name": "Filter New Viral Posts",
      "type": "n8n-nodes-base.if",
      "position": [
        -928,
        2112
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "new-post-check",
              "operator": {
                "type": "string",
                "operation": "notExists"
              },
              "leftValue": "={{ $json.sent_to_telegram }}",
              "rightValue": ""
            },
            {
              "id": "caption-check",
              "operator": {
                "type": "string",
                "operation": "notEmpty"
              },
              "leftValue": "={{ $json.caption }}",
              "rightValue": ""
            },
            {
              "id": "likes-check",
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{ $json.likesCount }}",
              "rightValue": 100
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "4dba3286-9b6a-4b11-9e0f-83a9a1576817",
      "name": "Calculate Engagement Score",
      "type": "n8n-nodes-base.set",
      "position": [
        -704,
        2096
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "engagement-score",
              "name": "engagement_score",
              "type": "number",
              "value": "={{ Math.round(($json.likesCount + ($json.commentsCount * 3)) / Math.max(1, Math.floor((Date.now() - new Date($json.timestamp).getTime()) / (1000 * 60 * 60))) * 100) / 100 }}"
            },
            {
              "id": "viral-tier",
              "name": "viral_tier",
              "type": "string",
              "value": "={{ $json.likesCount >= 10000 ? '\ud83d\udd25 MEGA VIRAL' : $json.likesCount >= 1000 ? '\u26a1 VIRAL' : $json.likesCount >= 500 ? '\ud83d\udcc8 TRENDING' : '\u2728 RISING' }}"
            },
            {
              "id": "hashtag-categories",
              "name": "primary_category",
              "type": "string",
              "value": "={{ $json.caption.toLowerCase().includes('portrait') ? 'Portrait' : $json.caption.toLowerCase().includes('landscape') ? 'Landscape' : $json.caption.toLowerCase().includes('anime') ? 'Anime' : $json.caption.toLowerCase().includes('abstract') ? 'Abstract' : $json.caption.toLowerCase().includes('fantasy') ? 'Fantasy' : $json.caption.toLowerCase().includes('scifi') || $json.caption.toLowerCase().includes('sci-fi') ? 'Sci-Fi' : 'General' }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "8e2acb9d-7711-4a0f-9cc6-3773c1b30c2e",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -512,
        2096
      ],
      "parameters": {
        "options": {
          "reset": false
        }
      },
      "typeVersion": 3
    },
    {
      "id": "cc4e17f5-6f60-4976-afbf-a71aec0be7b1",
      "name": "AI Image Analysis",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -288,
        2320
      ],
      "parameters": {
        "model": "gpt-4o",
        "options": {
          "maxTokens": 500,
          "temperature": 0.3
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9f20d9b4-e87e-427b-b06d-4cdd744860aa",
      "name": "Analyze Artwork",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -288,
        2080
      ],
      "parameters": {
        "text": "=Analyze this AI-generated artwork and provide a structured analysis:\n\nImage URL: {{ $json.displayUrl }}\nCaption: {{ $json.caption }}\n\nProvide your analysis in the following JSON format ONLY (no other text):\n{\n  \"art_style\": \"[e.g., Photorealistic, Anime, Abstract, Surreal, Fantasy, Cyberpunk, etc.]\",\n  \"color_palette\": \"[e.g., Warm Earth Tones, Cool Blues, Vibrant Neons, Monochromatic, etc.]\",\n  \"mood\": \"[e.g., Serene, Dramatic, Mysterious, Joyful, Dark, etc.]\",\n  \"technique\": \"[e.g., Digital Painting, 3D Render, Mixed Media, etc.]\",\n  \"subject\": \"[Brief description of main subject]\",\n  \"quality_score\": [1-10 rating of artistic quality],\n  \"trending_potential\": \"[Low/Medium/High/Very High]\",\n  \"similar_artists\": \"[2-3 artist names whose style this resembles]\",\n  \"japanese_description\": \"[2-3 sentence artistic description in Japanese]\"\n}",
        "promptType": "define"
      },
      "typeVersion": 1.4
    },
    {
      "id": "c5eb28ab-c9ac-4a31-9afe-cc4af9c64d82",
      "name": "Parse AI Analysis",
      "type": "n8n-nodes-base.code",
      "position": [
        32,
        2080
      ],
      "parameters": {
        "jsCode": "// Parse AI analysis result\nconst aiResponse = $input.first().json.text || $input.first().json.output;\nlet analysis = {};\n\ntry {\n  // Extract JSON from response\n  const jsonMatch = aiResponse.match(/\\{[\\s\\S]*\\}/);\n  if (jsonMatch) {\n    analysis = JSON.parse(jsonMatch[0]);\n  }\n} catch (e) {\n  analysis = {\n    art_style: 'Unknown',\n    color_palette: 'Unknown',\n    mood: 'Unknown',\n    technique: 'Unknown',\n    subject: 'AI Generated Art',\n    quality_score: 5,\n    trending_potential: 'Medium',\n    similar_artists: 'Unknown',\n    japanese_description: 'AI\u30a2\u30fc\u30c8\u4f5c\u54c1'\n  };\n}\n\n// Get original item data from loop\nconst originalData = $('Loop Over Items').item.json;\n\nreturn {\n  json: {\n    ...originalData,\n    ai_analysis: JSON.stringify(analysis),\n    art_style: analysis.art_style,\n    color_palette: analysis.color_palette,\n    mood: analysis.mood,\n    quality_score: analysis.quality_score,\n    trending_potential: analysis.trending_potential,\n    japanese_description: analysis.japanese_description,\n    similar_artists: analysis.similar_artists\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "aa9981a1-8ea1-4718-a4cc-57129c0748d1",
      "name": "Translate to Japanese",
      "type": "n8n-nodes-base.deepL",
      "position": [
        256,
        2080
      ],
      "parameters": {
        "text": "={{ $json.caption }}",
        "translateTo": "JA",
        "additionalFields": {}
      },
      "typeVersion": 1
    },
    {
      "id": "7e73ef94-3ea9-41ed-a026-4968846b1ea9",
      "name": "Download Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        480,
        2080
      ],
      "parameters": {
        "url": "={{ $('Loop Over Items').item.json.displayUrl }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "4c6a1cdd-439d-401c-93e0-12c26e7ac5bf",
      "name": "Telegram Enabled?",
      "type": "n8n-nodes-base.if",
      "position": [
        704,
        1984
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "telegram-enabled",
              "operator": {
                "type": "boolean",
                "operation": "true"
              },
              "leftValue": "={{ $vars.ENABLE_TELEGRAM ?? true }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "c3cff666-ec05-43bb-9cc8-2d90b5dfe4b2",
      "name": "Slack Enabled?",
      "type": "n8n-nodes-base.if",
      "position": [
        704,
        2176
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "slack-enabled",
              "operator": {
                "type": "boolean",
                "operation": "true"
              },
              "leftValue": "={{ $vars.ENABLE_SLACK ?? false }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "8169b761-0cd5-4aea-8c6b-ac36bbedf375",
      "name": "Send to Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        928,
        2160
      ],
      "parameters": {
        "text": "=:art: *AI Art Discovery* {{ $('Parse AI Analysis').item.json.viral_tier }}",
        "otherOptions": {
          "includeLinkToWorkflow": false
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "736dd965-52c8-4172-a8ea-84a255597f59",
      "name": "Update Post Status",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1152,
        2080
      ],
      "parameters": {
        "columns": {
          "value": {
            "post_id": "={{ $('Loop Over Items').item.json.id }}",
            "art_style": "={{ $('Parse AI Analysis').item.json.art_style }}",
            "ai_analysis": "={{ $('Parse AI Analysis').item.json.ai_analysis }}",
            "processed_at": "={{ $now.toISO() }}",
            "color_palette": "={{ $('Parse AI Analysis').item.json.color_palette }}",
            "sent_to_slack": "={{ $vars.ENABLE_SLACK ? 'true' : 'false' }}",
            "engagement_score": "={{ $('Calculate Engagement Score').item.json.engagement_score }}",
            "sent_to_telegram": "={{ $vars.ENABLE_TELEGRAM ? 'true' : 'false' }}"
          },
          "mappingMode": "defineBelow"
        },
        "options": {
          "cellFormat": "USER_ENTERED"
        },
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "Posts",
          "cachedResultUrl": "",
          "cachedResultName": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "={{ $credentials.sheetId }}",
          "cachedResultUrl": "",
          "cachedResultName": ""
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "b785a460-f714-4236-8489-6717f20fe17f",
      "name": "Rate Limit Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        1424,
        2304
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "cb3fb98c-1c65-4542-92e6-0965d77f7825",
      "name": "Get Weekly Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1824,
        2316
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "Posts",
          "cachedResultUrl": "",
          "cachedResultName": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "={{ $credentials.sheetId }}",
          "cachedResultUrl": "",
          "cachedResultName": ""
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "e6f72981-a17c-42fe-b16a-1aa95350a7f5",
      "name": "Calculate Weekly Stats",
      "type": "n8n-nodes-base.code",
      "position": [
        -1600,
        2316
      ],
      "parameters": {
        "jsCode": "// Filter posts from last 7 days and calculate statistics\nconst items = $input.all();\nconst now = new Date();\nconst weekAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);\n\nconst weeklyPosts = items.filter(item => {\n  const collectedAt = new Date(item.json.collected_at);\n  return collectedAt >= weekAgo;\n});\n\n// Calculate statistics\nconst stats = {\n  totalPosts: weeklyPosts.length,\n  totalLikes: 0,\n  totalComments: 0,\n  avgEngagement: 0,\n  styleBreakdown: {},\n  moodBreakdown: {},\n  colorBreakdown: {},\n  topPosts: [],\n  trendingStyles: [],\n  peakDay: '',\n  peakDayCount: 0\n};\n\nconst dayCount = {};\n\nweeklyPosts.forEach(post => {\n  const data = post.json;\n  stats.totalLikes += parseInt(data.likes) || 0;\n  stats.totalComments += parseInt(data.comments) || 0;\n  stats.avgEngagement += parseFloat(data.engagement_score) || 0;\n  \n  // Style breakdown\n  if (data.art_style) {\n    stats.styleBreakdown[data.art_style] = (stats.styleBreakdown[data.art_style] || 0) + 1;\n  }\n  \n  // Color breakdown\n  if (data.color_palette) {\n    stats.colorBreakdown[data.color_palette] = (stats.colorBreakdown[data.color_palette] || 0) + 1;\n  }\n  \n  // Day count\n  const day = new Date(data.collected_at).toLocaleDateString('en-US', { weekday: 'long' });\n  dayCount[day] = (dayCount[day] || 0) + 1;\n});\n\nstats.avgEngagement = weeklyPosts.length > 0 ? (stats.avgEngagement / weeklyPosts.length).toFixed(2) : 0;\n\n// Find peak day\nObject.entries(dayCount).forEach(([day, count]) => {\n  if (count > stats.peakDayCount) {\n    stats.peakDay = day;\n    stats.peakDayCount = count;\n  }\n});\n\n// Top 5 posts by engagement\nstats.topPosts = weeklyPosts\n  .sort((a, b) => (parseFloat(b.json.engagement_score) || 0) - (parseFloat(a.json.engagement_score) || 0))\n  .slice(0, 5)\n  .map(p => ({\n    url: p.json.url,\n    style: p.json.art_style,\n    likes: p.json.likes,\n    engagement: p.json.engagement_score,\n    owner: p.json.owner_username\n  }));\n\n// Trending styles (sorted by count)\nstats.trendingStyles = Object.entries(stats.styleBreakdown)\n  .sort((a, b) => b[1] - a[1])\n  .slice(0, 5)\n  .map(([style, count]) => ({ style, count, percentage: ((count / weeklyPosts.length) * 100).toFixed(1) }));\n\nreturn { json: stats };"
      },
      "typeVersion": 2
    },
    {
      "id": "e857bbf3-d091-412a-9c79-c4d12c75e723",
      "name": "Generate Report",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -2064,
        2896
      ],
      "parameters": {
        "model": "gpt-4o",
        "options": {
          "maxTokens": 1500,
          "temperature": 0.7
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "83ca98ea-2dd0-46a1-9ab9-67521367bdc5",
      "name": "Create Trend Report",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -2064,
        2720
      ],
      "parameters": {
        "text": "=You are an AI art trend analyst. Generate a comprehensive weekly trend report in Japanese based on this data:\n\n\ud83d\udcca **Weekly Statistics:**\n- Total Posts Collected: {{ $json.totalPosts }}\n- Total Likes: {{ $json.totalLikes.toLocaleString() }}\n- Total Comments: {{ $json.totalComments.toLocaleString() }}\n- Average Engagement Score: {{ $json.avgEngagement }}\n- Peak Activity Day: {{ $json.peakDay }} ({{ $json.peakDayCount }} posts)\n\n\ud83c\udfa8 **Trending Art Styles:**\n{{ $json.trendingStyles.map(s => `- ${s.style}: ${s.count} posts (${s.percentage}%)`).join('\\n') }}\n\n\ud83c\udfc6 **Top 5 Posts This Week:**\n{{ $json.topPosts.map((p, i) => `${i+1}. @${p.owner} - ${p.style} (\u2764\ufe0f ${p.likes}, Score: ${p.engagement})`).join('\\n') }}\n\nGenerate a report in Japanese that includes:\n1. \ud83d\udcc8 \u9031\u9593\u30b5\u30de\u30ea\u30fc (Executive summary in 2-3 sentences)\n2. \ud83d\udd25 \u30c8\u30ec\u30f3\u30c9\u5206\u6790 (What styles are trending and why)\n3. \ud83d\udca1 \u30af\u30ea\u30a8\u30a4\u30bf\u30fc\u3078\u306e\u63d0\u6848 (Suggestions for AI artists based on trends)\n4. \ud83d\udd2e \u6765\u9031\u306e\u4e88\u6e2c (Predictions for next week)\n5. \u2b50 \u6ce8\u76ee\u306e\u30af\u30ea\u30a8\u30a4\u30bf\u30fc (Highlight top performers)\n\nFormat the report with clear sections and emojis for readability. Keep it professional but engaging.",
        "promptType": "define"
      },
      "typeVersion": 1.4
    },
    {
      "id": "7a4ad824-20a5-4e36-bdeb-1dae63bf9424",
      "name": "Send Report to Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1680,
        2544
      ],
      "parameters": {
        "text": "=\ud83d\udcca *Weekly AI Art Trend Report*\n{{ $now.format('yyyy\u5e74MM\u6708dd\u65e5') }}\n\n{{ $json.text || $json.output }}",
        "chatId": "={{ $vars.TELEGRAM_CHAT_ID }}",
        "additionalFields": {
          "parse_mode": "Markdown"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f8c93c48-c7b2-4f86-b924-a1340e2f20bf",
      "name": "Send Report to Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        -1680,
        2720
      ],
      "parameters": {
        "text": "=:chart_with_upwards_trend: *Weekly AI Art Trend Report* - {{ $now.format('yyyy\u5e74MM\u6708dd\u65e5') }}",
        "otherOptions": {}
      },
      "typeVersion": 2.2
    },
    {
      "id": "1916ba83-e8cb-4513-8d3d-04166de02f29",
      "name": "Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        -2048,
        3164
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "79c07066-dca0-49b6-96b7-1e6653d68ba4",
      "name": "Send Error Alert",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1824,
        3164
      ],
      "parameters": {
        "text": "=\u26a0\ufe0f *Workflow Error Alert*\n\n\u274c Error in: {{ $json.workflow.name }}\n\ud83d\udccd Node: {{ $json.execution.error.node.name }}\n\ud83d\udcac Message: {{ $json.execution.error.message }}\n\u23f0 Time: {{ $now.format('yyyy\u5e74MM\u6708dd\u65e5 HH:mm:ss') }}\n\n\ud83d\udd17 [View Execution]({{ $json.execution.url }})",
        "chatId": "={{ $vars.TELEGRAM_CHAT_ID }}",
        "additionalFields": {
          "parse_mode": "Markdown"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "08aba0c4-de2b-4527-b189-6bfa78efe650",
      "name": "Workflow Description",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2672,
        1952
      ],
      "parameters": {
        "width": 520,
        "height": 832,
        "content": "## \ud83c\udfa8 Instagram AI Art Intelligence Hub\n\nAdvanced workflow for collecting, analyzing, and distributing viral AI art content with comprehensive trend analytics.\n\n### \ud83d\ude80 Key Features:\n- **Multi-Source Collection**: Scrapes 6 AI art hashtags\n- **Duplicate Detection**: Google Sheets database prevents re-processing\n- **AI Image Analysis**: OpenAI Vision analyzes style, mood, colors, quality\n- **Engagement Scoring**: Algorithm calculates viral potential\n- **Japanese Translation**: DeepL API for Japanese market\n- **Multi-Platform Distribution**: Telegram + Slack support\n- **Weekly Trend Reports**: AI-generated analytics in Japanese\n- **Error Monitoring**: Real-time alerts via Telegram\n\n### \ud83d\udccb Setup Requirements:\n1. **Apify Account** - Instagram Scraper actor\n2. **OpenAI API Key** - For GPT-4 Vision analysis\n3. **DeepL API Key** - For translation\n4. **Google Sheets** - Create a sheet with columns: post_id, url, caption, likes, comments, timestamp, hashtags, image_url, owner_username, collected_at, engagement_score, ai_analysis, art_style, color_palette, sent_to_telegram, sent_to_slack\n5. **Telegram Bot** - Create via @BotFather\n6. **Slack App** (Optional) - For Slack integration\n\n### \u2699\ufe0f Environment Variables:\n- TELEGRAM_CHAT_ID: Your Telegram chat ID\n- SLACK_CHANNEL: Your Slack channel (optional)\n- ENABLE_TELEGRAM: true/false\n- ENABLE_SLACK: true/false\n\n### \ud83d\udcca Workflow Schedules:\n- Daily Collection: 18:00 (6 PM)\n- Weekly Report: Every 7 days at 10:00 AM"
      },
      "typeVersion": 1
    },
    {
      "id": "41f8386c-8372-4cd6-9dc8-afe93a5c0709",
      "name": "Step 1 Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2048,
        1952
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 112,
        "content": "### \ud83d\udce5 Step 1: Data Collection\nScrapes Instagram posts from 6 AI art hashtags using Apify, saves to Google Sheets database"
      },
      "typeVersion": 1
    },
    {
      "id": "e134bb18-7436-48d4-82bd-f4e1b51738f7",
      "name": "Step 2 Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1248,
        1936
      ],
      "parameters": {
        "color": 7,
        "width": 360,
        "height": 128,
        "content": "### \ud83d\udd0d Step 2: Duplicate Check & Filter\nMerges with existing data to identify new posts only, filters by engagement (100+ likes)"
      },
      "typeVersion": 1
    },
    {
      "id": "4cbc99c7-f9f1-4a72-8a1b-ca0ce8fe754b",
      "name": "Step 3 Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        1920
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 96,
        "content": "### \ud83e\udde0 Step 3: AI Analysis\nOpenAI Vision analyzes each image for style, mood, colors, quality score, and generates Japanese description"
      },
      "typeVersion": 1
    },
    {
      "id": "2ae6c0f4-88a7-48c0-8c67-3686490919e4",
      "name": "Step 4 Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        672,
        1840
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 96,
        "content": "### \ud83d\udce4 Step 4: Multi-Platform Distribution\nSends rich formatted posts to Telegram and/or Slack based on configuration"
      },
      "typeVersion": 1
    },
    {
      "id": "3d4512a3-34eb-4cf2-95dc-4f5373283528",
      "name": "Weekly Analytics Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1936,
        2896
      ],
      "parameters": {
        "color": 5,
        "width": 520,
        "height": 80,
        "content": "### \ud83d\udcca Weekly Analytics\nGenerates AI-powered trend report analyzing collected data, identifies trending styles, top creators, and predictions"
      },
      "typeVersion": 1
    },
    {
      "id": "9d5e6e48-bf40-40b2-9db0-7f6293f63ede",
      "name": "Error Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2016,
        3312
      ],
      "parameters": {
        "color": 3,
        "width": 280,
        "height": 112,
        "content": "### \u26a0\ufe0f Error Handling\nCaptures any workflow errors and sends detailed alerts to Telegram"
      },
      "typeVersion": 1
    },
    {
      "id": "0ee71aa2-b0cf-4750-b909-56077d9973db",
      "name": "Send to Telegram1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        928,
        1968
      ],
      "parameters": {
        "chatId": "={{ $vars.TELEGRAM_CHAT_ID }}",
        "operation": "sendPhoto",
        "binaryData": true,
        "additionalFields": {
          "caption": "={{ $('Parse AI Analysis').item.json.viral_tier }} *AI Art Discovery*\n\n\ud83c\udfa8 *Style:* {{ $('Parse AI Analysis').item.json.art_style }}\n\ud83c\udfad *Mood:* {{ $('Parse AI Analysis').item.json.mood }}\n\ud83c\udf08 *Colors:* {{ $('Parse AI Analysis').item.json.color_palette }}\n\u2b50 *Quality:* {{ $('Parse AI Analysis').item.json.quality_score }}/10\n\ud83d\udcca *Trending:* {{ $('Parse AI Analysis').item.json.trending_potential }}\n\n\ud83d\udcdd *Description (JP):*\n{{ $('Parse AI Analysis').item.json.japanese_description }}\n\n\ud83d\udcac *Original Caption:*\n{{ $('Translate to Japanese').item.json.text.substring(0, 300) }}{{ $('Translate to Japanese').item.json.text.length > 300 ? '...' : '' }}\n\n\u2764\ufe0f {{ $('Loop Over Items').item.json.likesCount.toLocaleString() }} | \ud83d\udcac {{ $('Loop Over Items').item.json.commentsCount.toLocaleString() }}\n\ud83d\udcc8 *Engagement Score:* {{ $('Calculate Engagement Score').item.json.engagement_score }}\n\n\ud83d\udd17 [View Original]({{ $('Loop Over Items').item.json.url }})\n\n#AIArt #{{ $('Parse AI Analysis').item.json.art_style.replace(/\\s+/g, '') }} #GenerativeArt",
          "parse_mode": "Markdown"
        }
      },
      "typeVersion": 1.2
    }
  ],
  "connections": {
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Send Error Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send to Slack": {
      "main": [
        [
          {
            "node": "Update Post Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Image": {
      "main": [
        [
          {
            "node": "Telegram Enabled?",
            "type": "main",
            "index": 0
          },
          {
            "node": "Slack Enabled?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack Enabled?": {
      "main": [
        [
          {
            "node": "Send to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Artwork": {
      "main": [
        [
          {
            "node": "Parse AI Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Report": {
      "ai_languageModel": [
        [
          {
            "node": "Create Trend Report",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get Weekly Data": {
      "main": [
        [
          {
            "node": "Calculate Weekly Stats",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Analyze Artwork",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rate Limit Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Duplicates": {
      "main": [
        [
          {
            "node": "Filter New Viral Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save to Database": {
      "main": [
        [
          {
            "node": "Get Existing Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Image Analysis": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze Artwork",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Analysis": {
      "main": [
        [
          {
            "node": "Translate to Japanese",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send to Telegram1": {
      "main": [
        [
          {
            "node": "Update Post Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Enabled?": {
      "main": [
        [
          {
            "node": "Send to Telegram1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Existing Posts": {
      "main": [
        [
          {
            "node": "Check Duplicates",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Post Status": {
      "main": [
        [
          {
            "node": "Rate Limit Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Trend Report": {
      "main": [
        [
          {
            "node": "Send Report to Telegram",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Report to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translate to Japanese": {
      "main": [
        [
          {
            "node": "Download Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weekly Report Trigger": {
      "main": [
        [
          {
            "node": "Get Weekly Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter New Viral Posts": {
      "main": [
        [
          {
            "node": "Calculate Engagement Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Instagram Posts": {
      "main": [
        [
          {
            "node": "Save to Database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily Collection Trigger": {
      "main": [
        [
          {
            "node": "Scrape Instagram Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Engagement Score": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}