ChatGPTSalesRevenue growthAI score · 74/100AI-assisted edit · no obvious prompt-injection riskn8n.io

Auto-Generate Professional LinkedIn Posts with AI Image from Telegram Messages

Send a text or voice message on Telegram → n8n calls OpenAI to format content and generate an image → publish to LinkedIn

Some experienceStepsWorkflowPromptTip
Who
Busy professionals, creators, and marketers who want to publish polished LinkedIn posts without opening the LinkedIn app
You get
Send one Telegram message and automatically get a formatted LinkedIn post with an AI-generated image, published directly
You need
n8n · telegram

Constraints

Requires an n8n instance (Cloud or self-hosted), a Telegram Bot Token, an OpenAI API Key, and LinkedIn OAuth credentials. Self-hosted users must create a LinkedIn app at developer.linkedin.com to obtain a Client ID and Client Secret. n8n Cloud users can authorize LinkedIn directly in the UI. Voice messages should be clear for accurate transcription.

What they did

Author barb published this workflow in the n8n official template library, demonstrating how to receive text or voice messages via a Telegram bot, automatically format them into LinkedIn-style long-form posts using OpenAI models, generate a matching image, and publish directly to LinkedIn. The template includes complete node configurations: Telegram Trigger, Switch routing, voice transcription, text extraction, OpenAI content formatting and image-prompt generation, gpt-image-1 image creation, and LinkedIn publishing.

How it went

The author reports that this workflow turns Telegram messages into formatted LinkedIn posts with auto-generated images, useful for quick content creation during commutes or between meetings. The voice path depends on OpenAI transcription accuracy; the text path processes directly. Post length is optimized between 1,242–2,500 characters. (author_report)

Worth knowing

The Image Prompt node prompt is truncated in the source workflow.json at '[style], \n'; the full ending is not provided and may need to be completed in practice. The person='z1_S-ihZxl' value in the 'Create a post' node is a template placeholder and must be replaced with the publisher's own LinkedIn person URN or publishing will fail. LinkedIn OAuth setup differs between n8n Cloud (direct UI authorization) and self-hosted (must create an app at developer.linkedin.com for Client ID/Secret). OpenAI calls are billed per use (transcription, formatting, prompt generation, image creation) and should be monitored. The LinkedIn API has posting frequency limits; avoid bulk posting in short periods.

n8n workflow template

Structure checked · Not run-tested

Use “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.

Setup and test checklist

Credentials to connect

  • Telegram Trigger node: connect Telegram API credentials.
  • Download File node: connect Telegram API credentials.
  • Create a post node: connect linkedInOAuth2Api credentials.
  • Transcribe Audio node: connect OpenAI API credentials.
  • Create Image node: connect OpenAI API credentials.
  • LinkedIn Post Text node: connect OpenAI API credentials.
  • Image Prompt node: connect OpenAI API credentials.

Configuration to replace

  • Source template is n8n public workflow #10129 (~13 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
  • Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.

Test input and expected output

  • Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
  • Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.

Template changes

  • Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
  • No business-logic edits; verify keys, quotas and privacy compliance before use.

Template retrieved: 2026-10-24

