AutomationFlowsSlack & Telegram › Generate AI Selfie Photos From Telegram with Atlascloud and Blotato

Generate AI Selfie Photos From Telegram with Atlascloud and Blotato

ByDr. Firas @drfiras on n8n.io

This workflow listens for a two-photo Telegram album, uploads both images to Blotato for public hosting, sends them with a caption prompt to AtlasCloud (Nano Banana 2 Lite) to generate an edited “AI selfie,” then posts the result to Instagram and Facebook and replies with the…

Event trigger★★★★☆ complexity22 nodesTelegram TriggerTelegram@Blotato/N8N Nodes BlotatoHTTP Request
Slack & Telegram Trigger: Event Nodes: 22 Complexity: ★★★★☆ Added:

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

This workflow follows the Blotaton8N Nodes Blotato → HTTP Request 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": "xH0A34XedqxJz8sA",
  "meta": {
    "builderVariant": "mcp",
    "aiBuilderAssisted": true
  },
  "name": "Generate AI selfie photos with a public figure from Telegram using Nano Banana 2 Lite",
  "tags": [],
  "nodes": [
    {
      "id": "dfcf14b5-1106-41b0-9e9c-f90995ed0662",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        16,
        192
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "f44024fc-60ba-4cf0-a879-62667e92274c",
      "name": "Collect album photos",
      "type": "n8n-nodes-base.code",
      "position": [
        224,
        192
      ],
      "parameters": {
        "jsCode": "const staticData = $getWorkflowStaticData('global');\nconst message = $json.message || {};\nconst groupId = message.media_group_id ? String(message.media_group_id) : ('single_' + message.message_id);\nconst key = 'album_' + groupId;\nconst buffer = staticData[key] || { file_ids: [], description: '', chat_id: null };\nif (Array.isArray(message.photo) && message.photo.length > 0) {\n  const largest = message.photo[message.photo.length - 1];\n  if (largest && largest.file_id && !buffer.file_ids.includes(largest.file_id)) buffer.file_ids.push(largest.file_id);\n}\nif (message.caption) buffer.description = message.caption;\nif (message.chat && message.chat.id) buffer.chat_id = message.chat.id;\nstaticData[key] = buffer;\nif (buffer.file_ids.length >= 2) {\n  delete staticData[key];\n  return [{ json: { chat_id: buffer.chat_id, description: buffer.description, file_id_1: buffer.file_ids[0], file_id_2: buffer.file_ids[1] } }];\n}\nreturn [];"
      },
      "typeVersion": 2
    },
    {
      "id": "42c9ecf7-ba2d-4611-b42e-7cb2d2e8ffd5",
      "name": "Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        496,
        192
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cfg-1",
              "name": "atlas_model",
              "type": "string",
              "value": "google/nano-banana-2-lite/edit"
            },
            {
              "id": "cfg-2",
              "name": "aspect_ratio",
              "type": "string",
              "value": "9:16"
            },
            {
              "id": "cfg-3",
              "name": "output_format",
              "type": "string",
              "value": "png"
            },
            {
              "id": "cfg-4",
              "name": "poll_wait_seconds",
              "type": "number",
              "value": 10
            },
            {
              "id": "cfg-5",
              "name": "edit_prompt",
              "type": "string",
              "value": "={{ $json.description }}"
            },
            {
              "id": "cfg-6",
              "name": "chat_id",
              "type": "string",
              "value": "={{ $json.chat_id }}"
            },
            {
              "id": "cfg-7",
              "name": "file_id_1",
              "type": "string",
              "value": "={{ $json.file_id_1 }}"
            },
            {
              "id": "cfg-8",
              "name": "file_id_2",
              "type": "string",
              "value": "={{ $json.file_id_2 }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f3e70a00-caa3-466c-be23-a87e83e393d8",
      "name": "Get file 1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        752,
        192
      ],
      "parameters": {
        "fileId": "={{ $('Configuration').item.json.file_id_1 }}",
        "resource": "file",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b541f1f7-387b-4074-8abc-1d129f1e8315",
      "name": "Upload image 1",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        912,
        192
      ],
      "parameters": {
        "resource": "media",
        "useBinaryData": true
      },
      "credentials": {
        "blotatoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "de980950-c288-4498-a3e3-52f8975ea725",
      "name": "Get file 2",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1072,
        192
      ],
      "parameters": {
        "fileId": "={{ $('Configuration').item.json.file_id_2 }}",
        "resource": "file",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9b3c9b1e-da4e-4f6e-bccd-7f49a5c96b1f",
      "name": "Upload image 2",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        1248,
        192
      ],
      "parameters": {
        "resource": "media",
        "useBinaryData": true
      },
      "credentials": {
        "blotatoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "f4ded7fd-e6ad-4e2c-bedd-2a869fa6df15",
      "name": "Generate image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1664,
        192
      ],
      "parameters": {
        "url": "https://api.atlascloud.ai/api/v1/model/generateImage",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"{{ $('Configuration').item.json.atlas_model }}\",\n  \"images\": [\n    \"{{ $('Upload image 1').item.json.url }}\",\n    \"{{ $('Upload image 2').item.json.url }}\"\n  ],\n  \"prompt\": {{ JSON.stringify($('Configuration').item.json.edit_prompt) }},\n  \"aspect_ratio\": \"{{ $('Configuration').item.json.aspect_ratio }}\",\n  \"output_format\": \"{{ $('Configuration').item.json.output_format }}\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "de7fc072-b4ba-4f4c-bb9c-9ce095ada3ea",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        1840,
        192
      ],
      "parameters": {
        "amount": "={{ $('Configuration').item.json.poll_wait_seconds }}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "080b6d3c-2b80-496c-940b-5e7e4627cc57",
      "name": "Get status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2000,
        192
      ],
      "parameters": {
        "url": "=https://api.atlascloud.ai/api/v1/model/prediction/{{ $('Generate image').item.json.data.id }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "bd509dd2-ae8a-419f-9d97-b8d43993d489",
      "name": "Completed?",
      "type": "n8n-nodes-base.if",
      "position": [
        2192,
        192
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "c-completed",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data.status }}",
              "rightValue": "completed"
            },
            {
              "id": "c-succeeded",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data.status }}",
              "rightValue": "succeeded"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "cd25764c-922d-4e9f-a895-29c2abb15825",
      "name": "Get image URL",
      "type": "n8n-nodes-base.set",
      "position": [
        2592,
        176
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "img-1",
              "name": "image_url",
              "type": "string",
              "value": "={{ $json.data.outputs[0] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "fd6240ce-3dd5-46c6-bad4-498502c6ee5f",
      "name": "Publish to Instagram",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        2832,
        16
      ],
      "parameters": {
        "options": {},
        "accountId": {
          "__rl": true,
          "mode": "list",
          "value": "11892",
          "cachedResultUrl": "https://backend.blotato.com/v2/accounts/11892",
          "cachedResultName": "doc.firass"
        },
        "postContentText": "={{ $('Configuration').item.json.edit_prompt }}",
        "postContentMediaUrls": "={{ $('Get image URL').item.json.image_url }}"
      },
      "credentials": {
        "blotatoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "27a85062-37c3-46e1-8b8a-a627f46b0f0e",
      "name": "Publish to Facebook",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        2816,
        224
      ],
      "parameters": {
        "options": {},
        "platform": "facebook",
        "accountId": {
          "__rl": true,
          "mode": "list",
          "value": "1759",
          "cachedResultUrl": "https://backend.blotato.com/v2/accounts/1759",
          "cachedResultName": "Firass Ben"
        },
        "facebookPageId": {
          "__rl": true,
          "mode": "list",
          "value": "101603614680195",
          "cachedResultUrl": "https://backend.blotato.com/v2/accounts/1759/subaccounts/101603614680195",
          "cachedResultName": "Dr. Firas"
        },
        "postContentText": "={{ $('Configuration').item.json.edit_prompt }}",
        "postContentMediaUrls": "={{ $('Get image URL').item.json.image_url }}"
      },
      "credentials": {
        "blotatoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "b57c7325-a1a1-400d-84e2-29760810ca14",
      "name": "Notify on Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2992,
        112
      ],
      "parameters": {
        "file": "={{ $('Get image URL').item.json.image_url }}",
        "chatId": "={{ $('Configuration').item.json.chat_id }}",
        "operation": "sendPhoto",
        "additionalFields": {
          "caption": "Here is your AI selfie. It is being published to Instagram and Facebook. Review before it goes live."
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0179a829-8914-4314-accd-63904e35cc5a",
      "name": "Sticky Note Main",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        -800
      ],
      "parameters": {
        "width": 1320,
        "height": 600,
        "content": "# Generate AI selfie photos with a public figure from Telegram using Nano Banana 2 Lite\n\n# \ud83d\udce5 [Open full documentation on Notion](https://automatisation.notion.site/Generate-AI-selfie-photos-with-a-public-figure-from-Telegram-Nano-Banana-2-Lite-3963d6550fd9816a822ac698aa31a6c6)\n\n## How it works\nSend two photos to a Telegram bot (your own selfie and a public figure) as a single album, and write the composition instruction as the album caption. The workflow merges them into one realistic selfie-style image and publishes it.\n\n1. Telegram Trigger receives the album. A Code node buffers the two photos (they arrive as two updates) and reads the caption as the prompt.\n2. Configuration centralises every adjustable setting (model, aspect ratio, output format, wait time) plus the runtime values (prompt, chat id, file ids).\n3. Each photo is fetched from Telegram and re-hosted as a stable public URL via [Blotato](https://blotato.com/?ref=firas) media upload.\n4. The two URLs and the prompt are sent to [AtlasCloud](https://www.atlascloud.ai/?ref=8QKPJE) using the Nano Banana 2 Lite edit model. Generation is async, so the workflow waits and polls until the image is ready.\n5. The final image is published to Instagram and Facebook, and sent back to you on Telegram for review.\n\n## Setup\n1. Select your Telegram credential on the trigger and the 3 Telegram nodes.\n2. On the 2 AtlasCloud HTTP nodes, select the AtlasCloud API credential (Header Auth: Authorization = Bearer YOUR_KEY). Must be selected manually on each node.\n3. On the Blotato nodes, select your Blotato account credential and pick the Instagram account and Facebook Page.\n4. Activate the workflow, then send an album of 2 photos plus a caption to your bot.\n\n## Requirements\n- A Telegram bot token.\n- An [AtlasCloud](https://www.atlascloud.ai/?ref=8QKPJE) account and API key.\n- A [Blotato](https://blotato.com/?ref=firas) account with Instagram and Facebook connected. Blotato is a community node: n8n self-hosted, or n8n Cloud with Verified Community Nodes enabled.\n\n## Customization\n- Change aspect_ratio (1:1, 9:16, 16:9) and output_format (png, jpeg) in Configuration.\n- Swap atlas_model for a higher Nano Banana tier without touching the rest.\n- Add or remove platforms by duplicating a Blotato node.\n- Prefer a fixed selfie? Put your own image URL in Configuration and send only the public figure photo (more reliable, no album buffering)."
      },
      "typeVersion": 1
    },
    {
      "id": "556e6402-09c9-474b-91c1-960667cae7fa",
      "name": "Sticky Note Input",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 436,
        "height": 476,
        "content": "## 1. Telegram input\nSend the 2 photos as ONE album (your selfie plus the public figure) and write the composition instruction as the album caption. The Code node waits until both photos arrive, then continues once."
      },
      "typeVersion": 1
    },
    {
      "id": "39c042a1-7fa1-407f-8481-d53d963d9c95",
      "name": "Sticky Note Config",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 208,
        "height": 476,
        "content": "## 2. Configuration\nSet your adjustable variables here: model, aspect ratio, output format, wait time. The prompt and photos come from Telegram. Every node reads from here."
      },
      "typeVersion": 1
    },
    {
      "id": "93dae2a5-dacf-469f-b15e-07b893e8da07",
      "name": "Sticky Note Host",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 888,
        "height": 476,
        "content": "## 3. Fetch the photos and host them\nDownload each photo from Telegram, then re-host it as a stable public URL with [Blotato](https://blotato.com/?ref=firas) media upload so AtlasCloud can read it."
      },
      "typeVersion": 1
    },
    {
      "id": "58f6f6e3-bb1f-490e-939e-2edcfa32307b",
      "name": "Sticky Note Generate",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1632,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 888,
        "height": 476,
        "content": "## 4. Generate the selfie (Nano Banana 2 Lite)\nSend the two URLs plus the prompt to [AtlasCloud](https://www.atlascloud.ai/?ref=8QKPJE), then poll the prediction until the status is completed. Select the AtlasCloud API credential on both HTTP nodes."
      },
      "typeVersion": 1
    },
    {
      "id": "3f25c114-d14a-488f-8b00-abe907df634e",
      "name": "Sticky Note Publish",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2576,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 660,
        "height": 476,
        "content": "## 5. Publish and notify\nPublish the final image to Instagram and Facebook via [Blotato](https://blotato.com/?ref=firas), and send it back to you on Telegram for review."
      },
      "typeVersion": 1
    },
    {
      "id": "dc53ee0e-4345-4caf-9455-ef1305589821",
      "name": "Sticky Note Warning",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        416
      ],
      "parameters": {
        "color": 5,
        "width": 888,
        "height": 214,
        "content": "## Before you run\n- AtlasCloud HTTP nodes use a generic Header Auth credential: select AtlasCloud API manually on each one. Never hardcode the key.\n- The album buffer relies on Telegram sending both photos together; keep the workflow active for it to work reliably. If it misfires, use the fixed-selfie variant.\n- Blotato is a community node (self-hosted or n8n Cloud Verified Community Nodes)."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": true,
    "executionOrder": "v1"
  },
  "versionId": "b2812c63-7237-4952-972c-fd6b88c0881d",
  "nodeGroups": [],
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Get status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Completed?": {
      "main": [
        [
          {
            "node": "Get image URL",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get file 1": {
      "main": [
        [
          {
            "node": "Upload image 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get file 2": {
      "main": [
        [
          {
            "node": "Upload image 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get status": {
      "main": [
        [
          {
            "node": "Completed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Configuration": {
      "main": [
        [
          {
            "node": "Get file 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get image URL": {
      "main": [
        [
          {
            "node": "Publish to Instagram",
            "type": "main",
            "index": 0
          },
          {
            "node": "Publish to Facebook",
            "type": "main",
            "index": 0
          },
          {
            "node": "Notify on Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate image": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload image 1": {
      "main": [
        [
          {
            "node": "Get file 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload image 2": {
      "main": [
        [
          {
            "node": "Generate image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Collect album photos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Collect album photos": {
      "main": [
        [
          {
            "node": "Configuration",
            "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 workflow listens for a two-photo Telegram album, uploads both images to Blotato for public hosting, sends them with a caption prompt to AtlasCloud (Nano Banana 2 Lite) to generate an edited “AI selfie,” then posts the result to Instagram and Facebook and replies with the…

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

More Slack & Telegram workflows → · Browse all categories →

Related workflows

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

Slack & Telegram

📄 Documentation: Notion Guide

Telegram Trigger, @Blotato/N8N Nodes Blotato, Telegram +1
Slack & Telegram

AI Social Media Automation for Multiple Platforms using Blotato. Uses telegramTrigger, @blotato/n8n-nodes-blotato, telegram, httpRequest. Event-driven trigger; 52 nodes.

Telegram Trigger, @Blotato/N8N Nodes Blotato, Telegram +1
Slack & Telegram

N8N Complete Final. Uses telegramTrigger, dataTable, telegram, mqtt. Event-driven trigger; 58 nodes.

Telegram Trigger, Data Table, Telegram +3
Slack & Telegram

Pede Ai. Uses httpRequest, telegram, postgres, telegramTrigger. Event-driven trigger; 57 nodes.

HTTP Request, Telegram, Postgres +1
Slack & Telegram

TextMain. Uses telegramTrigger, stopAndError, telegram, httpRequest. Event-driven trigger; 56 nodes.

Telegram Trigger, Stop And Error, Telegram +2