8
n8n 中文网amn8n.com

使用GPT-4、Telegram和谷歌表格为Anki生成语言学习闪卡

中级

这是一个Personal Productivity, Multimodal AI领域的自动化工作流,包含 12 个节点。主要使用 Set, Telegram, GoogleSheets, ManualTrigger, Agent 等节点。 使用GPT-4、Telegram和谷歌表格为Anki生成语言学习闪卡

前置要求
  • Telegram Bot Token
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "d0d26e2ab86d82d636b46b0756abc3f9cd334a994bf08c9f157d8ff40e3ab066",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "1e8f49ce-b57f-4919-b04b-58254fc28938",
      "name": "AI 代理1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -464,
        1840
      ],
      "parameters": {
        "text": "={{ $json.message.text }}",
        "options": {
          "systemMessage": "# Role\nYou are a helpful translation agent that will help users to create flashcard for language learning.\n\n# Context\nYou will receive a word or sentence in English. Generate a translation (in English) with simple 2 sentences to illustrate the sense of the word. \n\n# Notes\n- it's ok to output multiple translations in new lines\n- multiple example sentences should be in new line\n- use <br> tag for the new lines\n- Generate the output in JSON format following the example below:\n{\"word\": \"Example word\",\n\"translation\": \"1. Meaning1<br>2. Meaning2\", \"sentences\": \"Sentences go here\"}\n\n- Be very diligent in thinking about the task being asked from you.\n- Generate concise sentences as they need to fit in flash cards.\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "notesInFlow": true,
      "typeVersion": 1.7
    },
    {
      "id": "13255d55-2be5-4b12-9779-c9c717981b70",
      "name": "OpenAI 聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -464,
        2016
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "kA7XUqe7u8O032uI",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "01e26beb-bb63-4249-8b05-2e8ea076cdc7",
      "name": "结构化输出解析器1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -272,
        2016
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"word\": \"\",\n  \"translation\": \"\",\n  \"sentences\": \"\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "81da4387-1414-4fc8-9dd0-7f0ec3dc1541",
      "name": "在表格中添加行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        0,
        1840
      ],
      "parameters": {
        "columns": {
          "value": {
            "answer": "={{ $json.output.translation }}<br/><br/>{{ $json.output.sentences }}",
            "question": "={{ $json.output.word }}"
          },
          "schema": [
            {
              "id": "question",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "question",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "answer",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "answer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "tags",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "tags",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1bYTzZrU0Zb_lO4idwN-_yoyD7ig7Iug9Fv-BHk4cAV0/edit#gid=0",
          "cachedResultName": "TomekPersonalDeck"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1bYTzZrU0Zb_lO4idwN-_yoyD7ig7Iug9Fv-BHk4cAV0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1bYTzZrU0Zb_lO4idwN-_yoyD7ig7Iug9Fv-BHk4cAV0/edit?usp=drivesdk",
          "cachedResultName": "TomekAnkiPersonalDeck"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "5AH6TUd26IYsUuVk",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "a423d57b-3885-487f-93b0-97872335aa8b",
      "name": "Telegram 触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -816,
        1840
      ],
      "webhookId": "2194a6b2-2302-4406-9c8c-207161b7eb22",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {
          "download": true
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "1PFznoRdZby67Oi1",
          "name": "Telegram bot Anki"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "d007c592-220e-4f89-b1c3-1c9cb91676ba",
      "name": "发送短信",
      "type": "n8n-nodes-base.telegram",
      "position": [
        256,
        1840
      ],
      "webhookId": "ae6e214c-7703-483f-8fe2-4ee82b9dc13f",
      "parameters": {
        "text": "={{ $json.question }}\n\n{{ $json.answer }}",
        "chatId": "={{ $json.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "1PFznoRdZby67Oi1",
          "name": "Telegram bot Anki"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1da56d7e-b386-42cd-862d-718c046f6da9",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -944,
        1760
      ],
      "parameters": {
        "width": 352,
        "height": 432,
        "content": "### 输入闪卡 '正面'"
      },
      "typeVersion": 1
    },
    {
      "id": "e15c418d-d6d4-4074-8a72-fc7f6fa242f5",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        1760
      ],
      "parameters": {
        "width": 448,
        "height": 432,
        "content": "### 生成闪卡 '背面'"
      },
      "typeVersion": 1
    },
    {
      "id": "fc102059-6911-44ba-a5c9-1fbdd0f77018",
      "name": "当点击\"执行工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -896,
        2032
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "831acc6b-6816-4559-8ead-3a3b3ed7fb8a",
      "name": "闪卡 '正面'",
      "type": "n8n-nodes-base.set",
      "position": [
        -736,
        2032
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "4bd2a197-eff6-4ece-adbd-4997b37d190e",
              "name": "=message.text",
              "type": "string",
              "value": "comprehensive"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "06ea1fee-247f-471d-b33b-a76be9eba5db",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        1760
      ],
      "parameters": {
        "height": 432,
        "content": "### 将闪卡存储到表格中"
      },
      "typeVersion": 1
    },
    {
      "id": "896e95af-d017-4c1e-bccc-5f991bb46d54",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        1760
      ],
      "parameters": {
        "height": 432,
        "content": "### 确认"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "AI Agent1": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Flashcard 'front'": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Flashcard 'front'",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 个人效率, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
中级
节点数量12
分类2
节点类型9
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流