AutomationFlowsSocial Media › Route Telegram Channel Posts to X, Threads, and Linkedin Using @mentions

Route Telegram Channel Posts to X, Threads, and Linkedin Using @mentions

By🦄 kai chen @c-wenlong on n8n.io

This workflow listens to messages in a designated Telegram channel and automatically posts them to X (Twitter), Threads, and LinkedIn based on simple @mention tags. Write your content once, tag which platforms you want, and let automation handle the rest.

Event trigger★★★★☆ complexity21 nodesTwitterLinkedInTelegramTelegram TriggerHTTP Request
Social Media Trigger: Event Nodes: 21 Complexity: ★★★★☆ Added:

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

This workflow follows the HTTP Request → LinkedIn 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": "ERJRm8yTfk0hcpAQBF0dm",
  "name": "Send a Telegram message to three social media channels (X, Threads, LinkedIn)",
  "tags": [],
  "nodes": [
    {
      "id": "b097f1fd-9c00-4381-9393-847f22a13200",
      "name": "Create Tweet",
      "type": "n8n-nodes-base.twitter",
      "position": [
        992,
        656
      ],
      "parameters": {
        "text": "={{ $json.parsedMessage }}",
        "additionalFields": {}
      },
      "typeVersion": 2
    },
    {
      "id": "a7b433d3-9c39-4b13-8efd-b7696bd888c5",
      "name": "Create a post",
      "type": "n8n-nodes-base.linkedIn",
      "position": [
        992,
        848
      ],
      "parameters": {
        "text": "={{ $json.parsedMessage }}",
        "person": "zOhu_5WAJN",
        "additionalFields": {}
      },
      "typeVersion": 1
    },
    {
      "id": "7b1717b3-00be-48c4-a970-38a3e1699bdd",
      "name": "Parse Telegram Message",
      "type": "n8n-nodes-base.code",
      "position": [
        544,
        560
      ],
      "parameters": {
        "jsCode": "function parseTelegramMessage(input) {\n  // Channel mapping to binary flags\n  const channelFlags = {\n    'x': 1,\n    'threads': 2,\n    'linkedin': 4,\n    'all': 7\n  };\n  \n  let flag = 0;\n  let cleanedMessage = input;\n  \n  // Extract all @mentions\n  const mentionRegex = /@(\\w+)/g;\n  const mentions = [...input.matchAll(mentionRegex)];\n  \n  // Process each mention\n  for (const match of mentions) {\n    const channel = match[1].toLowerCase();\n    \n    if (channelFlags.hasOwnProperty(channel)) {\n      flag |= channelFlags[channel]; // Bitwise OR to combine flags\n      // Remove the @mention from message\n      cleanedMessage = cleanedMessage.replace(match[0], '');\n    } else {\n      // Invalid channel detected - return error flag\n      return [-1, `Invalid channel: @${channel}`];\n    }\n  }\n  \n  // Remove all hashtags\n  cleanedMessage = cleanedMessage.replace(/#\\w+/g, '');\n  \n  // Clean up extra whitespace\n  cleanedMessage = cleanedMessage.trim().replace(/\\s+/g, ' ');\n  \n  return [flag, cleanedMessage];\n}\n\nconst message = $input.first().json.channel_post.text\n\nconst [flag, parsedMessage] = parseTelegramMessage(message)\n\nreturn [{\"flag\": flag, \"parsedMessage\": parsedMessage}];"
      },
      "typeVersion": 2
    },
    {
      "id": "b2a98159-897e-470a-8210-3f4ad50c7b19",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        768,
        512
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "233cd758-9d67-4cbc-a163-6b1252659cad",
                    "operator": {
                      "type": "number",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.flag }}",
                    "rightValue": -1
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "1c398e42-3b98-4c53-8fcb-b8be29ef7f89",
                    "operator": {
                      "type": "number",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.flag }}",
                    "rightValue": 1
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "45853afc-c090-4d28-bcbd-c8c57fbd2ab2",
                    "operator": {
                      "type": "number",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.flag }}",
                    "rightValue": 2
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "0a09d088-7c48-4a3b-954b-eb9537395ca7",
                    "operator": {
                      "type": "number",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.flag }}",
                    "rightValue": 4
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "04ac88ac-c2aa-4d83-a07e-7366dd87c31b",
                    "operator": {
                      "type": "number",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.flag }}",
                    "rightValue": 7
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "850b7bc1-4c61-4eb3-bd7b-b0a16ef527af",
                    "operator": {
                      "type": "number",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.flag}}",
                    "rightValue": 3
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "50e9685c-eb81-4c75-8648-2f9035eb184f",
      "name": "Send Error Notification",
      "type": "n8n-nodes-base.telegram",
      "position": [
        992,
        464
      ],
      "parameters": {
        "text": "=Post on SM channels failed with error[{{ $('Parse Telegram Message').item.json.flag }}]:{{ $('Parse Telegram Message').item.json.parsedMessage }}",
        "chatId": "YOUR_NOTIFICATION_CHAT_ID",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b45974ec-a615-4756-ac70-edf640ff9d79",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        320,
        560
      ],
      "parameters": {
        "updates": [
          "channel_post"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b79bfc60-b00c-4e11-bbe3-bbc27c12314b",
      "name": "X Success Notification",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1216,
        656
      ],
      "parameters": {
        "text": "=\u2705 X | {{$json.id.substring(0,4) }} | {{ $json.text.substring(0,10) }}",
        "chatId": "YOUR_NOTIFICATION_CHAT_ID",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "18b98a23-c652-481a-8bf4-90d1bef874dd",
      "name": "LinkedIn Success Notification",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1216,
        848
      ],
      "parameters": {
        "text": "=\u2705 LinkedIn | {{ $json.urn.substring(13, 17) }}",
        "chatId": "YOUR_NOTIFICATION_CHAT_ID",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5e8bf4c8-41fc-4832-9121-c409ffb6e8a4",
      "name": "Threads Success Notification",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1664,
        272
      ],
      "parameters": {
        "text": "=\u2705 Threads | {{$json.id.substring(0,4) }} | {{ $('Switch').item.json.parsedMessage.substring(0,10) }}",
        "chatId": "YOUR_NOTIFICATION_CHAT_ID",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9693e043-2e43-443e-bc6a-51eee9e847e0",
      "name": "When clicking 'Execute workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        320,
        48
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "6fd5014d-7359-427a-b78f-d8c6e8dbfce4",
      "name": "Threads Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        544,
        48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0aa4e96e-13b7-4bcb-a42c-5e1cfd26cc26",
              "name": "access_token",
              "type": "string",
              "value": "YOUR_THREADS_ACCESS_TOKEN"
            },
            {
              "id": "a39cd4ce-d600-445b-8549-cedea7bf9787",
              "name": "client_secret",
              "type": "string",
              "value": "YOUR_THREADS_CLIENT_SECRET"
            },
            {
              "id": "8a6ea578-734a-4a5e-9a06-bcffe797ed88",
              "name": "account_id",
              "type": "string",
              "value": "YOUR_THREADS_ACCOUNT_ID"
            },
            {
              "id": "86b7fa76-1f21-487d-908b-4180de8f5f07",
              "name": "threads_id",
              "type": "string",
              "value": "YOUR_THREADS_USER_ID"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "dfff7d63-ede6-47ee-8e0d-07424136d7eb",
      "name": "Threads Fields Copy",
      "type": "n8n-nodes-base.set",
      "position": [
        992,
        272
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0aa4e96e-13b7-4bcb-a42c-5e1cfd26cc26",
              "name": "access_token",
              "type": "string",
              "value": "YOUR_THREADS_ACCESS_TOKEN"
            },
            {
              "id": "a39cd4ce-d600-445b-8549-cedea7bf9787",
              "name": "client_secret",
              "type": "string",
              "value": "YOUR_THREADS_CLIENT_SECRET"
            },
            {
              "id": "8a6ea578-734a-4a5e-9a06-bcffe797ed88",
              "name": "account_id",
              "type": "string",
              "value": "YOUR_THREADS_ACCOUNT_ID"
            },
            {
              "id": "86b7fa76-1f21-487d-908b-4180de8f5f07",
              "name": "threads_id",
              "type": "string",
              "value": "YOUR_THREADS_USER_ID"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "1bc8844c-9cda-4a50-9e97-d20aa502bc58",
      "name": "Create Thread",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1216,
        272
      ],
      "parameters": {
        "url": "=https://graph.threads.net/v1.0/YOUR_THREADS_USER_ID/threads",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "text",
              "value": "={{ $('Parse Telegram Message').item.json.parsedMessage }}"
            },
            {
              "name": "media_type",
              "value": "TEXT"
            }
          ]
        },
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "87d3e18d-4078-4a34-bee7-c6d482f6f6e2",
      "name": "Publish Thread",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1440,
        272
      ],
      "parameters": {
        "url": "https://graph.threads.net/v1.0/YOUR_THREADS_USER_ID/threads_publish",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "creation_id",
              "value": "={{ $json.id }}"
            }
          ]
        },
        "genericAuthType": "httpBearerAuth"
      },
      "typeVersion": 4.3
    },
    {
      "id": "4bbddb71-9a20-4873-b16d-42f9addf60d9",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        -96
      ],
      "parameters": {
        "width": 800,
        "height": 304,
        "content": "## Get Access Token\n**Double click** for guide to get access token. [Guide](https://www.youtube.com/watch?v=nC1-KZabm6U)\n\nThis gets your the access token that lasts for 2 months so you can publish threads."
      },
      "typeVersion": 1
    },
    {
      "id": "58a96e44-915a-4e3c-b6b3-bd4cc04c3703",
      "name": "Get Threads Long-Lived Token",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        768,
        48
      ],
      "parameters": {
        "url": "=https://graph.threads.net/access_token?grant_type=th_exchange_token&client_secret={{ $json.client_secret }}&access_token={{ $json.access_token }}",
        "options": {}
      },
      "typeVersion": 4.3
    },
    {
      "id": "d9a5dfcc-233c-4927-8322-4f2be2410640",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        -272
      ],
      "parameters": {
        "width": 736,
        "height": 480,
        "content": "## How it works\n\nThis workflow automates cross-posting from Telegram to multiple social media platforms. When you send a message in your Telegram channel with specific tags (@x, @threads, @linkedin, or @all), the workflow automatically posts your content to the selected platforms.\n\nThe workflow parses your Telegram message to identify which platforms to post to using bitwise flags, removes the tags and hashtags from the final post, then distributes your content accordingly.\n\n## Setup steps\n\n1. **Telegram Bot**: Create a bot via @BotFather and add it as admin to your channel\n2. **X (Twitter)**: Set up OAuth2 credentials in n8n\n3. **LinkedIn**: Configure OAuth2 API credentials\n4. **Threads**: Obtain your access token, client secret, account ID, and user ID (see linked guide)\n5. **Update credentials**: Replace all placeholder credential IDs and the notification chat ID\n6. **Test**: Send a test message with @all to verify all platforms work\n\nUse @x, @threads, @linkedin for individual platforms, or @all to post everywhere at once."
      },
      "typeVersion": 1
    },
    {
      "id": "4d59c067-b936-4df4-99bb-4f14d2907d88",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        720
      ],
      "parameters": {
        "content": "Trigger & Parsing\n\nReceives messages from Telegram channel and parses @mentions to determine target platforms using binary flags."
      },
      "typeVersion": 1
    },
    {
      "id": "7ec7e93e-5571-4246-9c26-d2fd920e363f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        928,
        1008
      ],
      "parameters": {
        "content": "Social Media Posting\n\nPosts cleaned message content to selected platforms (X, LinkedIn, Threads) based on parsed flags."
      },
      "typeVersion": 1
    },
    {
      "id": "4e180c33-2f28-4864-9e34-c864b4f06446",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1184,
        1008
      ],
      "parameters": {
        "content": "Notifications\n\nSends confirmation messages back to Telegram with post status and IDs."
      },
      "typeVersion": 1
    },
    {
      "id": "bdf5cf17-77d0-479e-84e6-49455b805ebc",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        736,
        240
      ],
      "parameters": {
        "content": "  Threads Token Setup\n   \n   One-time setup: Run manually to refresh your Threads long-lived access token (valid for 60 days)."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "a361d3c9-59c9-4fba-96f9-68b668a785e6",
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "Send Error Notification",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Tweet",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Threads Fields Copy",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create a post",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Tweet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Create a post",
            "type": "main",
            "index": 0
          },
          {
            "node": "Threads Fields Copy",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Tweet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Threads Fields Copy",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Tweet": {
      "main": [
        [
          {
            "node": "X Success Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Thread": {
      "main": [
        [
          {
            "node": "Publish Thread",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a post": {
      "main": [
        [
          {
            "node": "LinkedIn Success Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Publish Thread": {
      "main": [
        [
          {
            "node": "Threads Success Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Threads Fields": {
      "main": [
        [
          {
            "node": "Get Threads Long-Lived Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Parse Telegram Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Threads Fields Copy": {
      "main": [
        [
          {
            "node": "Create Thread",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Telegram Message": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking 'Execute workflow'": {
      "main": [
        [
          {
            "node": "Threads Fields",
            "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 to messages in a designated Telegram channel and automatically posts them to X (Twitter), Threads, and LinkedIn based on simple @mention tags. Write your content once, tag which platforms you want, and let automation handle the rest.

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

More Social Media workflows → · Browse all categories →

Related workflows

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

Social Media

This n8n workflow automatically shares content from a Telegram Channel to multiple platforms like WordPress, Facebook, X/Twitter, and LinkedIn. It uses a Switch node to detect the type of content—text

Telegram Trigger, Telegram, WordPress +5
Social Media

✨🤖Automated AI Powered Social Media Content Factory for X + Facebook + Instagram + LinkedIn. Uses outputParserStructured, lmChatGoogleGemini, lmChatOpenAi, httpRequest. Event-driven trigger; 57 nodes

Output Parser Structured, Google Gemini Chat, OpenAI Chat +11
Social Media

Social Media Managers and Digital Marketers seeking to streamline content production across 7+ platforms (X/Twitter, Instagram, LinkedIn, Facebook, TikTok, Threads, YouTube Shorts) using AI-powered au

Output Parser Structured, Google Gemini Chat, OpenAI Chat +11
Social Media

This workflow is designed for content creators, social media managers, digital marketers, and business owners who want to automate their content creation and distribution process across multiple platf

Google Drive, Google Drive Trigger, WordPress +13
Social Media

Overview This workflow automates the process of converting RSS feed articles into ready-to-publish social media posts using OpenAI, NocoDB, and Telegram. It's ideal for content teams, marketing manage

OpenAI, LinkedIn, Twitter +5