{
  "id": "zXGAC0vEp4uMWJQe",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Create & Share AI Fotos with Telegram, Gemini & Post to TikTok, Instagram, Facebook",
  "tags": [
    {
      "id": "vxCnofILVxT6ePXY",
      "name": "instagram",
      "createdAt": "2025-11-13T18:01:47.968Z",
      "updatedAt": "2025-11-13T18:01:47.968Z"
    }
  ],
  "nodes": [
    {
      "id": "2e933da9-aaeb-4ddc-b6f0-314214317df7",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -5104,
        1616
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "You are a video prompt assistant for Telegram.\n\nYour task:\n\n1. Analyze the user's message and create a video prompt.\n\n2. Create relevant social media text with hashtags.\n\n3. Present both to the user and ask for feedback.\n\n4. If the user requests changes: Refine based on the feedback and present again.\n\n5. If the user says \"approved\" or \"ok\": Output the final version in JSON format.\n\nJSON format (only for approval):\n\n{\n\n\"videoPrompt\": \"The final video prompt\",\n\n\"socialMediaText\": \"The social media text with hashtags\"\n\n}\n\nImportant: Only output the JSON if the user says \"approved\". Otherwise, provide a regular text response with a suggestion."
        },
        "promptType": "define"
      },
      "typeVersion": 3
    },
    {
      "id": "7d75ca43-7772-4113-81e3-84d02f25c85f",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -5096,
        1840
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "07f7f1b1-58ea-44e9-9b8c-3a6899cf9e96",
      "name": "Listen for incoming events",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -6224,
        1616
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b8a79511-2241-4813-9ab6-bd516ec75fea",
      "name": "Speech to Text",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -5328,
        1544
      ],
      "parameters": {
        "options": {},
        "resource": "audio",
        "operation": "transcribe"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "aa86f76e-1f3b-4f2c-9738-90f2678abff5",
      "name": "Voice or Text",
      "type": "n8n-nodes-base.set",
      "position": [
        -6000,
        1616
      ],
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "text",
              "stringValue": "={{ $json?.message?.text || \"\" }}"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "4fd453e3-9ae5-4570-90fb-9e687bd9b6cc",
      "name": "Get Voice File",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -5552,
        1544
      ],
      "parameters": {
        "fileId": "={{ $('Listen for incoming events').item.json.message.voice.file_id }}",
        "resource": "file",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "8ef16cbc-a946-4267-bcb2-4cb03955f02d",
      "name": "Parse AI Output",
      "type": "n8n-nodes-base.code",
      "position": [
        -4528,
        1304
      ],
      "parameters": {
        "jsCode": "// Get the output from AI Agent\nconst aiOutput = $input.item.json.output;\n\nif (!aiOutput) {\n  throw new Error('No output found from AI Agent');\n}\n\n// Try to extract JSON from the text\n// The JSON might be wrapped in markdown code blocks or mixed with other text\nlet jsonString = aiOutput;\n\n// Remove markdown code blocks if present\njsonString = jsonString.replace(/```json\\s*/g, '').replace(/```\\s*/g, '');\n\n// Try to find JSON object in the text\nconst jsonMatch = jsonString.match(/\\{[\\s\\S]*\\}/);\nif (jsonMatch) {\n  jsonString = jsonMatch[0];\n}\n\ntry {\n  // Parse the JSON\n  const parsed = JSON.parse(jsonString);\n  \n  // Validate that we have the required fields\n  if (!parsed.videoPrompt || !parsed.socialMediaText) {\n    throw new Error('Missing required fields: videoPrompt or socialMediaText');\n  }\n  \n  // Return the parsed data\n  return {\n    videoPrompt: parsed.videoPrompt,\n    socialMediaText: parsed.socialMediaText\n  };\n  \n} catch (error) {\n  // If parsing fails, try to extract the fields manually\n  const videoPromptMatch = aiOutput.match(/videoPrompt[\"']?\\s*:\\s*[\"']([^\"']+)[\"']/i);\n  const socialMediaTextMatch = aiOutput.match(/socialMediaText[\"']?\\s*:\\s*[\"']([^\"']+)[\"']/i);\n  \n  if (videoPromptMatch && socialMediaTextMatch) {\n    return {\n      videoPrompt: videoPromptMatch[1],\n      socialMediaText: socialMediaTextMatch[1]\n    };\n  }\n  \n  throw new Error(`Failed to parse AI output: ${error.message}. Output was: ${aiOutput}`);\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "1d30da0c-c11f-4c69-952e-c3b2a8f36cb3",
      "name": "Window Buffer Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -4968,
        1840
      ],
      "parameters": {
        "sessionKey": "={{ $('Listen for incoming events').first().json.message.from.id }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 10
      },
      "typeVersion": 1.3
    },
    {
      "id": "b4b7d576-e36e-4b9b-b809-b75f69676378",
      "name": "Upload media1",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        -2960,
        1304
      ],
      "parameters": {
        "resource": "media",
        "useBinaryData": true,
        "binaryPropertyName": "={{ $('Generate an image').item.binary.data }}"
      },
      "credentials": {
        "blotatoApi": {
          "name": "<your credential>"
        }
      },
      "executeOnce": false,
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 2
    },
    {
      "id": "4f4de877-ae4f-40fd-86ed-70b5b0b54a78",
      "name": "Get post1",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        -2288,
        1760
      ],
      "parameters": {
        "operation": "get",
        "postSubmissionId": "={{ $json.postSubmissionId }}"
      },
      "credentials": {
        "blotatoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "1621d441-479b-48fe-b028-96dd4bc4b532",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        -2512,
        1208
      ],
      "parameters": {
        "amount": 30
      },
      "typeVersion": 1.1
    },
    {
      "id": "2b5a4c3f-386c-497a-acab-d87b83d3de8e",
      "name": "Wait1",
      "type": "n8n-nodes-base.wait",
      "position": [
        -2512,
        1760
      ],
      "parameters": {
        "amount": 10
      },
      "typeVersion": 1.1
    },
    {
      "id": "06800398-9f97-4443-83f2-d07c75076ec7",
      "name": "In Progress?",
      "type": "n8n-nodes-base.if",
      "position": [
        -1840,
        1304
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e6c403be-3a03-4365-ac18-69d9ffc1770b",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "in-progress"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "89151a21-5bca-414b-842a-c62c72c5b52a",
      "name": "Give Blotat other 5s :)",
      "type": "n8n-nodes-base.wait",
      "position": [
        -1616,
        1472
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "46f14a49-461a-4813-8a8b-7bc4cd3821ea",
      "name": "In Progress?1",
      "type": "n8n-nodes-base.if",
      "position": [
        -1840,
        1856
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e6c403be-3a03-4365-ac18-69d9ffc1770b",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "in-progress"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "5312ee21-26bc-4af0-bbf7-824bac9bc012",
      "name": "A Voice?",
      "type": "n8n-nodes-base.if",
      "position": [
        -5776,
        1616
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a0bf9719-4272-46f6-ab3b-eda6f7b44fd8",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.message.text }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "7e88f1d7-a27a-466b-b442-d141c85ad4de",
      "name": "Send questions or proposal to user",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -4528,
        1712
      ],
      "parameters": {
        "text": "={{ $('AI Agent').item.json.output }}",
        "chatId": "={{ $('Listen for incoming events').first().json.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "13b3efe8-954c-4f3d-a5d3-d185a79888ec",
      "name": "Approved from user?",
      "type": "n8n-nodes-base.if",
      "position": [
        -4752,
        1616
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "id-1",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.output }}",
              "rightValue": "videoPrompt"
            },
            {
              "id": "id-2",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.output }}",
              "rightValue": "socialMediaText"
            },
            {
              "id": "id-3",
              "operator": {
                "type": "string",
                "operation": "startsWith"
              },
              "leftValue": "={{ $json.output }}",
              "rightValue": "{"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "197cb765-0cad-415c-a657-44f3edbdb1bc",
      "name": "Inform user about processing",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -4304,
        1304
      ],
      "parameters": {
        "text": "Okay. Your video is being prepared now. I'll let you know as soon as it's online.",
        "chatId": "={{ $('Listen for incoming events').item.json.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4c8d4dc7-9280-49fc-8edd-29afda445976",
      "name": "Save Prompt & Post-Text",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -4080,
        1304
      ],
      "parameters": {
        "columns": {
          "value": {
            "text": "={{ $('Parse AI Output').item.json.socialMediaText }}",
            "prompt": "={{ $('Parse AI Output').item.json.videoPrompt }}"
          },
          "schema": [
            {
              "id": "prompt",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "prompt",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "text",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "text",
              "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/1Ex39e1qxhx17NizISKRxrjlGH8VpBbcZ5G_Lis8Xqjw/edit#gid=0",
          "cachedResultName": "Tabellenblatt1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1aCak__0_cl4t0KmDB_cRkfLU9lMVKbFmlZDqa27oWf4",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1aCak__0_cl4t0KmDB_cRkfLU9lMVKbFmlZDqa27oWf4/edit?usp=drivesdk",
          "cachedResultName": "evely_instagram_fotos_prompts"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "00b5b8f0-2a5c-4a9a-8d98-f71c4acf4c3d",
      "name": "Check Post Status",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        -2288,
        1208
      ],
      "parameters": {
        "operation": "get",
        "postSubmissionId": "={{ $json.postSubmissionId }}"
      },
      "credentials": {
        "blotatoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "1e0c394c-9321-4bf5-b7d6-73dfca816650",
      "name": "Give Blotat more time",
      "type": "n8n-nodes-base.wait",
      "position": [
        -1616,
        2024
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "180e9c56-a3c5-4e8b-9fd9-f5b3d7b6f721",
      "name": "Published to Instagram?",
      "type": "n8n-nodes-base.if",
      "position": [
        -2064,
        1760
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "1bc619f0-b64a-4487-bbc7-21be7c30f1f1",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "=published"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "390cb840-69a3-49b8-82f6-8ee64af14c47",
      "name": "Confirm publishing to Instagram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1840,
        1664
      ],
      "parameters": {
        "text": "=Dein Video ist jetzt online auf Instagram.\nHier geht es zum Post:\n{{ $json.publicUrl }}",
        "chatId": "={{ $('Listen for incoming events').item.json.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "864c5c75-62dc-4c0b-9d3c-52fd50c7d0ad",
      "name": "Send Instagram Error Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1616,
        1784
      ],
      "parameters": {
        "text": "Error while uploading your video to Instagram",
        "chatId": "={{ $('Listen for incoming events').item.json.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "6bc48b4b-83c4-4fc6-b945-f4634ffadfc2",
      "name": "Create x post",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        -2736,
        1208
      ],
      "parameters": {
        "options": {},
        "platform": "twitter",
        "accountId": {
          "__rl": true,
          "mode": "list",
          "value": "9613",
          "cachedResultUrl": "https://backend.blotato.com/v2/accounts/9613",
          "cachedResultName": "EvelynX273809"
        },
        "postContentText": "={{ $('Parse AI Output').item.json.socialMediaText }}",
        "postContentMediaUrls": "={{ $json.url }}"
      },
      "credentials": {
        "blotatoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2,
      "alwaysOutputData": false
    },
    {
      "id": "128dbe37-fca1-41fa-a69e-806c85020070",
      "name": "Generate an image",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        -3856,
        1304
      ],
      "parameters": {
        "prompt": "={{ $('Parse AI Output').item.json.videoPrompt }}",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-flash-image",
          "cachedResultName": "models/gemini-2.5-flash-image (Nano Banana)"
        },
        "options": {},
        "resource": "image"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "3b76b116-f887-407a-af20-b27753d6e2f7",
      "name": "Send a photo message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -3632,
        1400
      ],
      "parameters": {
        "chatId": "={{ $('Listen for incoming events').item.json.message.chat.id }}",
        "operation": "sendPhoto",
        "binaryData": true,
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e04fc160-3405-4ec9-ac2b-eff669820fc4",
      "name": "Send message and wait for response",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -3408,
        1400
      ],
      "parameters": {
        "chatId": "={{ $('Listen for incoming events').item.json.message.chat.id }}",
        "message": "Good?",
        "options": {},
        "operation": "sendAndWait",
        "approvalOptions": {
          "values": {
            "approvalType": "double"
          }
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f4fbfe92-802e-4ffa-854b-6a7f2eac5685",
      "name": "Upload image1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -3632,
        1208
      ],
      "parameters": {
        "name": "=data",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {
          "simplifyOutput": true
        },
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1RA8NwbhB8Ts1A96FO5zCA4Ta_WJglJyI",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1RA8NwbhB8Ts1A96FO5zCA4Ta_WJglJyI",
          "cachedResultName": "Evelyn_X"
        },
        "inputDataFieldName": "=data"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3,
      "alwaysOutputData": true
    },
    {
      "id": "eecea1d6-4266-4c5f-822b-a9b850076d0a",
      "name": "Download image from Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -3408,
        1208
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Upload image1').item.json.id }}"
        },
        "options": {
          "binaryPropertyName": "data"
        },
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "14decf3c-cb8f-4303-9d4c-6a1c4b6b109d",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        -3184,
        1304
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "ac91afaa-393f-494c-93dc-91d9a9343bbf",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.approved }}",
              "rightValue": "true"
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": false
    },
    {
      "id": "8cab4cb9-8205-4eed-b1e9-a4fbbe2278b4",
      "name": "Wait2",
      "type": "n8n-nodes-base.wait",
      "position": [
        -2512,
        728
      ],
      "parameters": {
        "amount": 30
      },
      "typeVersion": 1.1
    },
    {
      "id": "a5af60d7-e79d-4145-80a8-f4cff82d84e2",
      "name": "In Progress?2",
      "type": "n8n-nodes-base.if",
      "position": [
        -1840,
        752
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e6c403be-3a03-4365-ac18-69d9ffc1770b",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "in-progress"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3ed917a5-3a22-47e0-9ced-db007b3dd789",
      "name": "Give Blotat other 5s :)1",
      "type": "n8n-nodes-base.wait",
      "position": [
        -1616,
        920
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "f719fa6f-0bae-4800-93e5-7f82367794c0",
      "name": "Check Post Status1",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        -2288,
        728
      ],
      "parameters": {
        "operation": "get",
        "postSubmissionId": "={{ $json.postSubmissionId }}"
      },
      "credentials": {
        "blotatoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "2d85b82f-efc9-442f-ac30-b6c421483b65",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -6304,
        1040
      ],
      "parameters": {
        "color": 7,
        "width": 1088,
        "height": 800,
        "content": "## 1. Capture Input\n\nReceives Telegram messages and converts voice notes to text using OpenAI Whisper"
      },
      "typeVersion": 1
    },
    {
      "id": "378d9f45-d952-4882-9f06-b59920b21b47",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -5200,
        1040
      ],
      "parameters": {
        "color": 7,
        "width": 368,
        "height": 800,
        "content": "## 2. AI Content Creation\n\nGenerates LinkedIn posts and handles revision requests through conversational memory"
      },
      "typeVersion": 1
    },
    {
      "id": "e30ad583-fee4-4217-a591-40e46c623626",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3952,
        1040
      ],
      "parameters": {
        "color": 7,
        "width": 1200,
        "height": 800,
        "content": "## 4. Photo Generation and upload to [Blotato] \n\nGenerate your Photo mit Gemini-API, approve it via Telegram, save it to your google drive and uploadd it to [Blotato]) "
      },
      "typeVersion": 1
    },
    {
      "id": "fc202f08-da7f-43d3-a67b-db76725523e7",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2672,
        416
      ],
      "parameters": {
        "color": 7,
        "width": 1536,
        "height": 592,
        "content": "## 5. Post the Photo on Facebook and monitor the status"
      },
      "typeVersion": 1
    },
    {
      "id": "e2d66e61-41d3-4cf7-be06-89ae995798b1",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4816,
        1040
      ],
      "parameters": {
        "color": 7,
        "width": 848,
        "height": 800,
        "content": "## 3. Approval & Publishing\n\nDetects approval keywords, extracts final content, save the output in your google sheet and inform the user"
      },
      "typeVersion": 1
    },
    {
      "id": "8a727e77-a9bf-4045-9f9b-5b511b1a01c2",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2672,
        1024
      ],
      "parameters": {
        "color": 7,
        "width": 1536,
        "height": 592,
        "content": "## 6. Post the Photo on X and monitor the status"
      },
      "typeVersion": 1
    },
    {
      "id": "e940d29a-fbe8-46f2-83d7-ebd14fccd731",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2672,
        1648
      ],
      "parameters": {
        "color": 7,
        "width": 1536,
        "height": 592,
        "content": "## 7. Post the Photo  on Instagram and monitor the status"
      },
      "typeVersion": 1
    },
    {
      "id": "de2c8b4d-d71b-47d4-aeb4-be13a7cdd317",
      "name": "Create instagram Post",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        -2736,
        1760
      ],
      "parameters": {
        "options": {},
        "accountId": {
          "__rl": true,
          "mode": "list",
          "value": "21546",
          "cachedResultUrl": "https://backend.blotato.com/v2/accounts/21546",
          "cachedResultName": "evely_nxn8n"
        },
        "postContentText": "={{ $('Parse AI Output').item.json.socialMediaText }}",
        "postContentMediaUrls": "={{ $json.url }}"
      },
      "credentials": {
        "blotatoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2,
      "alwaysOutputData": false
    },
    {
      "id": "0377330a-e387-4f54-ac91-a2e621d5b0de",
      "name": "Create FB post",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        -2736,
        728
      ],
      "parameters": {
        "options": {},
        "platform": "facebook",
        "accountId": {
          "__rl": true,
          "mode": "list",
          "value": "13854",
          "cachedResultUrl": "https://backend.blotato.com/v2/accounts/13854",
          "cachedResultName": "Feras Dabour"
        },
        "facebookPageId": {
          "__rl": true,
          "mode": "list",
          "value": "799072823298702",
          "cachedResultUrl": "https://backend.blotato.com/v2/accounts/13854/subaccounts/799072823298702",
          "cachedResultName": "Evelynx"
        },
        "postContentText": "={{ $('Parse AI Output').item.json.socialMediaText }}",
        "postContentMediaUrls": "={{ $json.url }}"
      },
      "credentials": {
        "blotatoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2,
      "alwaysOutputData": false
    },
    {
      "id": "f93d3cb2-65a2-4acf-970d-3a79780afb4c",
      "name": "Published to Facebook ?",
      "type": "n8n-nodes-base.if",
      "position": [
        -2064,
        728
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "1bc619f0-b64a-4487-bbc7-21be7c30f1f1",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "published"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "a17802ab-6c59-4b0c-8b7b-7df6e804a8d4",
      "name": "Send Facebook Error Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1616,
        704
      ],
      "parameters": {
        "text": "Error while uploading your video to FB",
        "chatId": "={{ $('Listen for incoming events').item.json.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "67a14576-86fb-4d55-b9f5-a402dda55748",
      "name": "Confirm publishing to Facebook",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1840,
        560
      ],
      "parameters": {
        "text": "=Your image  is now online on Facebook.\n\nHere's the link to the post:\n{{ $json.publicUrl }}",
        "chatId": "={{ $('Listen for incoming events').item.json.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "eb80d878-5e98-4cf7-92d7-e2864a48d71f",
      "name": "Published to X?",
      "type": "n8n-nodes-base.if",
      "position": [
        -2064,
        1208
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "1bc619f0-b64a-4487-bbc7-21be7c30f1f1",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "published"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "63e3c224-becf-4ba0-a2cf-574b32720bfa",
      "name": "Confirm publishing to X",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1840,
        1112
      ],
      "parameters": {
        "text": "=Your video is now online on TikTok.\n\nHere's the link to the post:\n{{ $json.publicUrl }}",
        "chatId": "={{ $('Listen for incoming events').item.json.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "10f3db13-5e7a-44aa-9ade-aa7c3915d236",
      "name": "Send X Error Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1616,
        1232
      ],
      "parameters": {
        "text": "Error while uploading your video to Tiktok",
        "chatId": "={{ $('Listen for incoming events').item.json.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b31909eb-1813-4258-b51c-0e40afbac569",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -7168,
        976
      ],
      "parameters": {
        "width": 736,
        "height": 1040,
        "content": "## \ud83e\udd16 Social Media Photo Creation Bot with Approval Loop\n\nTransform your Telegram into a **AI Photo Creator**. Send ideas via text or voice, collaborate with AI to refine photos, and publish directly to Facebook, Instagram & X (Twitter) with a simple \"ok\".\n\n---\n\n### How the Workflow Works\n\nThe bot automates the entire process from idea to publication:\n\n* **1. Send your idea:** Message your Telegram bot with text or voice notes.\n* **2. AI drafts content:** **GPT** analyzes your input and creates a photo-prompt and social media text.\n* **3. Iterative refinement:** Request changes (e.g., tone, style, hashtags) until you are satisfied with the draft.\n* **4. Generate image:** **Gemini** creates an AI-generated image based on the approved prompt.\n* **5. Approve image:** Review the generated image in Telegram and approve it.\n* **6. Auto-publish:** The image is automatically posted to Facebook, Instagram, and X via **Blotato**.\n* **7. Get confirmation:** Receive direct links via Telegram once your posts are live on all platforms.\n\n---\n\n### \ud83d\udee0\ufe0f Setup Steps\n\nThe following credentials and configurations are required for the bot to function correctly:\n\n1.  **Telegram Bot:**\n    * Create a bot via `@BotFather`.\n    * Add the API token to your credentials.\n2.  **OpenAI API:**\n    * Add your **OpenAI key** for AI generation and voice transcription.\n3.  **Google Gemini API:**\n    * Add your **Google Gemini API key** for image generation.\n4.  **Google Drive & Sheets:**\n    * Connect your Google account for storing images and saving prompts.\n5.  **Blotato Account:**\n    * Connect your Facebook, Instagram, and X profiles at [Blotato].\n    * Add the corresponding API credentials.\n6.  **Customize the AI:**\n    * Edit the **System Prompt** in the \"AI Agent\" node to match your brand voice and content style.\n\n---"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b629edca-d5aa-4d6b-bd4b-80177d9d7766",
  "connections": {
    "If1": {
      "main": [
        [
          {
            "node": "Upload media1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Check Post Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Get post1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait2": {
      "main": [
        [
          {
            "node": "Check Post Status1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "A Voice?": {
      "main": [
        [
          {
            "node": "Get Voice File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Approved from user?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get post1": {
      "main": [
        [
          {
            "node": "Published to Instagram?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "In Progress?": {
      "main": [
        [
          {
            "node": "Give Blotat other 5s :)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send X Error Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create x post": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "In Progress?1": {
      "main": [
        [
          {
            "node": "Give Blotat more time",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Instagram Error Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "In Progress?2": {
      "main": [
        [
          {
            "node": "Give Blotat other 5s :)1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Facebook Error Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload image1": {
      "main": [
        [
          {
            "node": "Download image from Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload media1": {
      "main": [
        [
          {
            "node": "Create instagram Post",
            "type": "main",
            "index": 0
          },
          {
            "node": "Create x post",
            "type": "main",
            "index": 0
          },
          {
            "node": "Create FB post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Voice or Text": {
      "main": [
        [
          {
            "node": "A Voice?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create FB post": {
      "main": [
        [
          {
            "node": "Wait2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Voice File": {
      "main": [
        [
          {
            "node": "Speech to Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Speech to Text": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Output": {
      "main": [
        [
          {
            "node": "Inform user about processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Published to X?": {
      "main": [
        [
          {
            "node": "Confirm publishing to X",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "In Progress?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Post Status": {
      "main": [
        [
          {
            "node": "Published to X?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate an image": {
      "main": [
        [
          {
            "node": "Upload image1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send a photo message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Check Post Status1": {
      "main": [
        [
          {
            "node": "Published to Facebook ?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Approved from user?": {
      "main": [
        [
          {
            "node": "Parse AI Output",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send questions or proposal to user",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a photo message": {
      "main": [
        [
          {
            "node": "Send message and wait for response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Create instagram Post": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Give Blotat more time": {
      "main": [
        [
          {
            "node": "Published to Instagram?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Give Blotat other 5s :)": {
      "main": [
        [
          {
            "node": "Published to X?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Published to Facebook ?": {
      "main": [
        [
          {
            "node": "Confirm publishing to Facebook",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "In Progress?2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Published to Instagram?": {
      "main": [
        [
          {
            "node": "Confirm publishing to Instagram",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "In Progress?1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Prompt & Post-Text": {
      "main": [
        [
          {
            "node": "Generate an image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Give Blotat other 5s :)1": {
      "main": [
        [
          {
            "node": "Published to Facebook ?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download image from Drive": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Listen for incoming events": {
      "main": [
        [
          {
            "node": "Voice or Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Inform user about processing": {
      "main": [
        [
          {
            "node": "Save Prompt & Post-Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send message and wait for response": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}