8
n8n 中文网amn8n.com

AI社交媒体经理

高级

这是一个Social Media, AI Chatbot领域的自动化工作流,包含 36 个节点。主要使用 If, Set, Code, Switch, SplitOut 等节点。 通过 Telegram 机器人、Gemini AI 和向量记忆发布 LinkedIn 和 X 帖子

前置要求
  • Telegram Bot Token
  • 可能需要目标 API 的认证凭证
  • Twitter API 凭证
  • LinkedIn API 凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "12HhNt7pAzQTW1T8",
  "meta": {
    "instanceId": "338fb6f0d68503788052a77be505a179c4ae0ec212595f99c996d4f187d68f3e",
    "templateCredsSetupCompleted": true
  },
  "name": "AI社交媒体经理",
  "tags": [],
  "nodes": [
    {
      "id": "92461be1-8166-4e3c-b40a-beb2ceb4924a",
      "name": "Telegram触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -112,
        32
      ],
      "webhookId": "dc36f389-99ef-43f0-8395-5ffa731b31e3",
      "parameters": {
        "updates": [
          "message",
          "callback_query",
          "inline_query",
          "*"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "yaqH1QTZ8lML5pqB",
          "name": "Gate bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "bbe5809f-e74f-4c15-8628-92a35d9bb189",
      "name": "设置输入上下文",
      "type": "n8n-nodes-base.set",
      "position": [
        160,
        32
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b650c645-7341-4007-8fa3-ba4047fd694b",
              "name": "chat_id",
              "type": "string",
              "value": "={{ $json.callback_query?.message.chat.id || $json.message?.chat.id }}"
            },
            {
              "id": "af488204-9701-4974-96f2-7a403d80c3fd",
              "name": "callback_data",
              "type": "string",
              "value": "={{ $json.callback_query?.data || 'none' }}"
            },
            {
              "id": "6b624f31-898f-4a65-8f93-708da5f19fb5",
              "name": "message_text",
              "type": "string",
              "value": "={{ $json.message?.text || 'none' }}"
            },
            {
              "id": "5a609d6b-9622-44e9-ba46-8ec65b6406b7",
              "name": "update_type",
              "type": "string",
              "value": "={{ (() => {\n    if ($json.message?.text) {\n        return 'text';\n    } else if ($json.callback_query?.data) {\n        return 'callback';\n    } else if ($json.message?.document) {\n        return 'document';\n    } else if ($json.message?.voice) {\n        return 'voice'\n    } else {\n        return 'unknown';\n    }\n})() }}"
            },
            {
              "id": "3a0c9536-5fa0-482a-bb6d-1d40b8d04030",
              "name": "file_id",
              "type": "string",
              "value": "={{ $json.message.document?.file_id }}"
            },
            {
              "id": "b7fff404-3337-4838-84b5-2433864556c0",
              "name": "file_mime_type",
              "type": "string",
              "value": "={{ $json.message.document?.mime_type }}"
            },
            {
              "id": "b1a25c86-41f3-4ec3-9dc7-05afa171fd3e",
              "name": "file_caption",
              "type": "string",
              "value": "={{ $json.message.caption }}"
            },
            {
              "id": "69c5db95-7d08-49a6-8c17-e941e23107dd",
              "name": "voice_file_id",
              "type": "string",
              "value": "={{ $json.message.voice.file_id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "9281e1e8-c019-4479-bedb-37e3e6d72a39",
      "name": "文本提示",
      "type": "n8n-nodes-base.set",
      "position": [
        1440,
        -256
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ff244c43-de08-4f20-8b5c-077b6ce1e6ca",
              "name": "chatInput",
              "type": "string",
              "value": "={{ $('Set input context').item.json.message_text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3f470d9f-755a-4aaf-9573-f14162517de6",
      "name": "文档提示",
      "type": "n8n-nodes-base.set",
      "position": [
        1440,
        -64
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ff244c43-de08-4f20-8b5c-077b6ce1e6ca",
              "name": "chatInput",
              "type": "string",
              "value": "={{ $('Set input context').item.json.file_caption }}\n\n--- Information extracted from document sent by the user ---\n{{ $json.candidates[0].content.parts[0].text }}\n--- End for information extracted from document sent by the user ---"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "86552b5d-5ff6-4cb8-afbc-8765a4bd6c17",
      "name": "描述音频",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1120,
        128
      ],
      "parameters": {
        "url": "=https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"contents\": [{\n    \"parts\":[\n      {\"text\": \"Generate a transcript of the speech.\"},\n      {\n        \"inline_data\": {\n          \"mime_type\": \"audio/ogg\",\n          \"data\": \"{{ $json.data }}\"\n        }\n      }\n    ]\n  }]\n}\n",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "googlePalmApi"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "DLr3p8XtQeQSJovy",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "7f1ff2b5-1117-46aa-846b-f2971fe4dd1d",
      "name": "音频提示",
      "type": "n8n-nodes-base.set",
      "position": [
        1440,
        128
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ff244c43-de08-4f20-8b5c-077b6ce1e6ca",
              "name": "chatInput",
              "type": "string",
              "value": "={{ $json.candidates[0].content.parts[0].text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "36e799c4-84ce-48e8-85ba-50f69d6f7062",
      "name": "AI代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2144,
        -64
      ],
      "parameters": {
        "options": {
          "systemMessage": "Act as a content manager specializing in social media management, public relations, and network management. Your role involves several key responsibilities when a user requests to create a social media post.\nYour output should be not use Markdown, HTML or anything else. Your responses will be passed as text messages to the user.\n\n- **Understand User Input**: First, clearly understand the user's request regarding the content they wish to post on their social networks. Gather necessary details and context from the user to ensure the post is accurate and aligned with their goals.\n\n- **Context Collection**: If additional context is needed, and not provided, ask the user specific and targeted questions to obtain any missing information. Use the \"get_context_records\" tool to fetch existing records and the \"save_context_record\" tool to store any new information.\n\n- **Post Creation**: Use the provided information to create a draft social media post. This includes formulating engaging and relevant content tailored to the user's specified platform and audience.\n\n- **User Approval Process**: Present the draft to the user for feedback and approval. Never post anything without explicit user's approval!\n\n- **Posting**: After receiving approval from the user, post the content using the corresponding social media tools."
        }
      },
      "typeVersion": 2
    },
    {
      "id": "833e1b25-b348-4cca-b4b7-c8661e97cf57",
      "name": "Google Gemini聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1664,
        160
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "DLr3p8XtQeQSJovy",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3b96b10d-ce34-454f-b6fb-6a0e41724a79",
      "name": "嵌入Google Gemini",
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "position": [
        1904,
        416
      ],
      "parameters": {
        "modelName": "models/embedding-001"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "DLr3p8XtQeQSJovy",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fa334f34-fa5f-45f4-bb08-69db605d4d40",
      "name": "发送响应",
      "type": "n8n-nodes-base.telegram",
      "position": [
        3280,
        -64
      ],
      "webhookId": "2fd844a5-c820-44e1-a0aa-92c60a5af71d",
      "parameters": {
        "text": "={{ $json.parts || \"Error occured, pls try again\" }}",
        "chatId": "={{ $('Set input context').item.json.chat_id }}",
        "additionalFields": {
          "parse_mode": "HTML",
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "yaqH1QTZ8lML5pqB",
          "name": "Gate bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "53e4a542-3608-416e-8703-1344f1485d5d",
      "name": "创建X(Twitter)帖子",
      "type": "n8n-nodes-base.twitterTool",
      "position": [
        2512,
        448
      ],
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Text', ``, 'string') }}",
        "descriptionType": "manual",
        "toolDescription": "Create Tweet in X. Text must be 280 characters or less. If you receive \"Forbidden\" error, it means that the text is too long, you need to shorted it.",
        "additionalFields": {}
      },
      "credentials": {
        "twitterOAuth2Api": {
          "id": "6cbO5U00YNkpAlH5",
          "name": "X account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "4226e081-af3f-42ea-ba06-caef96e9448a",
      "name": "聊天记忆管理器",
      "type": "@n8n/n8n-nodes-langchain.memoryManager",
      "position": [
        832,
        320
      ],
      "parameters": {
        "mode": "delete",
        "deleteMode": "all"
      },
      "typeVersion": 1.1
    },
    {
      "id": "6b7a925f-c111-4b4f-b1d5-2fcd3d9ae3ac",
      "name": "条件判断",
      "type": "n8n-nodes-base.if",
      "position": [
        608,
        416
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "b9045645-8715-47b5-82b1-2793c1618000",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Set input context').item.json.callback_data }}",
              "rightValue": "cm"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3b056078-970e-4907-87df-9d3c6f5b5cbf",
      "name": "错误",
      "type": "n8n-nodes-base.telegram",
      "position": [
        928,
        512
      ],
      "webhookId": "2fd844a5-c820-44e1-a0aa-92c60a5af71d",
      "parameters": {
        "text": "Invalid callback",
        "chatId": "={{ $('Set input context').item.json.chat_id }}",
        "replyMarkup": "inlineKeyboard",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "yaqH1QTZ8lML5pqB",
          "name": "Gate bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d58fd416-cfb1-48b9-86cf-de6e5ca9c571",
      "name": "成功",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1232,
        320
      ],
      "webhookId": "2fd844a5-c820-44e1-a0aa-92c60a5af71d",
      "parameters": {
        "text": "Memory is cleaned",
        "chatId": "={{ $('Set input context').item.json.chat_id }}",
        "replyMarkup": "inlineKeyboard",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "yaqH1QTZ8lML5pqB",
          "name": "Gate bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9b86684f-9018-4c48-b09f-4d9d6895731b",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1792,
        160
      ],
      "parameters": {
        "sessionKey": "={{ $('Set input context').item.json.chat_id }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "a92792e9-a558-47a9-977d-16d57f47e160",
      "name": "拆分输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        3056,
        -64
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "parts"
      },
      "typeVersion": 1
    },
    {
      "id": "2c253f28-1cc6-49f9-85b2-4b4f80979670",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -176,
        -192
      ],
      "parameters": {
        "color": 2,
        "width": 224,
        "height": 416,
        "content": "## 机器人入口"
      },
      "typeVersion": 1
    },
    {
      "id": "6b879d47-c143-41cf-91d1-f7fb86cb4253",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        -192
      ],
      "parameters": {
        "color": 7,
        "width": 224,
        "height": 416,
        "content": "## 请求预处理"
      },
      "typeVersion": 1
    },
    {
      "id": "3aea91ae-f5b7-4107-baa4-cab71e530ea5",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        -288
      ],
      "parameters": {
        "color": 2,
        "width": 624,
        "height": 576,
        "content": "## 从非文本输入中提取数据"
      },
      "typeVersion": 1
    },
    {
      "id": "dd2efbf5-9ba0-4f45-b3ae-8d38ce112d5c",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2080,
        -400
      ],
      "parameters": {
        "color": 2,
        "width": 384,
        "height": 496,
        "content": "## AI代理节点"
      },
      "typeVersion": 1
    },
    {
      "id": "ce006594-4ad4-4bda-86d3-e2ffb6bc919b",
      "name": "拆分代理响应",
      "type": "n8n-nodes-base.code",
      "position": [
        2832,
        -64
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfunction splitString(str, size) {\n  let result = [];\n  for (let i = 0; i < str.length; i += size) {\n    result.push(str.slice(i, i + size));\n  }\n  return result;\n}\n\nfor (const item of $input.all()) {\n  const parts = splitString(item.json.output, 3000)\n  item.json.parts = parts;\n}\n\nreturn $input.all();"
      },
      "typeVersion": 2
    },
    {
      "id": "5243247e-0d99-49f0-95b9-9b338b839053",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2768,
        -208
      ],
      "parameters": {
        "color": 7,
        "width": 720,
        "height": 320,
        "content": "## 响应用户"
      },
      "typeVersion": 1
    },
    {
      "id": "a41942b8-88d9-4fb9-a70a-2b9b23ba1619",
      "name": "输入类型切换",
      "type": "n8n-nodes-base.switch",
      "position": [
        384,
        -16
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "text",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "9f54c101-20a1-45f2-b154-d9e4456cf906",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.update_type }}",
                    "rightValue": "text"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "document",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "9c2293ff-0921-4c5e-94c0-953a7e613737",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.update_type }}",
                    "rightValue": "document"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "voice",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "bc8ad42b-6051-4145-9c00-8984a63d285a",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.update_type }}",
                    "rightValue": "voice"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "callback",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "07580596-c93b-41a0-8dfe-3c4a8f364fb6",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.update_type }}",
                    "rightValue": "callback"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "typeVersion": 3.2
    },
    {
      "id": "9a790d0b-62fb-47c0-8670-2d33433140f9",
      "name": "编码文档",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        928,
        -64
      ],
      "parameters": {
        "options": {},
        "operation": "binaryToPropery"
      },
      "typeVersion": 1
    },
    {
      "id": "51e25ea9-1463-44f3-a2ce-8b1a89ada8b2",
      "name": "编码音频",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        928,
        128
      ],
      "parameters": {
        "options": {},
        "operation": "binaryToPropery"
      },
      "typeVersion": 1
    },
    {
      "id": "a2fee96e-5619-44ed-afd6-a0cd84c86bcb",
      "name": "描述文档",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1120,
        -64
      ],
      "parameters": {
        "url": "=https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"contents\": [{\n    \"parts\":[\n      {\"text\": \"Exctract all the information about the company or product from this document\"},\n      {\n        \"inline_data\": {\n          \"mime_type\": \"application/pdf\",\n          \"data\": \"{{ $json.data }}\"\n        }\n      }\n    ]\n  }]\n}\n",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "googlePalmApi"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "DLr3p8XtQeQSJovy",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "117dda5b-cad8-4f5e-8694-12d21719528d",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2688,
        208
      ],
      "parameters": {
        "color": 2,
        "width": 368,
        "height": 400,
        "content": "## LinkedIn工具"
      },
      "typeVersion": 1
    },
    {
      "id": "4f0ea1ad-15c5-4693-9afa-03dab4044aae",
      "name": "以公司身份在LinkedIn创建帖子",
      "type": "n8n-nodes-base.linkedInTool",
      "position": [
        2912,
        448
      ],
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Text', ``, 'string') }}",
        "postAs": "organization",
        "descriptionType": "manual",
        "toolDescription": "Create a post in LinkedIn as a company",
        "additionalFields": {}
      },
      "credentials": {
        "linkedInOAuth2Api": {
          "id": "ZZgf5lAo8W5mU7L2",
          "name": "LinkedIn account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3ccbae0c-ff7a-4ec5-8dbe-6dc23560412e",
      "name": "以个人身份在LinkedIn创建帖子",
      "type": "n8n-nodes-base.linkedInTool",
      "position": [
        2752,
        448
      ],
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Text', ``, 'string') }}",
        "person": "NAOnogS86v",
        "descriptionType": "manual",
        "toolDescription": "Create a post in LinkedIn as a person",
        "additionalFields": {}
      },
      "credentials": {
        "linkedInOAuth2Api": {
          "id": "ZZgf5lAo8W5mU7L2",
          "name": "LinkedIn account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fde65067-e098-4645-9c4a-d91cc3b6c669",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -832,
        -416
      ],
      "parameters": {
        "width": 624,
        "height": 896,
        "content": "## 您个人的Telegram机器人内AI社交媒体经理"
      },
      "typeVersion": 1
    },
    {
      "id": "97d54d2a-c724-4c2e-b332-e04adce6fb27",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -832,
        496
      ],
      "parameters": {
        "color": 2,
        "width": 624,
        "height": 80,
        "content": "**此颜色的注释描述了启动模板前需要设置的信息 - 请查看!**"
      },
      "typeVersion": 1
    },
    {
      "id": "abe22327-c5b1-40f8-8933-f850f9673b8c",
      "name": "检索知识",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        1920,
        160
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "memoryKey": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Set input context').item.json.chat_id }}"
        },
        "toolDescription": "Get knowledge records"
      },
      "typeVersion": 1.3
    },
    {
      "id": "390ea20a-8097-4bfe-97fc-adf1b4fdb5c9",
      "name": "保存知识",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        2240,
        160
      ],
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "1QHDXNbD3s3eRjlc",
          "cachedResultName": "Save Vector store record"
        },
        "description": "调用此工具以保存从用户处接收的某些知识。将您要保存的内容传递到\"data\"参数中。",
        "workflowInputs": {
          "value": {
            "data": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('data', `The record you want to save to database`, 'string') }}",
            "chat_id": "={{ $('Set input context').item.json.chat_id }}"
          },
          "schema": [
            {
              "id": "chat_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "chat_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "data",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "data",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "8372b8b0-c751-4623-8952-552019461fe0",
      "name": "下载音频",
      "type": "n8n-nodes-base.telegram",
      "position": [
        720,
        128
      ],
      "webhookId": "83f67f47-46c0-4dd6-a26d-e16ca9d81b6f",
      "parameters": {
        "fileId": "={{ $json.voice_file_id }}",
        "resource": "file"
      },
      "credentials": {
        "telegramApi": {
          "id": "yaqH1QTZ8lML5pqB",
          "name": "Gate bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "78db4c04-44d5-4f21-860d-2dc7d556b553",
      "name": "下载文档",
      "type": "n8n-nodes-base.telegram",
      "position": [
        720,
        -64
      ],
      "webhookId": "83f67f47-46c0-4dd6-a26d-e16ca9d81b6f",
      "parameters": {
        "fileId": "={{ $json.file_id }}",
        "resource": "file"
      },
      "credentials": {
        "telegramApi": {
          "id": "yaqH1QTZ8lML5pqB",
          "name": "Gate bot"
        }
      },
      "typeVersion": 1.2
    }
  ],
  "active": true,
  "pinData": {
    "Telegram Trigger": [
      {
        "json": {
          "message": {
            "chat": {
              "id": 385622184,
              "type": "private",
              "username": "GregoryPotemkin",
              "first_name": "Gregory"
            },
            "date": 1753111895,
            "from": {
              "id": 385622184,
              "is_bot": false,
              "username": "GregoryPotemkin",
              "first_name": "Gregory",
              "language_code": "en"
            },
            "caption": "what do you see here?",
            "document": {
              "file_id": "BQACAgIAAxkBAAICLWh-XVdv2hDDyu8rBO8kB3nnqeSBAAL7dgACjo_xS2EbW7kngJauNgQ",
              "file_name": "TAD-011525-ZAO A.pdf",
              "file_size": 211251,
              "mime_type": "application/pdf",
              "file_unique_id": "AgAD-3YAAo6P8Us"
            },
            "message_id": 557
          },
          "update_id": 553043430
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a94364b7-0da8-4a0c-a471-1ad9f0a3cd3b",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Chat Memory Manager",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Split agent's response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Send response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text prompt": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Audio prompt": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Encode audio": {
      "main": [
        [
          {
            "node": "Describe audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          },
          {
            "node": "Chat Memory Manager",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Describe audio": {
      "main": [
        [
          {
            "node": "Audio prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download audio": {
      "main": [
        [
          {
            "node": "Encode audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save knowledge": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Document prompt": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Encode document": {
      "main": [
        [
          {
            "node": "Describe document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Set input context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Describe document": {
      "main": [
        [
          {
            "node": "Document prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download document": {
      "main": [
        [
          {
            "node": "Encode document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Input type switch": {
      "main": [
        [
          {
            "node": "Text prompt",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Download document",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Download audio",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set input context": {
      "main": [
        [
          {
            "node": "Input type switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve knowledge": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Chat Memory Manager": {
      "main": [
        [
          {
            "node": "Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split agent's response": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create X (Twitter) post": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Google Gemini": {
      "ai_embedding": [
        [
          {
            "node": "Retrieve knowledge",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Create post in LinkedIn as a person": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create post in LinkedIn as a company": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 社交媒体, AI 聊天机器人

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量36
分类2
节点类型19
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Gregory

Gregory

@gregory

Backend & ML engineer with passion for automation and MVP building. Co-founder of lemon-ai.com

外部链接
在 n8n.io 查看

分享此工作流