{
  "nodes": [
    {
      "id": "29b8e15b-23c3-4fe0-bfb7-ad95c164f1d4",
      "name": "Schedule Daily Posts",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        256,
        304
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "f9c2b264-58d0-4506-ab23-309d8b7e4fa1",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        528,
        304
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "newsQuery",
              "type": "string",
              "value": "latest trending technology news"
            },
            {
              "id": "id-2",
              "name": "contentType",
              "type": "string",
              "value": "Instagram Image Post"
            },
            {
              "id": "id-3",
              "name": "targetAudience",
              "type": "string",
              "value": "tech enthusiasts and general audience"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "af9dffbc-3876-4c8a-a31e-2800428f68b6",
      "name": "AI Agent - News Research & Prompt Generation",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        848,
        304
      ],
      "parameters": {
        "text": "=Search for news about: {{ $('Workflow Configuration').item.json.newsQuery }}\n\nCreate image content and caption for this news story.",
        "options": {
          "systemMessage": "You are an expert content creator for Instagram. Your task is to:\n1. Use the SerpAPI tool to search for the latest trending news based on the query provided\n2. Analyze the top news stories and select the most engaging one\n3. Generate a compelling image prompt for DALL-E that will create an eye-catching Instagram image post about this news\n4. Generate an engaging Instagram caption with relevant hashtags\n\nReturn your response in this exact JSON format:\n{\n  \"imagePrompt\": \"detailed image generation prompt here\",\n  \"caption\": \"Instagram caption with hashtags here\",\n  \"newsSource\": \"source of the news\"\n}"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "id": "a7e27267-b2d2-4502-b5fa-0074d9fb042f",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        992,
        736
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "6fd97b73-daa6-4b90-b60f-9e76a18274ad",
      "name": "SerpAPI News Search Tool",
      "type": "@n8n/n8n-nodes-langchain.toolSerpApi",
      "position": [
        928,
        528
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "b6a858fb-6303-4ca0-b53c-9739f285fcf1",
      "name": "Post to Instagram",
      "type": "@mookielianhd/n8n-nodes-instagram.instagram",
      "position": [
        2064,
        304
      ],
      "parameters": {
        "node": "me",
        "caption": "={{ $('AI Agent - News Research & Prompt Generation').item.json.output.caption }}",
        "imageUrl": "={{ $json.url }}",
        "resource": "image",
        "additionalFields": {}
      },
      "typeVersion": 1
    },
    {
      "id": "f66a1bfe-8cf5-4531-8553-6d3679c47c0c",
      "name": "Generate an image",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        1472,
        304
      ],
      "parameters": {
        "prompt": "={{ $('AI Agent - News Research & Prompt Generation').item.json.output.imagePrompt }}",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "imagen-3.0-generate-001"
        },
        "options": {},
        "resource": "image"
      },
      "typeVersion": 1.1
    },
    {
      "id": "2fa4d079-e5c2-4f94-8e0d-4d748d1a0e1e",
      "name": "Upload file to tmpfiles",
      "type": "n8n-nodes-tmpfiles.tmpfiles",
      "position": [
        1760,
        304
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "ae90b7e9-dbcb-4fcd-bb3e-1df9435c914d",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1056,
        528
      ],
      "parameters": {
        "autoFix": true,
        "schemaType": "manual",
        "inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"imagePrompt\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Detailed image generation prompt for DALL-E\"\n\t\t},\n\t\t\"caption\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Instagram caption with hashtags\"\n\t\t},\n\t\t\"newsSource\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Source of the news\"\n\t\t}\n\t},\n\t\"required\": [\"imagePrompt\", \"caption\", \"newsSource\"]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "01e6d79c-1940-4527-b6dd-f7973918cfee",
      "name": "\ud83d\udcd6 Setup Guide",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        176
      ],
      "parameters": {
        "width": 420,
        "height": 612,
        "content": "## How it works\n\n1\ufe0f\u20e3 **Schedule Trigger** - Runs daily at 9 AM\n2\ufe0f\u20e3 **Configuration** - Sets news query and content preferences\n3\ufe0f\u20e3 **AI Agent** - Searches news via SerpAPI and generates content\n4\ufe0f\u20e3 **Image Generation** - Creates visual using Google Gemini\n5\ufe0f\u20e3 **Upload & Post** - Uploads image and publishes to Instagram\n\n## Setup steps\n\n**Required Credentials:**\n\u2022 Google Gemini API (AI Agent & Image Generation)\n\u2022 SerpAPI (News search)\n\u2022 Instagram API (Publishing)\n\n**Configuration:**\nEdit \"Workflow Configuration\" node to customize news topics, content type, and target audience.\n\n**Testing:**\n1. Add all credentials\n2. Run manually to verify\n3. Enable schedule trigger when ready"
      },
      "typeVersion": 1
    },
    {
      "id": "fbe2b3db-e03c-4a93-9f1d-237f2a9e0c7d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        240
      ],
      "parameters": {
        "color": 7,
        "height": 224,
        "content": "## Schedule/Timer"
      },
      "typeVersion": 1
    },
    {
      "id": "bf9fd1c0-f651-4aee-9c71-fc01b4cf12c5",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        192
      ],
      "parameters": {
        "color": 7,
        "height": 288,
        "content": "## Search Query & Target Audience"
      },
      "typeVersion": 1
    },
    {
      "id": "d3bff5db-3d83-4b36-a06a-bf6cd3b4786c",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        736,
        176
      ],
      "parameters": {
        "width": 624,
        "height": 736,
        "content": "# Scrape news  and generate a prompt"
      },
      "typeVersion": 1
    },
    {
      "id": "d53ece1a-7bd2-4a64-9891-147dc22e7f72",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1392,
        240
      ],
      "parameters": {
        "color": 7,
        "width": 272,
        "height": 240,
        "content": "## Generate post image"
      },
      "typeVersion": 1
    },
    {
      "id": "df401480-f109-4be5-8031-737c8d074547",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        240
      ],
      "parameters": {
        "color": 7,
        "width": 272,
        "height": 240,
        "content": "## Get a temporary URL"
      },
      "typeVersion": 1
    },
    {
      "id": "90dc2df5-1aa0-4164-b903-4d88547fbc6f",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1984,
        240
      ],
      "parameters": {
        "color": 7,
        "width": 272,
        "height": 240,
        "content": "## Final step - Publish"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Generate an image": {
      "main": [
        [
          {
            "node": "Upload file to tmpfiles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to Instagram": {
      "main": [
        []
      ]
    },
    "Schedule Daily Posts": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "AI Agent - News Research & Prompt Generation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload file to tmpfiles": {
      "main": [
        [
          {
            "node": "Post to Instagram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent - News Research & Prompt Generation",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Structured Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "SerpAPI News Search Tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent - News Research & Prompt Generation",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent - News Research & Prompt Generation",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent - News Research & Prompt Generation": {
      "main": [
        [
          {
            "node": "Generate an image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}