Steps

  1. Prepare credentials and accounts

    Create a Telegram bot via @BotFather and copy the Bot Token. In n8n Settings > Credentials, add: Telegram API (for the trigger and file download), OpenAI API Key (for audio transcription, post formatting, image prompt generation, and image creation), and LinkedIn OAuth (for publishing). Self-hosted users must also create a LinkedIn app at developer.linkedin.com to get the OAuth Client ID and Client Secret.

  2. Configure the Telegram trigger

    Add a 'Telegram Trigger' node, set updates to 'message', and connect your Telegram API credentials. After saving, n8n will generate a webhook URL. Ensure this URL is reachable by Telegram servers (handled automatically on n8n Cloud; self-hosted requires public internet access).

  3. Set up the Switch routing

    Add a 'Switch' node with two rules: first, route to the 'Voice' branch when `{{ $json.message.voice.file_id }}` exists; second, route to the 'Text' branch when `{{ $json.message.text }}` exists. Use the 'exists' operator with caseSensitive=true for both rules.

  4. Handle the voice message path

    On the 'Voice' branch: first add a 'Download File' node, set resource to 'file', set fileId to `{{ $json.message.voice.file_id }}`, and use the same Telegram credentials. Then add a 'Transcribe Audio' node, set resource to 'audio' and operation to 'transcribe', connect your OpenAI credentials, and pass the resulting text to the next step for formatting.

  5. Handle the text message path

    On the 'Text' branch: add a 'Set Text' node, create a field named 'text' with the value `{{ $json.message.text }}`, and pass it directly to the formatting step.

  6. Generate the LinkedIn post text

    Add a 'LinkedIn Post Text' node, choose model gpt-4.1-mini (or gpt-4.1 / gpt-4), and place the following prompt in the messages field. This node receives `{{ $json.text }}` from the previous step and outputs a formatted LinkedIn post in plain text.

    Execution prompt · Source text。LinkedIn Post Text node messages[0].content field

    =You are a LinkedIn post formatter. You receive the user's Telegram message: {{ $json.text }}  and transform it into a polished LinkedIn post.
    
    STRUCTURE:
    - Hook: Punchy opening line (max 9 words) on its own line.
    - Body: 14-18 short paragraphs (2-3 lines each).
    - Length: 1,242-2,500 characters total.
    - End: Specific question or call-to-action.
    
    FORMATTING:
    - Plain text only. No markdown or special symbols.
    - Use \n for single line breaks.
    - Use \n\n between paragraphs.
    - Add maximum 2 emojis total in the entire post.
    - Use periods at the end of every sentence.
    - Keep sentences 10-19 words.
    - No em dashes or hyphens for breaks.
    
    TONE:
    - Write at grade 5-7 reading level (simple, clear words).
    - Conversational and authentic. Sound like a real person.
    - Use only the information provided in the user's Telegram message.
    - No added humor or jokes.
    - Avoid corporate buzzwords and fluffy language.
    - Be direct and actionable.
    
    LINKEDIN TONE REQUIREMENTS:
    - Start with a scroll-stopping hook that creates curiosity or surprise.
    - Write like you're talking to a colleague, not teaching a class.
    - Use "I" statements and personal experiences when possible.
    - Vary sentence length - mix short punchy lines with longer explanations.
    - Show personality - opinions, observations, or lessons learned.
    - Avoid generic statements like "Many believe" or "Some say."
    - Make it conversational - how would you explain this over coffee?
    
    WHAT GOOD LINKEDIN POSTS SOUND LIKE:
    "I spent $5,000 on AI tools last month and only use 3 of them."
    "Everyone talks about AI search but nobody mentions this one thing."
    "My client asked if AI will replace SEO and I said no here's why."
    
    AVOID:
    - Hashtags.
    - Generic motivational statements.
    - Walls of text without breaks.
    - External URLs.
    - AI-sounding phrases.
    - More than 2 emojis.
    - Em dashes or hyphens as separators.
    - Adding information not in the user's input.
    
    OUTPUT:
    Return only the formatted LinkedIn post as plain text. No JSON. No extra commentary.
  7. Generate the image prompt

    Add an 'Image Prompt' node, choose model gpt-4.1-mini, and place the following prompt in the messages field. This node receives `{{ $json.message.content }}` from the previous post text and outputs a detailed English prompt for AI image generation.

    Execution prompt · Source text。Image Prompt node messages[0].content field; note: this prompt is truncated at '[style], \n' in the source workflow.json

    =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.
    
    YOUR TASK:
    Analyze the LinkedIn post: {{ $json.message.content }} and generate a single, detailed image prompt that visually represents the main concept.
    
    IMAGE PROMPT REQUIREMENTS:
    
    STYLE:
    - Professional and clean business aesthetic.
    - Suitable for LinkedIn professional audience.
    - Modern, minimalist design with clear focal point.
    - Avoid cluttered or overly complex compositions.
    
    CONTENT:
    - Focus on the main topic or concept from the post.
    - Use metaphors or visual representations, not literal text.
    - Include relevant business or tech elements when appropriate.
    - Avoid faces, specific people, or identifiable individuals.
    - No text overlays or words in the image.
    
    TECHNICAL SPECS:
    - Describe lighting, colors, and mood clearly.
    - Specify composition (centered, rule of thirds, etc.).
    - Mention perspective (front view, top down, close-up, etc.).
    - Keep aspect ratio suitable for LinkedIn (square or landscape).
    
    PROMPT STRUCTURE:
    Write prompts in this format:
    "[Main subject], [setting/background], [style],
  8. Generate the AI image

    Add a 'Create Image' node, set resource to 'image', model to 'gpt-image-1', set prompt to `{{ $json.message.content }}` (the output from the Image Prompt node), and connect your OpenAI credentials. This node generates an AI image matching the post topic.

  9. Publish to LinkedIn

    Add a 'Create a post' node, set type to LinkedIn, set text to `={{ $('LinkedIn Post Text').item.json.message.content }}`, set shareMediaCategory to IMAGE, and replace the person field with your own LinkedIn person URN (the template contains a placeholder value z1_S-ihZxl). Double-click the node to complete LinkedIn OAuth authentication and connect your linkedInOAuth2Api credentials. Save and activate the workflow.

Prompt you can copy

Setup guidance · Editorial suggestion。Setup assistant: confirm inputs and permissions before guiding reproduction

This block is the prompt. Ads are never placed here.

You are an n8n workflow setup assistant. The user wants to recreate the 'Auto-generate LinkedIn posts with AI image from Telegram messages' template. First confirm the user has: an n8n instance (Cloud or self-hosted), a Telegram Bot Token, an OpenAI API Key, and LinkedIn OAuth credentials (self-hosted users also need a LinkedIn app at developer.linkedin.com). Then guide them through importing the template or building nodes manually, with special attention to the Switch routing rules, the LinkedIn Post Text and Image Prompt prompt configurations, and ensuring the person URN in the 'Create a post' node is replaced with a real value.

To change writing style, edit the prompt in the 'LinkedIn Post Text' node. To adjust image style, modify the model/size in the 'Create Image' node or the prompt in the 'Image Prompt' node.

Source

Create professional LinkedIn posts from Telegram messages using OpenAI text & image · barb · n8n.io · 2025-10-24

Comments & feedback

Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.

Loading…

    Related