AutomationFlowsAI & RAG › Generate Multilingual Social Content with Gpt-4o, Telegram and Google Sheets

Generate Multilingual Social Content with Gpt-4o, Telegram and Google Sheets

ByYevhenii @neolith2018 on n8n.io

Triggers when a message is received on Telegram. Checks conditions and either sends a default message or processes the message for content generation. Uses an AI agent to generate rich content including images and text. Formats and sends generated text in multiple languages…

Event trigger★★★★☆ complexityAI-powered19 nodesTelegram TriggerAgentOpenAI ChatOpenAITelegramGoogle Sheets
AI & RAG Trigger: Event Nodes: 19 Complexity: ★★★★☆ AI nodes: yes Added:
Generate Multilingual Social Content with Gpt-4o, Telegram and Google Sheets — n8n workflow card showing Telegram Trigger, Agent, OpenAI Chat integration

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

This workflow follows the Agent → Google Sheets 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": "y27nMOamJ9JYiV7uuXYtu",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "AI Content Master Generator",
  "tags": [],
  "nodes": [
    {
      "id": "fee92d5d-6f3a-490a-bb07-0aecc76c7149",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1136,
        32
      ],
      "parameters": {
        "width": 480,
        "height": 896,
        "content": "## AI Content Master Generator\n\n### How it works\n\n1. Triggers when a message is received on Telegram.\n2. Checks conditions and either sends a default message or processes the message for content generation.\n3. Uses an AI agent to generate rich content including images and text.\n4. Formats and sends generated text in multiple languages over Telegram.\n5. Saves generated image data and logs it into a Google Sheet.\n6. Sends back image content to Telegram as a photo message.\n\n### Setup steps\n\n- [ ] Configure Telegram credentials for messaging services.\n- [ ] Set up OpenAI API access for content generation.\n- [ ] Connect to Google Sheets with appropriate API credentials.\n\n### Customization\n\nLanguage options for text messages can be extended by adding more language nodes."
      },
      "typeVersion": 1
    },
    {
      "id": "91240af6-eed7-40af-8e60-3aacd7f3c5d5",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        528
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 304,
        "content": "## Trigger and condition check\n\nListens for messages from Telegram and checks the condition to determine the response path."
      },
      "typeVersion": 1
    },
    {
      "id": "2dd4d2f9-0113-4821-8595-5c9ced49f848",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        272
      ],
      "parameters": {
        "color": 7,
        "width": 544,
        "height": 512,
        "content": "## AI content processing\n\nProcesses the content using an AI agent and formats JSON output."
      },
      "typeVersion": 1
    },
    {
      "id": "10edcf0b-4026-455b-94b4-f25ac5cfc5ae",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        816
      ],
      "parameters": {
        "color": 7,
        "width": 240,
        "height": 320,
        "content": "## Send default message\n\nSends a predefined message via Telegram in case the condition fails."
      },
      "typeVersion": 1
    },
    {
      "id": "971a4a18-818f-4b57-8955-14d0d1a8a797",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        448,
        32
      ],
      "parameters": {
        "color": 7,
        "width": 240,
        "height": 720,
        "content": "## Generate multiple language messages\n\nGenerates and sends messages in different languages."
      },
      "typeVersion": 1
    },
    {
      "id": "c50b9ce5-1297-4cbb-bb4f-f576ef935e26",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        448,
        784
      ],
      "parameters": {
        "color": 7,
        "width": 768,
        "height": 272,
        "content": "## Generate image and log data\n\nGenerates an image and logs the data into Google Sheets, then sends back the photo."
      },
      "typeVersion": 1
    },
    {
      "id": "3deac245-0534-49ac-a245-954ccc60c38a",
      "name": "When Telegram Message Received",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -528,
        656
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {
          "download": true
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c803fc51-f7f7-4b54-bbc1-775832e91790",
      "name": "Content Definition Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -80,
        400
      ],
      "parameters": {
        "text": "=You are an international content strategist. Your task is to take the author's idea and create a content package in 3 languages.\n\nAUTHOR'S IDEA: {{ $json.message.text }}\n\nFor each language (English, Polski, Espa\u00f1ol) create three formats:\n\n1. Expert Longread (LinkedIn/Facebook): a deep expert post strictly on the author's topic, focused on practical value for the reader.\n2. Video Script (Reels/Shorts/TikTok): a dynamic 30\u201340 sec script, start with a strong hook strictly on topic.\n3. Engagement Post: a short lively post strictly on topic, ending with an open question to the audience.\n\nAlso create an Image Prompt: a short detailed description in English for a photorealistic illustration strictly on the author's topic. Specify lighting, style and main objects.\n\nCRITICALLY IMPORTANT: return ONLY valid JSON with no text before or after it. No explanations, no markdown blocks, only JSON.\n\n\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 JSON:\n{\n  \"en\": {\n    \"expert_post\": \"...\",\n    \"video_script\": \"...\",\n    \"engagement_post\": \"...\"\n  },\n  \"pl\": {\n    \"expert_post\": \"...\",\n    \"video_script\": \"...\",\n    \"engagement_post\": \"...\"\n  },\n  \"es\": {\n    \"expert_post\": \"...\",\n    \"video_script\": \"...\",\n    \"engagement_post\": \"...\"\n  },\n  \"image_prompt\": \"...\"\n}\n",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 3.1
    },
    {
      "id": "90dc476c-cf15-4b8f-b326-bc1c35763455",
      "name": "OpenAI GPT-4 Chat",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -16,
        624
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "c9669a57-d399-4c13-a233-5332f28a3359",
      "name": "Generate AI Image",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        496,
        896
      ],
      "parameters": {
        "prompt": "={{ $json.image_prompt }}\n\nTechnical requirements: photorealistic, ultra-detailed, 4K quality, professional photography style. Cinematic lighting with warm golden tones. No text, no watermarks, no logos. Aspect ratio 1:1. Style: Cinematic Archaeology meets Corporate Leadership \u2014 ancient wisdom meets modern business world.",
        "options": {
          "size": "1024x1024",
          "style": "vivid",
          "returnImageUrls": true
        },
        "resource": "image"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "e887aed4-6111-4460-b671-f336d48fa9cb",
      "name": "Send Photo to Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1072,
        896
      ],
      "parameters": {
        "file": "={{ $json.image_url }}",
        "chatId": "={{ $('When Telegram Message Received').item.json.message.chat.id }}",
        "operation": "sendPhoto",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c59bafd3-86e8-4232-b702-7bfdb8dce58d",
      "name": "Parse AI Response",
      "type": "n8n-nodes-base.code",
      "position": [
        272,
        496
      ],
      "parameters": {
        "jsCode": "const raw = $input.first().json.output;\n\n// Clean up in case the model wrapped output in markdown\nconst cleaned = raw\n  .replace(/^```json\\s*/i, '')\n  .replace(/^```\\s*/i, '')\n  .replace(/```\\s*$/i, '')\n  .trim();\n\nlet parsed;\ntry {\n  parsed = JSON.parse(cleaned);\n} catch (e) {\n  throw new Error('GPT returned invalid JSON: ' + e.message + '\\n\\nModel response:\\n' + raw.substring(0, 500));\n}\n\n// \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439\nconst required = ['en', 'pl', 'es', 'image_prompt'];\nfor (const field of required) {\n  if (!parsed[field]) {\n    throw new Error(`Missing field: ${field}`);\n  }\n}\n\nreturn [{\n  json: {\n    en_expert:     parsed.en.expert_post,\n    en_video:      parsed.en.video_script,\n    en_engagement: parsed.en.engagement_post,\n    pl_expert:     parsed.pl.expert_post,\n    pl_video:      parsed.pl.video_script,\n    pl_engagement: parsed.pl.engagement_post,\n    es_expert:     parsed.es.expert_post,\n    es_video:      parsed.es.video_script,\n    es_engagement: parsed.es.engagement_post,\n    image_prompt:  parsed.image_prompt,\n    chat_id:       $('When Telegram Message Received').first().json.message.chat.id\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "cc5fc39a-d338-416b-b03a-8ba1f7049021",
      "name": "Send Spanish Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        496,
        208
      ],
      "parameters": {
        "text": "=\ud83c\uddea\ud83c\uddf8 VERSI\u00d3N ESPA\u00d1OLA\n\n\ud83d\udcdd Expert Post:\n{{ $json.es_expert }}\n\n\ud83c\udfac Video Script:\n{{ $json.es_video }}\n\n\ud83d\udcac Engagement Post:\n{{ $json.es_engagement }}",
        "chatId": "=YOUR_TELEGRAM_CHAT_ID",
        "replyMarkup": "inlineKeyboard",
        "inlineKeyboard": {
          "rows": [
            {
              "row": {
                "buttons": [
                  {
                    "text": "Approve",
                    "additionalFields": {
                      "callback_data": "approve_esp"
                    }
                  },
                  {
                    "text": "Reject",
                    "additionalFields": {
                      "callback_data": "decline_esp"
                    }
                  }
                ]
              }
            }
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1c1ff6aa-9f9c-4e83-aaa0-ffc252195da6",
      "name": "Send Polish Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        496,
        400
      ],
      "parameters": {
        "text": "=\ud83c\uddf5\ud83c\uddf1 WERSJA POLSKA\n\n\ud83d\udcdd Expert Post:\n{{ $json.pl_expert }}\n\n\ud83c\udfac Video Script:\n{{ $json.pl_video }}\n\n\ud83d\udcac Engagement Post:\n{{ $json.pl_engagement }}",
        "chatId": "={{ $('When Telegram Message Received').item.json.message.chat.id }}",
        "replyMarkup": "inlineKeyboard",
        "inlineKeyboard": {
          "rows": [
            {
              "row": {
                "buttons": [
                  {
                    "text": "Approve",
                    "additionalFields": {
                      "callback_data": "approve_pol"
                    }
                  },
                  {
                    "text": "Reject",
                    "additionalFields": {
                      "callback_data": "decline_pol"
                    }
                  }
                ]
              }
            }
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "81347863-0bd2-43cd-9e9f-75cbe1cadcf7",
      "name": "Send English Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        496,
        592
      ],
      "parameters": {
        "text": "=\ud83c\uddec\ud83c\udde7 ENGLISH VERSION\n\n\ud83d\udcdd Expert Post:\n{{ $json.en_expert }}\n\n\ud83c\udfac Video Script:\n{{ $json.en_video }}\n\n\ud83d\udcac Engagement Post:\n{{ $json.en_engagement }}",
        "chatId": "={{ $('When Telegram Message Received').item.json.message.chat.id }}",
        "replyMarkup": "inlineKeyboard",
        "inlineKeyboard": {
          "rows": [
            {
              "row": {
                "buttons": [
                  {
                    "text": "Approve",
                    "additionalFields": {
                      "callback_data": "approve_eng"
                    }
                  },
                  {
                    "text": "Reject",
                    "additionalFields": {
                      "callback_data": "decline_eng"
                    }
                  }
                ]
              }
            }
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d35467fd-a13b-4459-8771-c0ae4776454e",
      "name": "Check Telegram Sender",
      "type": "n8n-nodes-base.if",
      "position": [
        -304,
        656
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "09d03e8c-8225-4470-81a1-1c89248ef3f2",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.message.from.id.toString() }}",
              "rightValue": "YOUR_TELEGRAM_CHAT_ID"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "a284824e-3919-4d56-bb05-45a3066170af",
      "name": "Send Text to Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -16,
        976
      ],
      "parameters": {
        "text": "\u26d4 Sorry, this bot only works for its owner.",
        "chatId": "={{ $json.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0ead7903-c743-4b9b-97e1-46fc983795da",
      "name": "Extract Image URL",
      "type": "n8n-nodes-base.code",
      "position": [
        704,
        896
      ],
      "parameters": {
        "jsCode": "const imageUrl = $input.first().json.url;\nconst chatId = $('When Telegram Message Received').first().json.message.chat.id;\n\n// Save URL to Static Data\nconst staticData = $getWorkflowStaticData('global');\nstaticData[`image_url_${chatId}`] = imageUrl;\n\nreturn [{\n  json: {\n    image_url: imageUrl,\n    chat_id: chatId,\n    saved: true\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "8c707224-122e-46ed-8fa2-cf711cfeabf3",
      "name": "Append Image URL to Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        880,
        896
      ],
      "parameters": {
        "columns": {
          "value": {
            "chat_id": "={{ $('When Telegram Message Received').first().json.message.chat.id }}",
            "text_en": "={{ $('Parse AI Response').item.json.en_expert }}",
            "text_es": "={{ $('Parse AI Response').item.json.es_expert }}",
            "text_pl": "={{ $('Parse AI Response').item.json.pl_expert }}",
            "image_url": "={{ $('Generate AI Image').first().json.url }}",
            "timestamp": "={{ $now.toISO() }}"
          },
          "schema": [
            {
              "id": "chat_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "chat_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "image_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "image_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "text_en",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "text_en",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "text_pl",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "text_pl",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "text_es",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "text_es",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1y3oEjUD6p5Xy8gr5r58RgDIkUj3P5xeH97tkKuIS1qY/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "1y3oEjUD6p5Xy8gr5r58RgDIkUj3P5xeH97tkKuIS1qY"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    }
  ],
  "active": true,
  "settings": {
    "binaryMode": "separate",
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "quii71J7zWCv1V1c",
    "timeSavedMode": "fixed",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "761abc66-353c-4995-9de9-29c9478fcd9a",
  "connections": {
    "Extract Image URL": {
      "main": [
        [
          {
            "node": "Append Image URL to Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate AI Image": {
      "main": [
        [
          {
            "node": "Extract Image URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI GPT-4 Chat": {
      "ai_languageModel": [
        [
          {
            "node": "Content Definition Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Response": {
      "main": [
        [
          {
            "node": "Generate AI Image",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send English Message",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Polish Message",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Spanish Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Telegram Sender": {
      "main": [
        [
          {
            "node": "Content Definition Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Text to Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Photo to Telegram": {
      "main": [
        []
      ]
    },
    "Content Definition Agent": {
      "main": [
        [
          {
            "node": "Parse AI Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append Image URL to Sheets": {
      "main": [
        [
          {
            "node": "Send Photo to Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Telegram Message Received": {
      "main": [
        [
          {
            "node": "Check Telegram Sender",
            "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

Triggers when a message is received on Telegram. Checks conditions and either sends a default message or processes the message for content generation. Uses an AI agent to generate rich content including images and text. Formats and sends generated text in multiple languages…

Source: https://n8n.io/workflows/15360/ — 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

BoomerBobBot.TP. Uses agent, telegramTrigger, telegram, memoryBufferWindow. Event-driven trigger; 95 nodes.

Agent, Telegram Trigger, Telegram +10
AI & RAG

Generate AI viral videos with NanoBanana & VEO3, shared on socials via Blotato 2. Uses @blotato/n8n-nodes-blotato, googleSheets, lmChatOpenAi, toolThink. Event-driven trigger; 94 nodes.

@Blotato/N8N Nodes Blotato, Google Sheets, OpenAI Chat +9
AI & RAG

This template is designed for marketers, content creators, and e-commerce brands who want to automate the creation of professional ad videos at scale. It’s ideal for teams looking to generate consiste

Telegram, Telegram Trigger, Google Drive +8
AI & RAG

N8N-Workflow. Uses telegramTrigger, telegram, googleSheets, openAi. Event-driven trigger; 63 nodes.

Telegram Trigger, Telegram, Google Sheets +3
AI & RAG

This automation is designed to help you generate AI-powered music tracks, cover art, and fully rendered music videos — all triggered from a simple Telegram chat and managed via Google Sheets.

OpenAI Chat, Memory Buffer Window, Output Parser Structured +11