8
n8n 中文网amn8n.com

构建带记忆、Google套件和多AI研究成像的WhatsApp助手

高级

这是一个AI Chatbot, Multimodal AI领域的自动化工作流,包含 71 个节点。主要使用 If, Set, Code, Switch, Webhook 等节点。 构建带记忆、Google套件和多AI研究成像的WhatsApp助手

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • Google 账号和 Gmail API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Gemini API Key
  • MongoDB 连接字符串
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "67849de66331aaa2dca6a4f3cbf793b274f923d94e4d9cdaae2e5d9aebaff626"
  },
  "nodes": [
    {
      "id": "db5520a2-c423-406b-9150-0cf4a0f99ed2",
      "name": "WhatsApp 触发器",
      "type": "n8n-nodes-base.whatsAppTrigger",
      "position": [
        -832,
        -48
      ],
      "webhookId": "b50ac6f1-009b-4d7c-99b7-0417637fcc8b",
      "parameters": {
        "options": {
          "messageStatusUpdates": []
        },
        "updates": [
          "messages"
        ]
      },
      "credentials": {
        "whatsAppTriggerApi": {
          "id": "au7NGsrEGiVNnIgw",
          "name": "WhatsApp OAuth account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "050596e5-1c80-4dd1-984f-199394653f6c",
      "name": "AI Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        736,
        -192
      ],
      "parameters": {
        "text": "=You are  a helpful and friendly AI assistant. The user seems emotionally neutral, so reply in a calm, polite, slightly playful way. \n\nIMPORTANT FORMATTING RULES (Strict): Do NOT use more than one question mark total in your entire reply. Use '..' instead of '?' inside sentences or casual questions. Only the final sentence may end with a question, and only if it is a real question.\n\n{{ $now }}\n\nuser message: {{ $json.input }}\n\n",
        "options": {
          "systemMessage": "=🛠️ Instructions for Agent Behavior\n\nContext Retrieval\n\nFirst, search the vector store for relevant past user conversations or data.\n\nIf no useful context is found, query the Supabase Vector tool.\n\nRetry the vector store once if the first attempt fails.\n\nIf still no context is found, continue naturally without it.\n\nImage Requests\n\nIf the user asks to create, generate, or send an image, logo, or any other picture, use the HTTP node to send the user’s message for image creation.\n\nCalendar & Task Handling\n\nIf the user asks about tasks, reminders, plans, or appointments, use the Calendar and Task agents to create them.\n\nIf the user asks about today’s tasks, events, or plans, fetch information from both Calendar and Task agents, then inform the user.\n\nResearch & Wikipedia Logic\n\nFor factual, research-oriented, or up-to-date questions, use the Research tool.\n\nFor entertainment, history, or politics queries, use the Wikipedia tool.\n\nIf both tools apply, query both and merge the results before responding.\n\n---End of Instructions---"
        },
        "promptType": "define",
        "needsFallback": true
      },
      "retryOnFail": true,
      "typeVersion": 2.1
    },
    {
      "id": "d849f985-fe50-442a-a574-a2c77bfa16ec",
      "name": "将聊天记录发送到 MongoDB",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1408,
        -192
      ],
      "parameters": {
        "url": "https://n8n.iniyavan.space/webhook/a0299e2f-a81b-48e0-a912-d9749ecf1820",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "User's Message",
              "value": "={{ $('WhatsApp Trigger').item.json.messages[0].text.body }}"
            },
            {
              "name": "Assistant's Response",
              "value": "={{ $('AI Agent1').item.json.output }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "fa866ec1-ec7d-4f10-b376-7dbf960c3230",
      "name": "WeatherMap",
      "type": "n8n-nodes-base.openWeatherMapTool",
      "position": [
        960,
        16
      ],
      "parameters": {
        "cityName": "bengaluru",
        "operation": "5DayForecast"
      },
      "credentials": {
        "openWeatherMapApi": {
          "id": "UnoRSeuGqJMnW6N1",
          "name": "OpenWeatherMap account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "740c0b36-e4c8-47b2-898c-c6422dea0f68",
      "name": "下载媒体文件",
      "type": "n8n-nodes-base.whatsApp",
      "onError": "continueRegularOutput",
      "position": [
        -384,
        -144
      ],
      "webhookId": "b6901c9a-49e2-42e5-a863-634a07244fbd",
      "parameters": {
        "resource": "media",
        "operation": "mediaUrlGet",
        "mediaGetId": "={{ $json.messages[0].image.id }}"
      },
      "credentials": {
        "whatsAppApi": {
          "id": "KZFh0MY5tY65LVm9",
          "name": "WhatsApp account 2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "10ff9ba4-f689-490c-bffc-e85fb1b5b110",
      "name": "分析图像",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "onError": "continueRegularOutput",
      "position": [
        64,
        -144
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.0-flash",
          "cachedResultName": "models/gemini-2.0-flash"
        },
        "options": {},
        "resource": "image",
        "inputType": "binary",
        "operation": "analyze"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "3Hcwnd3kUzFUj7kB",
          "name": "telegram"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b47e8952-813e-4133-91cc-0b06f7e172ed",
      "name": "HTTP 请求 5",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        -160,
        -144
      ],
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {},
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "whatsAppApi"
      },
      "credentials": {
        "whatsAppApi": {
          "id": "KZFh0MY5tY65LVm9",
          "name": "WhatsApp account 2"
        },
        "httpBearerAuth": {
          "id": "MdDaW65bAdzx5Z3w",
          "name": "Bearer Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "88d4f859-563c-4544-86c1-e1cb9aa0de6a",
      "name": "切换",
      "type": "n8n-nodes-base.switch",
      "position": [
        -608,
        -48
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "image",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "f843ef78-7ddf-43b3-8d6c-7969529566a1",
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.messages[0].image }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "chat",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "844825ff-91be-472c-82ba-e7c22d3c988a",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{    $json.messages[0].text?.body || ''  }} ",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "df58f83c-abc9-43fc-8935-552a058ec9ea",
      "name": "思考",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        1248,
        32
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d3ca2d52-0656-46bd-8e62-149ed91de187",
      "name": "代码1",
      "type": "n8n-nodes-base.code",
      "position": [
        256,
        -64
      ],
      "parameters": {
        "jsCode": "const image = $json.content?.parts?.[0]?.text\n  ? '(Result: ' + $json.content.parts[0].text + ') — This is the result from the image analysis node of the user message. Reply accordingly. If it’s technical, elaborate the message and reply with the input.'\n  : '';\n\nconst whatsappNode = $('WhatsApp Trigger').first().json;\nconst text = whatsappNode?.messages?.[0]?.text?.body || '';\n\nconst input = image || text;\n\nif (!input) {\n  throw new Error(\"No input available from image or text.\");\n}\n\nreturn [\n  {\n    json: {\n      input,\n      source: image ? \"image\" : (text ? \"text\" : \"none\"),\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "6e48d0a9-804b-4ec1-b9fc-11b30677319e",
      "name": "Gmail 工具",
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "position": [
        144,
        336
      ],
      "parameters": {
        "text": "use the Gmail tools to get the recent emails for every request.",
        "options": {
          "systemMessage": ""
        },
        "needsFallback": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "7f58a1fa-7c17-499a-a84b-108e71cf9128",
      "name": "正在输入...",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -416,
        48
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v22.0/{{ $json.metadata.phone_number_id }}/messages ",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"messaging_product\": \"whatsapp\",\n  \"status\": \"read\",\n  \"message_id\": \"{{ $json.messages[0].id }}\",\n  \"typing_indicator\": {\n    \"type\": \"text\"\n  }\n}\n",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {}
          ]
        },
        "nodeCredentialType": "whatsAppApi"
      },
      "credentials": {
        "whatsAppApi": {
          "id": "KZFh0MY5tY65LVm9",
          "name": "WhatsApp account 2"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b1af98a9-b2e9-4548-9e4e-538bc09bd7b7",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        512,
        336
      ],
      "parameters": {
        "sessionKey": "whatsapp",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "0a47aecd-cfa8-44c9-9b28-e1edbc5cc8c2",
      "name": "日历助手",
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "position": [
        -528,
        368
      ],
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Prompt__User_Message_', ``, 'string') }}",
        "options": {
          "systemMessage": "=# Overview\nYou are a calendar assistant. Your responsibilities include creating, getting, and deleting events in the user's calendar.\n\n**Calendar Management Tools**  \n   - Use \"Create Event with Attendee\" when an event includes a participant.  \n   - Use \"Create Event\" for solo events.   \n   - Use \"Get Events\" to fetch calendar schedules when requested.\n   - Use \"Delete Event\" to delete an event. You must use \"Get Events\" first to get the ID of the event to delete.\n   - Use \"Update Event\" to update an event. You must use \"Get Events\" first to get the ID of the event to update.\n\nIf the user asks about tasks, reminders, plans, or appointments, use the Calendar and Task agents to create them.\n\nIf the user asks about today’s tasks events or plans, fetch and inform them using both Calendar and Task Agents.\n\n## Final Notes\nHere is the current date/time: {{ $now }}\nIf a duration for an event isn't specified, assume it will be one hour."
        },
        "toolDescription": "A calendar agent for all calendar actions"
      },
      "typeVersion": 2.2
    },
    {
      "id": "f02dc89a-9538-4f3d-9b6c-4ec80f71ba55",
      "name": "获取多个事件",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        -640,
        576
      ],
      "parameters": {
        "options": {},
        "timeMax": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Before', ``, 'string') }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "c1eb0f65db8cf813047300a0bf07bbe56274a6fb1c114431846870368a4514f7@group.calendar.google.com",
          "cachedResultName": "Reminders"
        },
        "operation": "getAll"
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "RoaCgWh1hE4yYNao",
          "name": "JC Calendar account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "da372f07-f4df-4f60-bb7f-7eb97d30fe95",
      "name": "创建事件",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        -512,
        576
      ],
      "parameters": {
        "end": "={{ $fromAI('End', ``, 'string') }}",
        "start": "={{ $fromAI('Start', ``, 'string') }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "c1eb0f65db8cf813047300a0bf07bbe56274a6fb1c114431846870368a4514f7@group.calendar.google.com",
          "cachedResultName": "Reminders"
        },
        "additionalFields": {
          "summary": "={{ $fromAI('Summary', ``, 'string') }}"
        }
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "RoaCgWh1hE4yYNao",
          "name": "JC Calendar account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "8f94949d-1381-4729-ae31-a060644cd69a",
      "name": "更新事件",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        -384,
        576
      ],
      "parameters": {
        "eventId": "={{ $fromAI('Event_ID', ``, 'string') }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "c1eb0f65db8cf813047300a0bf07bbe56274a6fb1c114431846870368a4514f7@group.calendar.google.com",
          "cachedResultName": "Reminders"
        },
        "operation": "update",
        "updateFields": {}
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "RoaCgWh1hE4yYNao",
          "name": "JC Calendar account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "fb8c7351-c381-46d5-8a74-f3e4a1f0e2c9",
      "name": "删除事件",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        -256,
        576
      ],
      "parameters": {
        "eventId": "={{ $fromAI('Event_ID', ``, 'string') }}",
        "options": {},
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "c1eb0f65db8cf813047300a0bf07bbe56274a6fb1c114431846870368a4514f7@group.calendar.google.com",
          "cachedResultName": "Reminders"
        },
        "operation": "delete"
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "RoaCgWh1hE4yYNao",
          "name": "JC Calendar account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "22ddc16f-9aa4-4967-84fc-f27239cc6e4e",
      "name": "获取事件",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        -128,
        576
      ],
      "parameters": {
        "eventId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Event_ID', ``, 'string') }}",
        "options": {},
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "c1eb0f65db8cf813047300a0bf07bbe56274a6fb1c114431846870368a4514f7@group.calendar.google.com",
          "cachedResultName": "Reminders"
        },
        "operation": "get"
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "RoaCgWh1hE4yYNao",
          "name": "JC Calendar account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "5380aa75-09f4-44bc-a37e-142f4816e685",
      "name": "MongoDB Atlas Vector Store2",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas",
      "position": [
        640,
        224
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "topK": 5,
        "options": {},
        "metadata_field": " info, text, summary",
        "mongoCollection": {
          "__rl": true,
          "mode": "list",
          "value": "document",
          "cachedResultName": "document"
        },
        "toolDescription": "use this tool as memory node for the Ai agent ",
        "vectorIndexName": "default"
      },
      "credentials": {
        "mongoDb": {
          "id": "68YcCVKfDKnwNcDo",
          "name": "MongoDB account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "b33fcdb6-99ba-44f2-b6ab-070e53bf720c",
      "name": "gemini-2.5-flash",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        16,
        528
      ],
      "parameters": {
        "options": {},
        "modelName": "=models/gemini-2.5-flash"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "3Hcwnd3kUzFUj7kB",
          "name": "telegram"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "32461746-2727-4c06-95ee-6aa60e613c32",
      "name": "gpt-5-nano",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        144,
        544
      ],
      "parameters": {
        "model": "=openai/gpt-5-nano",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "IigODthJcG8e4fv8",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "23cf2e5a-e1cf-45cf-be5b-bd8d4027b86d",
      "name": "获取多条消息",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        416,
        544
      ],
      "webhookId": "1aefb18e-311f-4c23-8951-8b294822c4f0",
      "parameters": {
        "filters": {},
        "operation": "getAll"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "llNadZCEaveDOEIp",
          "name": "Gmail account "
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "1f8a17f4-e027-4fb6-bfc3-1c63bf912097",
      "name": "获取消息",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        256,
        544
      ],
      "webhookId": "9cc34209-7dac-4dd3-9085-84b8d07634be",
      "parameters": {
        "messageId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message_ID', ``, 'string') }}",
        "operation": "get"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "c2Ww8phHiVkuIYmL",
          "name": "HDFC bank "
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "c4c0cad1-33af-4f13-9e6b-e5e6f2559990",
      "name": "任务代理",
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "position": [
        -592,
        720
      ],
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Prompt__User_Message_', ``, 'string') }}",
        "options": {
          "systemMessage": "=You are a task management assistant. Your responsibilities include creating, retrieving, updating, and deleting tasks in the user's Google Tasks list.\n\nGoogle Tasks Management Tools\n\nUse \"Create Task\" to add a new task to the user's task list.\nUse \"Get Tasks\" to retrieve tasks from a specific list or all lists.\nUse \"Update Task\" to modify an existing task. You must use \"Get Tasks\" first to obtain the task ID.\nUse \"Delete Task\" to remove a task. You must use \"Get Tasks\" first to obtain the task ID.\nUse \"Create Task List\" to organize tasks into a new list.\nUse \"Get Task Lists\" to retrieve available task lists.\nUse \"Delete Task List\" to remove an entire task list. You must use \"Get Task Lists\" first to obtain the list ID.\n\nFinal Notes\nHere is the current date/time: {{ $now }}\nIf a due date or time is not specified for a task, assume it is due by end of day.\nTasks should be created with clear titles and optional descriptions for context.\nUse priority flags if specified (e.g., high, medium, low)."
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "26f8949b-1876-42dd-a4b2-e79e5e6723ee",
      "name": "在 Google Tasks 中创建任务",
      "type": "n8n-nodes-base.googleTasksTool",
      "position": [
        -528,
        880
      ],
      "parameters": {
        "task": "MDE5MTI4ODM0MjI0MDM1MTAyNDQ6MDow",
        "title": "={{ $fromAI('Title', ``, 'string') }}",
        "additionalFields": {}
      },
      "credentials": {
        "googleTasksOAuth2Api": {
          "id": "hJ9f755XneSNJLtO",
          "name": "Google Tasks account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0e3279da-25b6-4245-9102-a41b72e692bb",
      "name": "在 Google Tasks 中删除任务",
      "type": "n8n-nodes-base.googleTasksTool",
      "position": [
        -336,
        896
      ],
      "parameters": {
        "task": "MDE5MTI4ODM0MjI0MDM1MTAyNDQ6MDow",
        "taskId": "={{ $fromAI('Task_ID', ``, 'string') }}",
        "operation": "delete"
      },
      "credentials": {
        "googleTasksOAuth2Api": {
          "id": "hJ9f755XneSNJLtO",
          "name": "Google Tasks account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1749a2e0-f4fa-4309-86c8-f0a8b8b0424e",
      "name": "在 Google Tasks 中获取多个任务",
      "type": "n8n-nodes-base.googleTasksTool",
      "position": [
        -144,
        880
      ],
      "parameters": {
        "task": "MDE5MTI4ODM0MjI0MDM1MTAyNDQ6MDow",
        "operation": "getAll",
        "additionalFields": {
          "dueMax": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Due_Max', ``, 'string') }}",
          "dueMin": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Due_Min', ``, 'string') }}"
        }
      },
      "credentials": {
        "googleTasksOAuth2Api": {
          "id": "hJ9f755XneSNJLtO",
          "name": "Google Tasks account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "82bed5ea-6807-42db-a0ac-3fa25fc163e5",
      "name": "图像创建",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        1120,
        32
      ],
      "parameters": {
        "url": "https://n8n.iniyavan.space/webhook/92db4287-145c-4ae7-9931-ab57b4ecbe67",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "user message:",
              "value": "={{ $('WhatsApp Trigger').item.json.messages[0].text.body }}"
            }
          ]
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "2da1edbd-f7a7-484a-86a7-6499bacfd439",
      "name": "Brave Search",
      "type": "@brave/n8n-nodes-brave-search.braveSearchTool",
      "position": [
        1520,
        896
      ],
      "parameters": {
        "count": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Count', ``, 'number') }}",
        "query": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Query', ``, 'string') }}"
      },
      "credentials": {
        "braveSearchApi": {
          "id": "Ci2Q73sI6Qc28ybm",
          "name": "Brave Search account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "68a9d8d1-7e31-4d97-a2db-6adf8950adb3",
      "name": "Brave Search1",
      "type": "@brave/n8n-nodes-brave-search.braveSearchTool",
      "position": [
        1648,
        896
      ],
      "parameters": {
        "count": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Count', ``, 'number') }}",
        "query": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Query', ``, 'string') }}",
        "operation": "news"
      },
      "credentials": {
        "braveSearchApi": {
          "id": "Ci2Q73sI6Qc28ybm",
          "name": "Brave Search account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "455f2427-d9db-4936-849e-5afc3b05cc85",
      "name": "gpt-4.1-nanoChat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        960,
        880
      ],
      "parameters": {
        "model": "openai/gpt-5-nano",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "IigODthJcG8e4fv8",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5e3b3446-88b2-4eb5-a853-e61169ac9bcd",
      "name": "研究代理",
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "position": [
        1168,
        704
      ],
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Prompt__User_Message_', ``, 'string') }}",
        "options": {
          "systemMessage": "={\n  \"overview\": \"You are a web research assistant. Your responsibilities include conducting quick web searches, performing deeper research, and retrieving current weather information.\",\n  \"rules\": {\n    \"query_gap\": \"Ensure there is at least a 1 second delay between any queries sent to Brave Web and Brave News.\"\n  },\n  \"capabilities\": {\n    \"web_search_and_research\": {\n      \"wikipedia\": \"Use for quick factual lookups, background context, or verifying specific details.\",\n      \"perplexcia\": \"Use for deeper research requiring multiple perspectives, synthesis across sources, or long-form reasoning.\",\n      \"tavily\": \"Use for structured, concise, API-driven search results that directly answer the query.\",\n      \"brave\": {\n        \"description\": \"Use Brave Search for independent, real-time web searches and discovery of current content.\",\n        \"strengths\": [\n          \"Unbiased results from its own index (not Google/Bing).\",\n          \"Ideal for breaking news, time-sensitive events, and recent developments.\",\n          \"Useful for competitive analysis, market research, and trend monitoring.\",\n          \"Supports web, news, images, and video categories.\"\n        ],\n        \"tools\": {\n          \"brave_web\": \"Use for broad and real-time web searches.\",\n          \"brave_news\": \"Use specifically for fresh news, breaking updates, and trending topics.\"\n        }\n      }\n    },\n    \"weather_information\": {\n      \"open_weather_map\": \"Retrieve current weather data including temperature, conditions, and forecasts for a given location.\"\n    }\n  },\n  \"execution_order\": {\n    \"factual_or_background\": [\n      \"wikipedia\",\n      \"tavily\",\n      \"perplexcia\"\n    ],\n    \"recent_or_time_sensitive\": [\n      \"brave_news\",\n      \"brave_web\",\n      \"tavily\"\n    ],\n    \"deep_research\": [\n      \"perplexcia\",\n      \"tavily\",\n      \"brave_web\"\n    ],\n    \"weather_queries\": [\n      \"open_weather_map\"\n    ],\n    \"notes\": [\n      \"Always prefer Wikipedia first for simple factual queries.\",\n      \"For breaking news, start with Brave News, then Brave Web if more coverage is needed.\",\n      \"For broader search, Brave Web is prioritized before Tavily.\",\n      \"Use Perplexcia last unless deep reasoning or synthesis is required.\",\n      \"Always enforce a 1 second gap when using Brave Web and Brave News together.\"\n    ]\n  }\n}\n"
        },
        "needsFallback": true
      },
      "executeOnce": true,
      "typeVersion": 2.2
    },
    {
      "id": "65f6dbf8-207e-4460-9d42-04412f4afd57",
      "name": "perprlexcia",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        1104,
        896
      ],
      "parameters": {
        "url": "http://selfhosted perplexicia link/api/search",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "query",
              "value": "={{ $fromAI('parameters0_Value', ``, 'string') }}"
            },
            {
              "name": "focusMode",
              "value": "webSearch"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "executeOnce": false,
      "typeVersion": 4.2
    },
    {
      "id": "dc2bd811-0c98-488f-9e41-95b882367030",
      "name": "维基百科",
      "type": "@n8n/n8n-nodes-langchain.toolWikipedia",
      "position": [
        1232,
        896
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c14c9d29-7c6d-4459-bd6f-d251b66328cf",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -976,
        -496
      ],
      "parameters": {
        "color": 4,
        "width": 2768,
        "height": 1552,
        "content": "## 主工作流:监听 WhatsApp 消息并将任务委派给相应 AI 代理或工具的核心引擎。"
      },
      "typeVersion": 1
    },
    {
      "id": "653a955e-4b6f-485d-b366-d3ab3c32210d",
      "name": "默认数据加载器",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        928,
        1472
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "483c6a74-46cb-4597-8b60-e42acb71106e",
      "name": "提取记忆信息",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -16,
        1248
      ],
      "parameters": {
        "text": "=Analyze the following conversation turn. Your goal is to extract any new, important, and non-obvious information that should be remembered for future conversations. This includes personal facts, preferences, goals, or key context.\n\n--- CONVERSATION TURN ---\nUser's Message:{{ $json.body['User\\'s Message'] }}\n\nAssistant's Response:{{ $json.body['Assistant\\'s Response'] }}\n\n--- END OF TURN ---\n\nIf there is significant information worth remembering, provide a concise, third-person summary of that information (e.g., \"The user's favorite color is blue.\").\n\nIf there is nothing new or important to remember, you MUST return the single word: nothing",
        "batching": {},
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "14bf21ee-f158-4e1f-a703-b24483f7a798",
      "name": "检查是否值得记住",
      "type": "n8n-nodes-base.if",
      "position": [
        336,
        1248
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.text.toLowerCase() }}",
              "value2": "nothing",
              "operation": "notEqual"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "26687cab-4c9c-49a7-822a-c129e99a78cd",
      "name": "编辑字段1",
      "type": "n8n-nodes-base.set",
      "position": [
        560,
        1248
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "5e434ab2-be7f-492a-bee1-8dfe8caf674a",
              "name": "timestamp",
              "type": "string",
              "value": "={{ $now }}"
            },
            {
              "id": "26cb2b49-ade5-4d9b-bbfd-598afd4847ad",
              "name": "userID",
              "type": "string",
              "value": "=582202219"
            },
            {
              "id": "4d570a8c-33f5-4f99-ab1b-77adadcce89a",
              "name": "info",
              "type": "string",
              "value": "={{ $json.text }}"
            },
            {
              "id": "a24cb0ae-b069-4962-80e9-02eec77b90f6",
              "name": "user_message",
              "type": "string",
              "value": "={{ $('Webhook2').item.json.body[\"User's Message\"] }}"
            },
            {
              "id": "3901d073-46e5-4490-878a-5d48fcc857e7",
              "name": "assistant_response",
              "type": "string",
              "value": "={{ $('Webhook2').item.json.body[\"Assistant's Response\"] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "17921c4e-2f85-45cb-a9a2-87cf3102c8ce",
      "name": "Google Gemini 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        64,
        1472
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "3Hcwnd3kUzFUj7kB",
          "name": "telegram"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e338e874-e82c-4e96-a44e-dc5e75bafce3",
      "name": "Webhook2",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -240,
        1248
      ],
      "webhookId": "a0299e2f-a81b-48e0-a912-d9749ecf1820",
      "parameters": {
        "path": "a0299e2f-a81b-48e0-a912-d9749ecf1820",
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "80ce8220-3ba0-44d5-82e1-cdc0c2f995f3",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        1152
      ],
      "parameters": {
        "color": 4,
        "width": 2128,
        "height": 592,
        "content": "## 记忆 Webhook:一个专用工作流,用于处理对话历史记录、提取关键信息并将其存储在向量数据库中实现长期记忆。"
      },
      "typeVersion": 1
    },
    {
      "id": "a025ca0b-87c3-41e0-b6c1-1605c486c0bc",
      "name": "Webhook3",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -592,
        1920
      ],
      "webhookId": "92db4287-145c-4ae7-9931-ab57b4ecbe67",
      "parameters": {
        "path": "92db4287-145c-4ae7-9931-ab57b4ecbe67",
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "0e9c89e7-9ee9-464b-a6ac-fc757bdd2ebd",
      "name": "编辑字段5",
      "type": "n8n-nodes-base.set",
      "position": [
        448,
        1936
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "8ee5a866-7fe1-45be-8e1a-60a13ee3fbf8",
              "name": "base64",
              "type": "string",
              "value": "={{ $json.data[0].b64_json }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "650587b4-e984-457c-9419-016529e05034",
      "name": "转换为文件",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        672,
        1936
      ],
      "parameters": {
        "options": {},
        "operation": "toBinary",
        "sourceProperty": "base64"
      },
      "typeVersion": 1.1
    },
    {
      "id": "25a7325a-3d78-477d-aed6-1922a9758964",
      "name": "HTTP 请求",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        224,
        1936
      ],
      "parameters": {
        "url": "https://api.together.xyz/v1/images/generations",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"black-forest-labs/FLUX.1-schnell\",\n  \"prompt\": \"{{ $json.cleanedPrompt }}\",\n  \"width\": 1024,\n  \"height\": 768,\n  \"steps\": 4,\n  \"n\": 1,\n  \"response_format\": \"b64_json\",\n  \"stop\": []\n} ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "OY49PqkI6WcgGgEE",
          "name": "Header Auth account 2"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "1db6b6a3-0715-4545-b9ce-ef49e484323d",
      "name": "清理提示文本1",
      "type": "n8n-nodes-base.code",
      "position": [
        0,
        1936
      ],
      "parameters": {
        "jsCode": "let input = $input.first().json.output || '';\n\nconsole.log('Original input:', input);\n\n// Remove ALL quotes (both single and double)\nlet cleanedInput = input.replace(/['\"]+/g, '');\n\n// Clean whitespace (replace multiple spaces with single space)\ncleanedInput = cleanedInput.replace(/\\s+/g, ' ').trim();\n\nconsole.log('Final cleaned input:', cleanedInput);\n\n// Return cleaned prompt\nreturn { cleanedPrompt: cleanedInput };"
      },
      "typeVersion": 2
    },
    {
      "id": "70fea3dd-1d12-4549-9fcb-b221fa90e9dd",
      "name": "总结聊天",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1120,
        1936
      ],
      "parameters": {
        "text": "=Summarize the following exchange in 1 human-readable sentence.\nNote the conversation may in tamil,engilsh or Both (Thunglish). User is male and it always one-to-one convo.\nUSER:{{ $('Webhook3').item.json.body['user message:'] }}\nASSISTANT: {{ $('AI Agent').item.json.output }}\n\nWrite a warm, human-style summary.\nIf the message is trivial or small talk, just return: nothing.\n\n",
        "batching": {},
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "866d2679-1701-44d3-a287-587ee7e55594",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        1840
      ],
      "parameters": {
        "color": 4,
        "width": 2128,
        "height": 656,
        "content": "## 图像生成 Webhook:当用户请求创建图像时触发的专用工作流,处理请求,使用外部 API 生成图像,并将其发送回用户。"
      },
      "typeVersion": 1
    },
    {
      "id": "be62742c-4f35-4c22-b325-6f922375700f",
      "name": "Google Gemini 聊天模型5",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        320,
        2320
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash-lite"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "jGUHLjNGbLYvrqty",
          "name": "Google Gemini(PaLM) Api account 2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e5f68156-d7e4-424c-ac52-2f0c7e3406eb",
      "name": "发送消息3",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        896,
        1936
      ],
      "webhookId": "4c5b3e09-2439-4411-9126-84710396b63e",
      "parameters": {
        "mediaPath": "useMedian8n",
        "operation": "send",
        "messageType": "image",
        "phoneNumberId": "=",
        "additionalFields": {},
        "recipientPhoneNumber": "="
      },
      "credentials": {
        "whatsAppApi": {
          "id": "hQh3jjxZKpejhBHZ",
          "name": "WhatsApp account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "201f19c6-b148-45dc-926e-c562ff63c485",
      "name": "MongoDB Atlas Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas",
      "position": [
        784,
        1248
      ],
      "parameters": {
        "mode": "insert",
        "options": {},
        "metadata_field": "=info",
        "mongoCollection": {
          "__rl": true,
          "mode": "list",
          "value": "document",
          "cachedResultName": "document"
        },
        "vectorIndexName": "default"
      },
      "credentials": {
        "mongoDb": {
          "id": "68YcCVKfDKnwNcDo",
          "name": "MongoDB account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "063b74a7-89f8-479b-88c4-0a4d6fc1e3ca",
      "name": "MongoDB Atlas Vector Store1",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas",
      "position": [
        -32,
        2176
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "topK": 5,
        "options": {},
        "metadata_field": " info, text, summary",
        "mongoCollection": {
          "__rl": true,
          "mode": "list",
          "value": "document",
          "cachedResultName": "document"
        },
        "toolDescription": "use this tool as memory node for the Ai agent ",
        "vectorIndexName": "default"
      },
      "credentials": {
        "mongoDb": {
          "id": "68YcCVKfDKnwNcDo",
          "name": "MongoDB account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "9429d89e-2dfa-4ba1-9364-54f256612749",
      "name": "gpt-4.1-nano",
      "type": "@n8n/n8n-nodes-langchain.lmChatVercelAiGateway",
      "position": [
        -480,
        2144
      ],
      "parameters": {
        "model": "openai/gpt-4o-mini",
        "options": {}
      },
      "credentials": {
        "vercelAiGatewayApi": {
          "id": "Hz12LiIsMaKH88LB",
          "name": "n8n testing August 22"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "af220466-31a3-40c8-9ffc-d26e6d3546c5",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -336,
        1936
      ],
      "parameters": {
        "text": "=You are AI assistant specializing in image creation.\n\nIMPORTANT:\nAlways use the MongoDB Atlas Vector Store tool to retrieve the most relevant memory based on the \nuser’s message.\nFirst, search the vector store for the latest summarized conversation or any related past memory.\nIf the memory node returns no data, use the tool node again to attempt retrieval.\nIf no relevant memory is found after retrying, proceed without additional context.\n\nUSER'S LATEST MESSAGE:{{ $json.body['user message:'] }}\nBased on the above conversation context, generate a detailed image generation prompt that best fulfills the user's request.  The prompt should be suitable for a state-of-the-art image generation model (e.g., DALL-E 3, Midjourney).\n\nThe generated prompt should include:\n\n*   A clear description of the subject matter.\n*   The desired style and artistic medium (e.g., photorealistic, painting, cartoon, sketch).\n*   Specific details regarding lighting, color palette, composition, and perspective.\n*   Any relevant artistic influences or references.\n\n\nOutput the image generation prompt only, without any introductory or conversational text. For example:  A photorealistic image of a majestic lion roaring on a mountaintop at sunset, with warm golden lighting and vibrant colors.",
        "options": {
          "systemMessage": "If user asked about his details use the tool to get his deatils"
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "b8e315f0-df6d-45f7-bf62-9024ac54e064",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -928,
        -304
      ],
      "parameters": {
        "color": 7,
        "width": 1328,
        "height": 480,
        "content": "## WhatsApp 触发器与下载媒体文件"
      },
      "typeVersion": 1
    },
    {
      "id": "27d99798-e05e-49e3-b607-a4ff58acb3c7",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        -320
      ],
      "parameters": {
        "color": 5,
        "width": 1168,
        "height": 512,
        "content": "## 核心 AI 代理"
      },
      "typeVersion": 1
    },
    {
      "id": "07289c78-16ec-4920-b658-37c61baa77a0",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -928,
        192
      ],
      "parameters": {
        "width": 1664,
        "height": 848,
        "content": "## 生产力工具代理"
      },
      "typeVersion": 1
    },
    {
      "id": "7a667675-89b6-48c3-a561-1d4c1d1f8e08",
      "name": "便签 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        192
      ],
      "parameters": {
        "color": 6,
        "width": 432,
        "height": 304,
        "content": "## 记忆"
      },
      "typeVersion": 1
    },
    {
      "id": "dae372fa-d531-42aa-a380-17b48e5ee9f0",
      "name": "codestral-embed-2505",
      "type": "@n8n/n8n-nodes-langchain.embeddingsMistralCloud",
      "position": [
        656,
        368
      ],
      "parameters": {
        "model": "=codestral-embed-2505",
        "options": {}
      },
      "credentials": {
        "mistralCloudApi": {
          "id": "WePlg7cDsdPGleuj",
          "name": "Mistral Cloud account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8bebd01d-5b2f-4403-8d46-384eb2aad1a2",
      "name": "codestral-embed-",
      "type": "@n8n/n8n-nodes-langchain.embeddingsMistralCloud",
      "position": [
        800,
        1472
      ],
      "parameters": {
        "model": "=codestral-embed-2505",
        "options": {}
      },
      "credentials": {
        "mistralCloudApi": {
          "id": "WePlg7cDsdPGleuj",
          "name": "Mistral Cloud account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a3481a80-f0bd-423e-a7b6-51d4bfe0e03e",
      "name": "codestral-embed-2506",
      "type": "@n8n/n8n-nodes-langchain.embeddingsMistralCloud",
      "position": [
        96,
        2352
      ],
      "parameters": {
        "model": "=codestral-embed-2505",
        "options": {}
      },
      "credentials": {
        "mistralCloudApi": {
          "id": "WePlg7cDsdPGleuj",
          "name": "Mistral Cloud account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b6377197-bec2-417a-939e-1aa6c50df842",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        784,
        512
      ],
      "parameters": {
        "width": 976,
        "height": 512,
        "content": "## 研究工具代理"
      },
      "typeVersion": 1
    },
    {
      "id": "a8d68692-2753-4d79-a6b7-9dd11214c7e2",
      "name": "openai LLM",
      "type": "@n8n/n8n-nodes-langchain.lmChatVercelAiGateway",
      "position": [
        448,
        32
      ],
      "parameters": {
        "model": "=openai/gpt-oss-120b",
        "options": {}
      },
      "credentials": {
        "vercelAiGatewayApi": {
          "id": "Hz12LiIsMaKH88LB",
          "name": "n8n testing August 22"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "03ff077e-7c99-4aea-b731-ecaca82c9fbd",
      "name": "openai LLM1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        608,
        32
      ],
      "parameters": {
        "model": "=openai/gpt-oss-120b",
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "id": "gJcGdGZFDhE4WiEg",
          "name": "Groq account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8f6697d6-6f46-4adf-956a-1319e1f1cd5e",
      "name": "openai/gpt-oss-120b",
      "type": "@n8n/n8n-nodes-langchain.lmChatVercelAiGateway",
      "position": [
        816,
        912
      ],
      "parameters": {
        "model": "=openai/gpt-oss-120b",
        "options": {}
      },
      "credentials": {
        "vercelAiGatewayApi": {
          "id": "Hz12LiIsMaKH88LB",
          "name": "n8n testing August 22"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "30118025-a9c1-44d4-9e21-34bbc724d0eb",
      "name": "Tavily web search",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        1376,
        896
      ],
      "parameters": {
        "url": "https://api.tavily.com/search",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "query",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', ``, 'string') }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "Bearer \"your API Key\""
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "7d4a6069-1ec3-44cd-8993-35d61bedf1a3",
      "name": "openai/gpt-5-mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatVercelAiGateway",
      "position": [
        -720,
        864
      ],
      "parameters": {
        "model": "=openai/gpt-5-mini",
        "options": {}
      },
      "credentials": {
        "vercelAiGatewayApi": {
          "id": "Hz12LiIsMaKH88LB",
          "name": "n8n testing August 22"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2a6d1bbd-1b48-451a-a5f8-b647c545c924",
      "name": "openai/gpt-5-mini1",
      "type": "@n8n/n8n-nodes-langchain.lmChatVercelAiGateway",
      "position": [
        -768,
        576
      ],
      "parameters": {
        "model": "=openai/gpt-5-mini",
        "options": {}
      },
      "credentials": {
        "vercelAiGatewayApi": {
          "id": "Hz12LiIsMaKH88LB",
          "name": "n8n testing August 22"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5e853092-1a3c-4588-a854-1595f8023f64",
      "name": "发送消息",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        1184,
        -192
      ],
      "webhookId": "4c5b3e09-2439-4411-9126-84710396b63e",
      "parameters": {
        "mediaPath": "useMedian8n",
        "operation": "send",
        "messageType": "image",
        "phoneNumberId": "=",
        "additionalFields": {},
        "recipientPhoneNumber": "="
      },
      "credentials": {
        "whatsAppApi": {
          "id": "hQh3jjxZKpejhBHZ",
          "name": "WhatsApp account"
        }
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Code1": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Think": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Download media",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Typing....",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Clean Prompt Text1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook2": {
      "main": [
        [
          {
            "node": "Extract Memory Info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook3": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "Send message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wikipedia": {
      "ai_tool": [
        [
          {
            "node": "Research agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Gmail tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Task agent": {
      "ai_tool": [
        [
          {
            "node": "Calendar Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Typing....": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WeatherMap": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "gpt-5-nano": {
      "ai_languageModel": [
        [
          {
            "node": "Gmail tool",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "openai LLM": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "openai LLM1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "perprlexcia": {
      "ai_tool": [
        [
          {
            "node": "Research agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Brave Search": {
      "ai_tool": [
        [
          {
            "node": "Research agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "MongoDB Atlas Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields5": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get an event": {
      "ai_tool": [
        [
          {
            "node": "Calendar Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Edit Fields5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send message": {
      "main": [
        [
          {
            "node": "send chat history to MongoDB",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "gpt-4.1-nano": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Analyze image": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Brave Search1": {
      "ai_tool": [
        [
          {
            "node": "Research agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get a message": {
      "ai_tool": [
        [
          {
            "node": "Gmail tool",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request5": {
      "main": [
        [
          {
            "node": "Analyze image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send message3": {
      "main": [
        [
          {
            "node": "Summarize Chat",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Calendar Agent": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Download media": {
      "main": [
        [
          {
            "node": "HTTP Request5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Research agent": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Summarize Chat": {
      "main": [
        [
          {
            "node": "MongoDB Atlas Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "image creation": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Send message3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create an event": {
      "ai_tool": [
        [
          {
            "node": "Calendar Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Delete an event": {
      "ai_tool": [
        [
          {
            "node": "Calendar Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get many events": {
      "ai_tool": [
        [
          {
            "node": "Calendar Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Update an event": {
      "ai_tool": [
        [
          {
            "node": "Calendar Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "WhatsApp Trigger": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "codestral-embed-": {
      "ai_embedding": [
        [
          {
            "node": "MongoDB Atlas Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "gemini-2.5-flash": {
      "ai_languageModel": [
        [
          {
            "node": "Gmail tool",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get many messages": {
      "ai_tool": [
        [
          {
            "node": "Gmail tool",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Tavily web search": {
      "ai_tool": [
        [
          {
            "node": "Research agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "openai/gpt-5-mini": {
      "ai_languageModel": [
        [
          {
            "node": "Task agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Clean Prompt Text1": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "openai/gpt-5-mini1": {
      "ai_languageModel": [
        [
          {
            "node": "Calendar Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "MongoDB Atlas Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Extract Memory Info": {
      "main": [
        [
          {
            "node": "Check If Worth Remembering",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "openai/gpt-oss-120b": {
      "ai_languageModel": [
        [
          {
            "node": "Research agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "codestral-embed-2505": {
      "ai_embedding": [
        [
          {
            "node": "MongoDB Atlas Vector Store2",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "codestral-embed-2506": {
      "ai_embedding": [
        [
          {
            "node": "MongoDB Atlas Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "gpt-4.1-nanoChat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Research agent",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Extract Memory Info",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model5": {
      "ai_languageModel": [
        [
          {
            "node": "Summarize Chat",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Check If Worth Remembering": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MongoDB Atlas Vector Store1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "MongoDB Atlas Vector Store2": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create a task in Google Tasks": {
      "ai_tool": [
        [
          {
            "node": "Task agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Delete a task in Google Tasks": {
      "ai_tool": [
        [
          {
            "node": "Task agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get many tasks in Google Tasks": {
      "ai_tool": [
        [
          {
            "node": "Task agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - AI 聊天机器人, 多模态 AI

需要付费吗?

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

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

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

作者
Iniyavan JC

Iniyavan JC

@netwithjc

🚀 Automation expert & AI enthusiast. I build custom n8n workflows, AI agents, API integrations, and smart automations using LLMs, databases, cloud tools & more. Skilled in Docker, MongoDB, Google Sheets, ACRCloud, and building fast, context-aware agents. Let's turn your idea into a powerful workflow!

外部链接
在 n8n.io 查看

分享此工作流