{
  "id": "qW5bvcRfvp2rs9rW",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Create LinkedIn Post from Telegram Voice or Text Message",
  "tags": [],
  "nodes": [
    {
      "id": "7bc24f88-7f6f-4c3a-9796-b4527d9b77a3",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -320,
        144
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "d9b88c01-a62a-4333-bfa4-ecdc1d4d952f",
      "name": "Set 'Text'",
      "type": "n8n-nodes-base.set",
      "position": [
        64,
        160
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "fe7ecc99-e1e8-4a5e-bdd6-6fce9757b234",
              "name": "text",
              "type": "string",
              "value": "={{ $json.message.text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "04432fe7-ebcb-47f2-98d0-accd0d27347a",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -144,
        144
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Voice",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.message.voice.file_id }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Text",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "8c844924-b2ed-48b0-935c-c66a8fd0c778",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "2f14333e-4cc2-4f08-a98e-983d2df18b64",
      "name": "Download File",
      "type": "n8n-nodes-base.telegram",
      "position": [
        0,
        0
      ],
      "parameters": {
        "fileId": "={{ $json.message.voice.file_id }}",
        "resource": "file",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "664ccb22-aa5c-418d-8b2c-8a71d278b7da",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -992,
        -240
      ],
      "parameters": {
        "color": 3,
        "width": 576,
        "height": 1040,
        "content": "## For more tutorials visit our [Youtube](https://www.youtube.com/@AIBIZElevate77)\n\n\n---\n### 1. Setup\n\n1. Create a Telegram bot (via @BotFather)\n   \u2022 Copy your Bot Token into the Telegram nodes.\n   \n2. Add credentials in n8n:\n   \u2022 Telegram (Telegram Trigger, Download File)\n   \u2022 OpenAI (API key, for Transcribe Audio, LinkedIn Post Text, Image Prompt and Create Image)\n   \u2022 LinkedIn (OAuth - Create a post)\n   \u2022 For self-hosted n8n: Create LinkedIn app at developer.linkedin.com to obtain OAuth credentials (Client ID and Client Secret)\n3. Activate the workflow\n   \u2022 Send your text or voice message via Telegram bot.\n   \u2022 OpenAI modules will create optimized LinkedIn Post including an image and post it on LinkedIn.\n\n\n---\n### 2. How to customize this workflow to your needs\n\n1. Modify node logic:\n   \u2022 Change LinkedIn Post Text prompt to match your writing style\n   \u2022 Adjust image generation settings (size, style, model) in Create Image node\n   \n2. Add integrations:\n   \u2022 Connect Google Sheets, Airtable, or Notion for post approval workflow\n   \u2022 Add scheduling nodes for delayed publishing\n   \u2022 Track analytics by saving post data to database\n   \n3. Multi-platform posting:\n   \u2022 Repost on Twitter, Facebook, Instagram\n \n\n---\n### 3. Node Breakdown & Flow\n\n1. Telegram Trigger: Listens for all messages.\n2. Switch: Routes messages (voice, text) to the right logic.\n3. Voice: Download File \u2192 Transcribe Audio \u2192 LinkedIn Post Text\n4. Text:  \u2192  LinkedIn Post Text directly\n5. LinkedIn Post Text: Formats content into professional post with proper structure\n6. Image Prompt: Generates detailed image description based on post content\n7. Create Image: Produces AI visual matching post topic\n8. Create a post: Posts text and image on LinkedIn platform\n\n\n---\n## Need Help or Want to Customize?\nFor further automation or integration, feel free to [book an appointment](https://aibizelevate.com/) or [LinkedIn](https://www.linkedin.com/in/barbora-svobodova-461b92285/)\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "355fe701-cb6b-48e9-a732-5c369c0d85f1",
      "name": "Create a post",
      "type": "n8n-nodes-base.linkedIn",
      "position": [
        1024,
        64
      ],
      "parameters": {
        "text": "={{ $('LinkedIn Post Text').item.json.message.content }}",
        "person": "z1_S-ihZxl",
        "additionalFields": {},
        "shareMediaCategory": "IMAGE"
      },
      "credentials": {
        "linkedInOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f4d59ae7-33e3-4ffa-8575-b8dfc24bb527",
      "name": "Transcribe Audio",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        144,
        0
      ],
      "parameters": {
        "options": {},
        "resource": "audio",
        "operation": "transcribe"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.6
    },
    {
      "id": "31ab2958-64ed-4bc6-ab4f-a6b858c474f7",
      "name": "Create Image",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        848,
        64
      ],
      "parameters": {
        "model": "gpt-image-1",
        "prompt": "={{ $json.message.content }}",
        "options": {},
        "resource": "image"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "0dcd7167-f0df-43c7-9b5c-d21b454bafe4",
      "name": "LinkedIn Post Text",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        320,
        64
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are a LinkedIn post formatter. You receive the user's Telegram message: {{ $json.text }}  and transform it into a polished LinkedIn post.\n\nSTRUCTURE:\n- Hook: Punchy opening line (max 9 words) on its own line.\n- Body: 14-18 short paragraphs (2-3 lines each).\n- Length: 1,242-2,500 characters total.\n- End: Specific question or call-to-action.\n\nFORMATTING:\n- Plain text only. No markdown or special symbols.\n- Use \\n for single line breaks.\n- Use \\n\\n between paragraphs.\n- Add maximum 2 emojis total in the entire post.\n- Use periods at the end of every sentence.\n- Keep sentences 10-19 words.\n- No em dashes or hyphens for breaks.\n\nTONE:\n- Write at grade 5-7 reading level (simple, clear words).\n- Conversational and authentic. Sound like a real person.\n- Use only the information provided in the user's Telegram message.\n- No added humor or jokes.\n- Avoid corporate buzzwords and fluffy language.\n- Be direct and actionable.\n\nLINKEDIN TONE REQUIREMENTS:\n- Start with a scroll-stopping hook that creates curiosity or surprise.\n- Write like you're talking to a colleague, not teaching a class.\n- Use \"I\" statements and personal experiences when possible.\n- Vary sentence length - mix short punchy lines with longer explanations.\n- Show personality - opinions, observations, or lessons learned.\n- Avoid generic statements like \"Many believe\" or \"Some say.\"\n- Make it conversational - how would you explain this over coffee?\n\nWHAT GOOD LINKEDIN POSTS SOUND LIKE:\n\"I spent $5,000 on AI tools last month and only use 3 of them.\"\n\"Everyone talks about AI search but nobody mentions this one thing.\"\n\"My client asked if AI will replace SEO and I said no here's why.\"\n\nAVOID:\n- Hashtags.\n- Generic motivational statements.\n- Walls of text without breaks.\n- External URLs.\n- AI-sounding phrases.\n- More than 2 emojis.\n- Em dashes or hyphens as separators.\n- Adding information not in the user's input.\n\nOUTPUT:\nReturn only the formatted LinkedIn post as plain text. No JSON. No extra commentary.\n"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "26533f4b-4642-487c-b25f-5f8c3f2e42a2",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        -160
      ],
      "parameters": {
        "width": 408,
        "height": 524,
        "content": "## 3. Post on LinkedIn\n\n\u2022 Double-click \"Create a post\" node for OAuth authentication\n\u2022 Self-hosted users: Create LinkedIn app at developer.linkedin.com to get Client ID/Secret\n\u2022 Once connected, posts automatically publish with text and AI image\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "3cd3bf29-a49f-475c-873f-79b34effc17b",
      "name": "Image Prompt",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        576,
        64
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are an AI image prompt generator for LinkedIn posts. You receive a LinkedIn post text and create a professional image prompt for AI image generation.\n\nYOUR TASK:\nAnalyze the LinkedIn post: {{ $json.message.content }} and generate a single, detailed image prompt that visually represents the main concept.\n\nIMAGE PROMPT REQUIREMENTS:\n\nSTYLE:\n- Professional and clean business aesthetic.\n- Suitable for LinkedIn professional audience.\n- Modern, minimalist design with clear focal point.\n- Avoid cluttered or overly complex compositions.\n\nCONTENT:\n- Focus on the main topic or concept from the post.\n- Use metaphors or visual representations, not literal text.\n- Include relevant business or tech elements when appropriate.\n- Avoid faces, specific people, or identifiable individuals.\n- No text overlays or words in the image.\n\nTECHNICAL SPECS:\n- Describe lighting, colors, and mood clearly.\n- Specify composition (centered, rule of thirds, etc.).\n- Mention perspective (front view, top down, close-up, etc.).\n- Keep aspect ratio suitable for LinkedIn (square or landscape).\n\nPROMPT STRUCTURE:\nWrite prompts in this format:\n\"[Main subject], [setting/background], [style], \n"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "4ae6f22e-c570-4741-af85-005a33a03902",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        -160
      ],
      "parameters": {
        "width": 656,
        "height": 528,
        "content": "## 1. Message Input\n\n- Telegram Trigger receives voice or text messages from your bot. Switch node routes each type to the correct path.\n- Download File retrieves audio from Telegram. Transcribe Audio (OpenAI) converts speech to text for processing."
      },
      "typeVersion": 1
    },
    {
      "id": "7d7a4e2b-f83e-44e1-ae92-7b82c484174e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        -160
      ],
      "parameters": {
        "width": 656,
        "height": 528,
        "content": "## 2. AI Content Generation \n\n- LinkedIn Post Text (OpenAI) takes your raw input and transforms it into a professional LinkedIn post.\n- Image Prompt node analyzes your post content and creates a detailed visual description. \n- Create Image node generates an AI image that complements your post topic."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "2209425a-d7a2-4326-8604-0d3b8c8c9def",
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "Download File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set 'Text'",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set 'Text'": {
      "main": [
        [
          {
            "node": "LinkedIn Post Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Image": {
      "main": [
        [
          {
            "node": "Create a post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Image Prompt": {
      "main": [
        [
          {
            "node": "Create Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a post": {
      "main": [
        []
      ]
    },
    "Download File": {
      "main": [
        [
          {
            "node": "Transcribe Audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe Audio": {
      "main": [
        [
          {
            "node": "LinkedIn Post Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LinkedIn Post Text": {
      "main": [
        [
          {
            "node": "Image Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}