AutomationFlowsAI & RAG › Generate Social Media Captions for Product Images with Gemini AI and…

Generate Social Media Captions for Product Images with Gemini AI and…

Original n8n title: Generate Social Media Captions for Product Images with Gemini AI and Telegram Approval

ByKetan Sharma @ketan1411 on n8n.io

This n8n template demonstrates a complete AI-driven content pipeline for social media. It automatically generates captions and hashtags for new product images, collects human approval via Telegram, and publishes approved content to Twitter. It’s ideal for marketers, e-commerce…

Event trigger★★★★☆ complexityAI-powered20 nodesGoogle Drive TriggerGoogle GeminiTwitterGoogle DriveTelegramHTTP Request
AI & RAG Trigger: Event Nodes: 20 Complexity: ★★★★☆ AI nodes: yes Added:
Generate Social Media Captions for Product Images with Gemini AI and… — n8n workflow card showing Google Drive Trigger, Google Gemini, Twitter integration

This workflow corresponds to n8n.io template #8731 — we link there as the canonical source.

This workflow follows the Google Drive → Google Drive Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "VRQRmYeZgdhja9Tr",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Social_Media_Bot",
  "tags": [
    {
      "id": "LlHwj4AbBF3cwHta",
      "name": "AI_AGENT",
      "createdAt": "2025-09-10T10:29:49.604Z",
      "updatedAt": "2025-09-10T10:29:49.604Z"
    }
  ],
  "nodes": [
    {
      "id": "a6622083-d0bf-4d19-ac94-6483bb7e634f",
      "name": "Google Drive Trigger",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -448,
        -560
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "1A1Nmg58RBv969MqOIrvTWFlKbkgiKZBE",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1A1Nmg58RBv969MqOIrvTWFlKbkgiKZBE",
          "cachedResultName": "Product_images"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3d0c332a-f6f7-48ab-bfa0-d9c8c7d6b10c",
      "name": "Analyze image",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        0,
        -560
      ],
      "parameters": {
        "text": "You are an image analysis assistant. Analyze the given image carefully and provide a structured JSON output with the following fields:\n\n{\n  \"objects\": [\"list of main objects or items visible in the image\"],\n  \"subject\": \"the main subject or product of the image\",\n  \"colors\": [\"primary and secondary colors present\"],\n  \"background\": \"description of the background or setting\",\n  \"style\": \"the style of the image (e.g. professional photo, selfie, product shot, illustration, etc.)\",\n  \"mood\": \"the mood or feeling conveyed by the image\",\n  \"possible_use_cases\": [\"possible purposes of the image, e.g. advertisement, social media post, product showcase, art, etc.\"]\n}\n\nMake the response concise, factual, and machine-readable. Do not generate captions or hashtags here, just the structured description.\n\nReturn only valid JSON. \nDo not include explanations, markdown formatting, or code fences.",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-pro",
          "cachedResultName": "models/gemini-2.5-pro"
        },
        "options": {},
        "resource": "image",
        "simplify": false,
        "inputType": "binary",
        "operation": "analyze"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": false,
      "typeVersion": 1
    },
    {
      "id": "eea30874-a4da-458c-bb39-19bf306fb685",
      "name": "Message a model",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        672,
        -624
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-flash",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are a social media assistant.  \nI will provide you with structured JSON describing an image.  \nYour task is to generate exactly:\n\n1. One short, catchy caption (max 20 words).  \n2. Five trending hashtags relevant to the image.  \n\nReturn only valid JSON. Do not include explanations, text outside JSON, or code fences.\n\nFormat:\n{\n  \"caption\": \"your caption here\",\n  \"hashtags\": [\"#tag1\", \"#tag2\", \"#tag3\", \"#tag4\", \"#tag5\"]\n}\n\nHere is the image description:\nobjects:{{ $json.output.objects }}\nsubject:{{ $json.output.subject }}\nColor:{{ $json.output.colors }}\nbackground:{{ $json.output.background }}\nstyle:{{ $json.output.style }}\nmood:{{ $json.output.mood }}\npossible_use_cases:{{ $json.output.possible_use_cases }}"
            }
          ]
        }
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "01308a79-aead-4b1e-ad7e-52a26d0cd776",
      "name": "Create Tweet",
      "type": "n8n-nodes-base.twitter",
      "position": [
        2592,
        -720
      ],
      "parameters": {
        "text": "={{ $('Output_Cleaner').item.json.output.caption }}\n\n{{ $('Output_Cleaner').item.json.output.hashtags }}",
        "additionalFields": {
          "attachments": "={{ $json.media_id_string }}"
        }
      },
      "credentials": {
        "twitterOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "5ee71875-8bdc-4b67-8a6c-68f7b4c4130b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        -1680
      ],
      "parameters": {
        "width": 992,
        "height": 896,
        "content": "# Social Media Bot: AI Captioning, Approval & Auto-Tweet\n\nThis n8n template demonstrates a complete AI-assisted social media workflow. It automatically generates captions and hashtags for product images, allows human approval through Telegram, and posts approved content to Twitter.\n\n## How it works\n\n**Trigger**: A new file in Google Drive starts the workflow.\n\n**File Analysis**: Product details are extracted from the uploaded image.\n\n**AI Captioning**: Gemini generates a caption and 5 suggested hashtags.\n\n**Telegram Approval**: The user receives the image + caption + hashtags and chooses to approve, regenerate, or discard.\n\n\u2705 Approve \u2192 The content is posted on Twitter and a confirmation is sent back on Telegram.\n\n\ud83d\udd04 Regenerate \u2192 Gemini creates a new caption + hashtags and sends them again for approval.\n\n\u274c Discard \u2192 The user is notified on Telegram and the workflow ends.\n\n## Requirements\n\n1. Google Drive account\n\n2. Gemini API credentials (LLM access)\n\n3. Telegram bot for approvals + confirmations\n\n4. Twitter Developer Account & API credentials\n\n## Customising this workflow\n\n- Swap Google Drive with Dropbox, Notion, or Airtable as your source.\n\n- Replace Twitter with LinkedIn, Instagram, or multiple channels at once.\n\n- Expand Telegram approval flow to include team voting or multi-step review."
      },
      "typeVersion": 1
    },
    {
      "id": "b7ad05f6-6e2a-4446-8e5a-4f25db47f53c",
      "name": "Product_Img",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -224,
        -560
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $json.webViewLink }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "da8e463b-fb76-4ff0-9d66-3cef9be9afec",
      "name": "Temp_Field",
      "type": "n8n-nodes-base.set",
      "position": [
        224,
        -560
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "7df8de54-ae7b-4e8b-bc96-5df4486bfbb9",
              "name": "name",
              "type": "string",
              "value": "={{ $json.candidates[0].content.parts[0].text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b7cc2b40-2e71-42c4-91cd-2cffd36bb240",
      "name": "Formatting_Block",
      "type": "n8n-nodes-base.code",
      "position": [
        448,
        -560
      ],
      "parameters": {
        "jsCode": "const raw= $('Analyze image').first().json.candidates[0].content.parts[0].text;\n\n// remove code fences if present\nconst cleaned = raw.replace(/```json|```/g, \"\").trim();\n\n// parse JSON\nconst parsed = JSON.parse(cleaned);\n\n// wrap in single key\nreturn {\n  output: parsed\n};\n"
      },
      "typeVersion": 2
    },
    {
      "id": "da917fdf-ad46-451b-808d-c72aca5a5560",
      "name": "Output_Cleaner",
      "type": "n8n-nodes-base.code",
      "position": [
        1024,
        -624
      ],
      "parameters": {
        "jsCode": "const raw = $input.first().json.content.parts[0].text;\n\n// remove code fences if present\nconst cleaned = raw.replace(/```json|```/g, \"\").trim();\n\n// parse JSON\nconst parsed = JSON.parse(cleaned);\n\n// wrap in single key\nreturn {\n  output: parsed\n};\n"
      },
      "typeVersion": 2
    },
    {
      "id": "65dd795d-c099-40b9-bef2-0b07e849bbdd",
      "name": "Product_Img_1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1248,
        -624
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $('Google Drive Trigger').item.json.webViewLink }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "bdd0e1c4-2a5f-4423-8610-4a74815bb5e9",
      "name": "Send_Photo",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1472,
        -624
      ],
      "parameters": {
        "chatId": "123456789",
        "operation": "sendPhoto",
        "binaryData": true,
        "additionalFields": {
          "caption": "Uploaded Photo"
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ce801f5f-7bc4-4ff1-a8f8-3da3dcc1e75f",
      "name": "Ask_For_Approval",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1696,
        -624
      ],
      "parameters": {
        "chatId": "123456789",
        "message": "=\ud83d\udce2 Image Caption & Hashtags Generated \u2705\n\n\ud83d\uddbc\ufe0f Caption:{{ $('Output_Cleaner').item.json.output.caption }}\n\n\ud83c\udff7\ufe0f Hashtags:{{ $('Output_Cleaner').item.json.output.hashtags }}",
        "options": {},
        "operation": "sendAndWait",
        "approvalOptions": {
          "values": {
            "approvalType": "double"
          }
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8d6d5354-a999-4323-af58-ac79a9bbc62f",
      "name": "Condition_Checker",
      "type": "n8n-nodes-base.if",
      "position": [
        1920,
        -624
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "3cc51b44-14da-43d9-8570-589b005b3f6b",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.approved }}",
              "rightValue": ""
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "bbd7ecd7-1053-4f40-bb8b-b2bae814fd13",
      "name": "Product_Img2",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2144,
        -720
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $('Google Drive Trigger').item.json.webViewLink }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "ff462794-43e7-4411-b0fa-62e8e914fc27",
      "name": "Regenerate_Discard",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2144,
        -528
      ],
      "parameters": {
        "chatId": "123456789",
        "message": "Confirm whether to regenerate or discard the image and stop the process.",
        "options": {
          "appendAttribution": false
        },
        "operation": "sendAndWait",
        "approvalOptions": {
          "values": {
            "approvalType": "double",
            "approveLabel": "Regenerate",
            "disapproveLabel": "Discard"
          }
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "22a31f1e-955a-4572-a1c0-36e29cae08ba",
      "name": "Condition_Checker_1",
      "type": "n8n-nodes-base.if",
      "position": [
        2368,
        -464
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "94fb861c-860c-4a15-95f2-7c851ed9554a",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.approved }}",
              "rightValue": ""
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "9a232c21-50a4-4a37-9011-7085ad36bfa0",
      "name": "Send_Confirmation",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2816,
        -720
      ],
      "parameters": {
        "text": "\u2705 Your tweet has been successfully posted!",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "568bd433-fe2c-4419-8b63-07bdfd6d3df7",
      "name": "Send_Confirmation1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2592,
        -464
      ],
      "parameters": {
        "text": "\ud83d\uddd1\ufe0f The image has been discarded successfully.",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "867b86ec-4366-400a-9830-83418c7c422e",
      "name": "Request_Media_ID",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2368,
        -720
      ],
      "parameters": {
        "url": "https://upload.twitter.com/1.1/media/upload.json",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "media",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            }
          ]
        },
        "nodeCredentialType": "twitterOAuth1Api"
      },
      "credentials": {
        "twitterOAuth1Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "5b4b11f5-b9d1-4bae-8ac7-4cc864fb5f16",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2304,
        -960
      ],
      "parameters": {
        "color": 4,
        "height": 208,
        "content": "## Request_Media_ID Node\nThis node is used to upload the image to twitter server and this request will return us with a **Media_ID**, which is used to display product image in tweet."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "3483bc19-d761-416e-a66a-1ac717124076",
  "connections": {
    "Send_Photo": {
      "main": [
        [
          {
            "node": "Ask_For_Approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Temp_Field": {
      "main": [
        [
          {
            "node": "Formatting_Block",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Product_Img": {
      "main": [
        [
          {
            "node": "Analyze image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Tweet": {
      "main": [
        [
          {
            "node": "Send_Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Product_Img2": {
      "main": [
        [
          {
            "node": "Request_Media_ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze image": {
      "main": [
        [
          {
            "node": "Temp_Field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Product_Img_1": {
      "main": [
        [
          {
            "node": "Send_Photo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Output_Cleaner": {
      "main": [
        [
          {
            "node": "Product_Img_1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "Output_Cleaner",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ask_For_Approval": {
      "main": [
        [
          {
            "node": "Condition_Checker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Formatting_Block": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Request_Media_ID": {
      "main": [
        [
          {
            "node": "Create Tweet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Condition_Checker": {
      "main": [
        [
          {
            "node": "Product_Img2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Regenerate_Discard",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Regenerate_Discard": {
      "main": [
        [
          {
            "node": "Condition_Checker_1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Condition_Checker_1": {
      "main": [
        [
          {
            "node": "Formatting_Block",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send_Confirmation1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive Trigger": {
      "main": [
        [
          {
            "node": "Product_Img",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This n8n template demonstrates a complete AI-driven content pipeline for social media. It automatically generates captions and hashtags for new product images, collects human approval via Telegram, and publishes approved content to Twitter. It’s ideal for marketers, e-commerce…

Source: https://n8n.io/workflows/8731/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Monitor a Google Drive folder, process each image based on the prompt defined in and save the new image to the specified output Google Drive folder. Maintain a processing log in Google Sheets.

Google Drive Trigger, Google Drive, HTTP Request +2
AI & RAG

Transcribe audio messages from Telegram using Google Gemini for free.

Telegram, Telegram Trigger, HTTP Request +3
AI & RAG

The Problem That it Solves

Google Drive Trigger, OpenAI, Google Drive +5
AI & RAG

Voice Note -> Veo 3 AD. Uses telegramTrigger, telegram, openAi, httpRequest. Event-driven trigger; 49 nodes.

Telegram Trigger, Telegram, OpenAI +3
AI & RAG

Content creators, YouTubers, and social media managers who want to repurpose long form videos into short clips without doing it manually. Works on self hosted n8n instances.

Google Drive Trigger, Google Drive, N8N Nodes Renderio +3