AutomationFlowsAI & RAG › AI Agent Sends Tweet Email via Webhook

AI Agent Sends Tweet Email via Webhook

Original n8n title: 自动发送推文邮件

自动发送推文邮件. Uses mcpClientTool, agent, lmChatDeepSeek, httpRequest. Webhook trigger; 23 nodes.

Webhook trigger★★★★☆ complexityAI-powered23 nodesMcp Client ToolAgentLm Chat Deep SeekHTTP RequestEmail Send
AI & RAG Trigger: Webhook Nodes: 23 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → Emailsend recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "\u81ea\u52a8\u53d1\u9001\u63a8\u6587\u90ae\u4ef6",
  "nodes": [
    {
      "parameters": {
        "sseEndpoint": "http://150.158.176.172:20005/sse"
      },
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "typeVersion": 1,
      "position": [
        700,
        300
      ],
      "id": "d5d7b2ba-34a5-44ef-b049-9cb865a595d8",
      "name": "MCP Client",
      "disabled": true
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=1\u3001\u7ffb\u8bd1\u8fd9\u6761\u6d88\u606f {{ $('Code1').item.json.full_text }}  \u7136\u540e\u6309\u5982\u4e0b\u683c\u5f0f\u5c55\u793a\n2\u3001Analyze the following tweet and its selected replies. I'm an active stock trader. Assess how this content could impact the stock market or broader economy. Highlight potential signals, sentiment, or sectors affected. Be specific.\u5206\u6790\u7ed3\u679c\u4e0d\u8d85\u8fc7200\u5b57\uff0c\u7136\u540e\u5185\u5bb9\u653e\u5728AI\u5206\u6790\u7ed3\u679c\u680f\uff0c\u9700\u8981\u5206\u6790\u7684\u5185\u5bb9\uff1a{{ $json.tweetTexts }}\n3\u3001\u5c06\u4e4b\u524d\u7684\u7ed3\u679c\u6309\u7167\u5982\u4e0b\u683c\u5f0f\u5c55\u793a\uff0c\u4e0d\u9700\u8981\u5176\u5b83\u65e0\u5173\u8a00\u8bed\uff0c\u56de\u590d\u5185\u5bb9\u7528\u4e2d\u6587\u56de\u590d\u3002\n\n#|%\u539f\u6587\uff1a\u539f\u6587\n#|%\u4e2d\u6587\uff1a\u7ffb\u8bd1\u540e\u7684\u5185\u5bb9\n#|%\u539f\u6587\u8fde\u63a5\uff1ahttps://x.com/{{ $json.user.screenName }}/status/{{ $json.id }}\n#|%AI\u5206\u6790: \u5206\u6790\u7ed3\u679c\n",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.9,
      "position": [
        540,
        60
      ],
      "id": "f68d9858-2f78-4a37-94d5-5120d3400d51",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek",
      "typeVersion": 1,
      "position": [
        540,
        280
      ],
      "id": "2bb870ac-e3cc-45a1-bc28-014f47eb053b",
      "name": "DeepSeek Chat Model",
      "credentials": {
        "deepSeekApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "url": "https://api.weixin.qq.com/cgi-bin/token",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "grant_type",
              "value": "client_credential"
            },
            {
              "name": "appid",
              "value": "wx558c5486648c5c45"
            },
            {
              "name": "secret",
              "value": "f8a5e2e16db00da17da11546322b587e"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        0,
        240
      ],
      "id": "9a3f7cca-24a5-4862-86be-2423fa4e0b10",
      "name": "HTTP Request",
      "disabled": true
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.weixin.qq.com/cgi-bin/message/template/send",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "access_token",
              "value": "={{ $('HTTP Request').item.json.access_token }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n    \"touser\": \"{{ $json.data.openid[$runIndex] }}\",\n    \"template_id\": \"HOLlkQXz7-fXYAdCmRrY50Ar6B2_BuGI2lnsYNhiA_s\",\n    \"url\": \"{{ $('Webhook').item.json.body.text }}\",\n    \"data\":{\n        \"ori\": {\n            \"value\": \"{{ $('Code').item.json.ori }}\",\n            \"color\": \"#17B26A\"\n        },\n        \"zh\": {\n            \"value\": \"{{ $('Code').item.json.zh }}\",\n            \"color\": \"#17B26A\"\n        },\n        \"url\": {\n            \"value\": \"{{ $('Code').item.json.other }}\",\n            \"color\": \"#17B26A\"\n        }\n    }\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1380,
        320
      ],
      "id": "8236f16e-d1d6-493a-9a8d-ae961a0693d8",
      "name": "HTTP Request1",
      "disabled": true
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "2f8209da-8332-40e0-9409-54843e0e8dbf",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        20,
        60
      ],
      "id": "36226808-fe7b-4cc3-b1d8-985950d34904",
      "name": "Webhook"
    },
    {
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nvar input = $input.first().json.output.replace(/\\n/g, \"\");\nvar ori = input.split('#|%')[1].trim()\nvar zh = input.split('#|%')[2].trim()\nvar other = input.split('#|%')[3].trim()\nvar ai = input.split('#|%')[4].trim()\n// var emails= ['a13790903420@outlook.com']\nvar emails= ['a13790903420@outlook.com','2332084024@qq.com']\nreturn {\n  ori,\n  zh,\n  other,\n  emails,\n  ai\n}"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1060,
        60
      ],
      "id": "2508a90d-5fd1-42e0-8ce2-942b76b90a90",
      "name": "Code"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "c4167fdc-e9e5-43af-ba7a-26d14a8adb20",
              "leftValue": "={{ $json.full_text }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "or"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1700,
        780
      ],
      "id": "96b58263-d5eb-40c2-a580-0feb33f18c18",
      "name": "If"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek",
      "typeVersion": 1,
      "position": [
        2020,
        980
      ],
      "id": "e2437d6a-b3f4-4ce4-a70e-be8dee638668",
      "name": "DeepSeek Chat Model1",
      "credentials": {
        "deepSeekApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=\u4e0d\u4f5c\u4fee\u6539\u8fd4\u56de\u7ed9\u6211\u4ee5\u4e0b\u5185\u5bb9\n\n#|%\u539f\u6587\uff1a\u63a8\u6587\u4e3a\u56fe\u7247\u6216\u8005\u89c6\u9891\n#|%\u4e2d\u6587\uff1a\u63a8\u6587\u4e3a\u56fe\u7247\u6216\u8005\u89c6\u9891\n#|%\u539f\u6587\u8fde\u63a5\uff1ahttps://x.com/{{ $json.user.screenName }}/status/{{ $json.id }}\n",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.9,
      "position": [
        1960,
        800
      ],
      "id": "41e2f002-7b48-46cc-b4b4-83b276c8303d",
      "name": "AI Agent1"
    },
    {
      "parameters": {
        "url": "https://api.weixin.qq.com/cgi-bin/user/get",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "access_token",
              "value": "={{ $('HTTP Request').item.json.access_token }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1060,
        300
      ],
      "id": "4e8d5fcf-73c3-449e-8fb2-5224cf28e12b",
      "name": "HTTP Request2",
      "disabled": true
    },
    {
      "parameters": {
        "batchSize": "=1",
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        1740,
        80
      ],
      "id": "ece716dd-d7ec-4b6c-be13-331f7a3b4085",
      "name": "Loop Over Items",
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "fromEmail": "ilpvcx@qq.com",
        "toEmail": "={{ $('Code2').item.json.addr }}",
        "subject": "\u7279\u6717\u666e\u65b0\u63a8\u6587\u901a\u77e5",
        "html": "=<html>\n    <head>\n        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n        <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n        <title>\u63a8\u6587\u5185\u5bb9</title>\n        <style>\n            type=\"text/css\"\n            /* \u5185\u8054\u6837\u5f0f\u786e\u4fdd\u90ae\u4ef6\u5ba2\u6237\u7aef\u517c\u5bb9 */\n            body {\n                font-family: Arial, Helvetica, sans-serif;\n                line-height: 1.4;\n                color: #333333;\n                margin: 0;\n                padding: 0;\n                -webkit-text-size-adjust: 100%;\n                -ms-text-size-adjust: 100%;\n            }\n\n            .email-container {\n                max-width: 600px;\n                margin: 0 auto;\n                padding: 15px;\n            }\n\n            .tweet-card {\n                border: 1px solid #e1e8ed;\n                border-radius: 12px;\n                overflow: hidden;\n                background-color: #ffffff;\n            }\n\n            .tweet-header {\n                padding: 12px;\n                border-bottom: 1px solid #e1e8ed;\n            }\n\n            .avatar {\n                width: 48px;\n                height: 48px;\n                border-radius: 50%;\n                display: inline-block;\n                vertical-align: middle;\n                border: 2px solid #1da1f2;\n            }\n\n            .user-info {\n                display: inline-block;\n                vertical-align: middle;\n                margin-left: 10px;\n            }\n\n            .username {\n                font-weight: bold;\n                font-size: 16px;\n                margin: 0;\n                color: #14171a;\n            }\n\n            .handle {\n                font-size: 14px;\n                color: #657786;\n                margin: 2px 0 0;\n            }\n\n            .tweet-content {\n                padding: 12px;\n                font-size: 16px;\n                word-wrap: break-word;\n            }\n\n            .media-container {\n                margin-top: 10px;\n                border-radius: 8px;\n                overflow: hidden;\n                line-height: 0; /* \u4fee\u590d\u90ae\u4ef6\u5ba2\u6237\u7aef\u56fe\u7247\u4e0b\u65b9\u95f4\u9699 */\n            }\n\n            .media-image {\n                max-width: 100%;\n                height: auto;\n                display: block;\n            }\n\n            .tweet-footer {\n                padding: 12px;\n                font-size: 14px;\n                color: #657786;\n                border-top: 1px solid #e1e8ed;\n            }\n\n            /* \u54cd\u5e94\u5f0f\u8c03\u6574 */\n            @media screen and(max-width: 480px) {\n                .email-container {\n                    padding: 10px;\n                }\n                .avatar {\n                    width: 40px;\n                    height: 40px;\n                }\n                .tweet-content {\n                    font-size: 15px;\n                }\n            }\n        </style>\n    </head>\n    <body>\n        <div class=\"email-container\">\n            <div class=\"tweet-card\">\n                <div class=\"tweet-header\">\n                    <img src=\"https://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png\" class=\"avatar\" alt=\"\u7528\u6237\u5934\u50cf\">\n                    <div class=\"user-info\">\n                        <p class=\"username\">{{ $('Code1').item.json.user.name }}</p>\n                        <p class=\"handle\">@{{ $('Code1').item.json.user.screenName }}</p>\n                    </div>\n                </div>\n\n                <div\n                    class=\"tweet-content\">\n                    <!-- \u8fd9\u91cc\u662f\u63a8\u6587\u6587\u672c\u5185\u5bb9 -->\n                    <p>\n                        {{ $('Code').item.json.ori }}\n                    </p>\n                    <p>\n                        {{ $('Code').item.json.zh }}\n                    </p>\n\n                    <!-- \u5a92\u4f53\u5185\u5bb9 - \u56fe\u7247\u6216\u89c6\u9891 -->\n                    <div class=\"media-container\">\n                        <img src=\"{{ $('Code1').item.json.images }}\" class=\"media-image\" alt=\"\u63a8\u6587\u56fe\u7247\">\n\n                        <div style=\"background-color: #000; text-align: center; padding: 20px 0;\">\n                            <span style=\"color: white;\">[\u89c6\u9891\u5185\u5bb9]</span>\n                        </div>\n\n                    </div>\n\n                </div>\n\n                <div\n                    class=\"tweet-footer\">\n                    <!-- \u8fd9\u91cc\u53ef\u4ee5\u6dfb\u52a0\u65f6\u95f4\u3001\u4e92\u52a8\u6570\u636e\u7b49 -->\n                    <span>{{ $('Code1').item.json.formatted }}</span>\n                </div>\n            </div>\n            <div style=\"margin-top: 10px;\">\n                \u539f\u5730\u5740\uff1a<a href=\"https://x.com/{{ $('Code1').item.json.user.screenName }}/status/{{ $('Code1').item.json.id }}\">https://x.com/{{ $('Code1').item.json.user.screenName }}/status/{{ $('Code1').item.json.id }}</a>\n            </div>\n\n            <!-- AI\u5206\u6790\u680f\u76ee -->\n            <div class=\"tweet-card\" style=\"margin-top: 20px;\">\n                <div class=\"tweet-header\">\n                    <div style=\"font-weight: bold; color: #1da1f2;\">AI\u5206\u6790\u7ed3\u679c</div>\n                </div>\n                <div class=\"tweet-content\">\n                  {{ $('Code').item.json.ai }}\n                </div>\n            </div>\n        </div>\n    </body>\n</html>\n",
        "options": {}
      },
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        1980,
        100
      ],
      "id": "ae41051e-a9e4-4640-bfee-24a813b94561",
      "name": "Send Email",
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "let input;\ntry {\n  input = JSON.parse($input.first().json.body);\n} catch (err) {\n  throw new Error(\"\u65e0\u6548\u7684 JSON \u8f93\u5165\uff1a\" + err.message);\n}\n\nlet formatted = null;\n\ntry {\n  if (!input.createdAt) {\n    throw new Error(\"\u7f3a\u5c11 createdAt \u5b57\u6bb5\");\n  }\n\n  const date = new Date(input.createdAt);\n  if (isNaN(date.getTime())) {\n    throw new Error(\"createdAt \u4e0d\u662f\u6709\u6548\u7684\u65f6\u95f4\u683c\u5f0f\");\n  }\n\n  const formatter = new Intl.DateTimeFormat('zh-CN', {\n    year: 'numeric',\n    month: '2-digit',\n    day: '2-digit',\n    hour: 'numeric',\n    minute: '2-digit',\n    hour12: true,\n    timeZone: 'Asia/Shanghai',\n  });\n\n  formatted = formatter.format(date);\n} catch (err) {\n  formatted = `\u683c\u5f0f\u5316\u5931\u8d25: ${err.message}`;\n}\n\nif (!input.full_text && input.text) {\n  input.full_text = input.text\n  input.full_text = input.full_text.replace(/[\\r\\n]+/g, ' ');\n}\n\nfor (let i = 0; i< input.tweetTexts.length; i++) {\n  input.tweetTexts[i] = input.tweetTexts[i].replace(/[\\r\\n]+/g, ' ');\n}\n\nreturn {\n  ...input,\n  formatted\n}\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        240,
        60
      ],
      "id": "f2e271e0-159f-4bad-92f5-11915f91a77b",
      "name": "Code1"
    },
    {
      "parameters": {
        "jsCode": "var emails = [\n  {json: {addr: 'a13790903420@outlook.com'}},\n  {json: {addr: '2332084024@qq.com'}},\n  {json: {addr: '3325038475@qq.com'}}\n]\n\nvar testEmail = [\n  {json: {addr: '2332084024@qq.com'}}\n]\n// console.log(typeof $('Code1').first().json.isDev)\nif($('Code1').first().json.isDev){\n  return testEmail\n}\nreturn emails"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1280,
        60
      ],
      "id": "1f12476a-fa83-42cc-ad49-ac745e77e038",
      "name": "Code2"
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "b04e5c37-1b16-4527-a061-84dc46b05d62",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        20,
        780
      ],
      "id": "855c3e38-72f3-46ea-8845-818a51c10d9a",
      "name": "Webhook1"
    },
    {
      "parameters": {
        "fromEmail": "ilpvcx@qq.com",
        "toEmail": "2332084024@qq.com",
        "subject": "\u722c\u866b\u5b95\u673a\u901a\u77e5",
        "html": "=<html lang=\"zh-CN\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>\u3010twitter\u722c\u866b\u3011\u7a0b\u5e8f\u8fd0\u884c\u9519\u8bef\u901a\u77e5</title>\n    <style>\n        body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; max-width: 800px; margin: 0 auto; padding: 20px; }\n        .header { background-color: #e74c3c; color: white; padding: 10px 20px; border-radius: 5px 5px 0 0; }\n        .content { border: 1px solid #ddd; padding: 20px; border-radius: 0 0 5px 5px; }\n        .error-detail { background-color: #f9f9f9; padding: 15px; border-left: 4px solid #e74c3c; margin: 10px 0; }\n        .footer { margin-top: 20px; font-size: 12px; color: #777; text-align: center; }\n        .button { display: inline-block; background-color: #e74c3c; color: white; padding: 10px 15px; text-decoration: none; border-radius: 3px; }\n        /* \u65b0\u589e\u9519\u8bef\u4fe1\u606f\u6837\u5f0f */\n        #error-message {\n            white-space: pre-wrap;  /* \u4fdd\u7559\u7a7a\u683c\u4f46\u81ea\u52a8\u6362\u884c */\n            word-wrap: break-word;  /* \u957f\u5355\u8bcd\u6216URL\u5f3a\u5236\u6362\u884c */\n            overflow-x: auto;       /* \u6a2a\u5411\u6eda\u52a8\u6761\uff08\u4ec5\u5728\u5fc5\u8981\u65f6\u663e\u793a\uff09 */\n            max-width: 100%;        /* \u9650\u5236\u6700\u5927\u5bbd\u5ea6 */\n            display: block;         /* \u786e\u4fdd\u5bbd\u5ea6\u751f\u6548 */\n            padding: 10px;\n            background-color: #f0f0f0;\n            border-radius: 3px;\n            font-family: monospace; /* \u7b49\u5bbd\u5b57\u4f53\u4fdd\u6301\u5bf9\u9f50 */\n        }\n    </style>\n</head>\n<body>\n    <div class=\"header\">\n        <h1>\ud83d\udea8 \u7a0b\u5e8f\u8fd0\u884c\u9519\u8bef\u901a\u77e5</h1>\n    </div>\n    \n    <div class=\"content\">\n        <p>\u60a8\u597d\uff0c\u7cfb\u7edf\u68c0\u6d4b\u5230\u4ee5\u4e0b\u7a0b\u5e8f\u8fd0\u884c\u9519\u8bef\uff0c\u8bf7\u53ca\u65f6\u5904\u7406\uff1a</p>\n        \n        <div class=\"error-detail\">\n            <h3>\u9519\u8bef\u8be6\u60c5</h3>\n            <p><strong>\u9519\u8bef\u65f6\u95f4\uff1a</strong> <span id=\"error-time\">{{ $json.time }}</span></p>\n            <p><strong>\u8fd0\u884c\u73af\u5883\uff1a</strong> <span id=\"error-time\">{{ $json.env }}</span></p>\n            <p><strong>\u7a0b\u5e8f\u540d\u79f0\uff1a</strong> <span id=\"app-name\">thump\u722c\u866b\u670d\u52a1</span></p>\n            <p><strong>\u9519\u8bef\u4fe1\u606f\uff1a</strong></p>\n            <pre id=\"error-message\">{{ $json.error }}</pre>\n        </div>\n    </div>\n\n    <div class=\"footer\">\n        <p>\u6b64\u90ae\u4ef6\u4e3a\u7cfb\u7edf\u81ea\u52a8\u53d1\u9001\uff0c\u8bf7\u52ff\u76f4\u63a5\u56de\u590d\u3002<br>\n        \u5982\u9700\u4fee\u6539\u901a\u77e5\u8bbe\u7f6e\uff0c\u8bf7\u8bbf\u95ee <a href=\"http://your-app.com/notifications\">\u901a\u77e5\u7ba1\u7406\u4e2d\u5fc3</a></p>\n    </div>\n</body>\n</html>",
        "options": {}
      },
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        460,
        780
      ],
      "id": "5e3feb4a-af50-42c3-bc18-0212c7b28282",
      "name": "Send Email1",
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "var input = $input.first().json.body\ninput = JSON.parse(input)\n\nreturn {\n  time: input.time,\n  env: input.env,\n  error: JSON.stringify(input.error)\n}"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        240,
        780
      ],
      "id": "4b09349d-73cf-466b-82f8-68bd16fa7521",
      "name": "Code3"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "945eeac0-8ceb-4622-a90f-10dbb02e014a",
              "leftValue": "={{ $('Code1').item.json.entities.media }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1460,
        60
      ],
      "id": "8180fc9d-5002-4ac7-92eb-ad8ba3cde297",
      "name": "If1"
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "b99aaaf0-0e6f-4ee2-a4aa-303540c32a43",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        20,
        540
      ],
      "id": "a0e793f1-385f-4ab0-8bd8-4a067d590001",
      "name": "Webhook2"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "1cc9a35b-e438-4f1b-8cca-24512c3f27b7",
              "leftValue": "={{ $json.isAuth }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        460,
        540
      ],
      "id": "dcc51eb0-3713-42d1-81f0-10c4c5551fc2",
      "name": "If2"
    },
    {
      "parameters": {
        "jsCode": "const token = $input.first().json.headers.authorization.replace('Bearer ', '');\n\nlet timestamp;\ntry {\n  const decoded = Buffer.from(token, 'base64').toString('utf-8');\n  timestamp = parseInt(decoded, 10);\n  console.log(timestamp)\n} catch (e) {\n  return { isAuth: false };\n}\n\nif (isNaN(timestamp)) return { isAuth: false };\n\nconst now = Date.now();\nconst diff = Math.abs(now - timestamp); // \u5355\u4f4d\uff1a\u6beb\u79d2\n\nif (diff > 10 * 1000) {\n  return { isAuth: false };\n}\n\nconst isEmail = email => /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email);\nif (!isEmail) {\n  return { isAuth: false };\n}\n\nreturn { isAuth: true };\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        240,
        540
      ],
      "id": "0ff39c7a-d931-4ac4-a33d-95fbfd6981be",
      "name": "Code4"
    },
    {
      "parameters": {
        "fromEmail": "ilpvcx@qq.com",
        "toEmail": "=ilpvcx@163.com",
        "subject": "={{ $('Webhook2').item.json.body.subject }}",
        "emailFormat": "text",
        "text": "=\u6765\u81ea\u5f00\u53d1\u63a5\u5355\u7f51\u7ad9\u7684\u7559\u8a00\uff1a\n\u7528\u6237\u540d\uff1a{{ $('Webhook2').item.json.body.name }}\n\u7528\u6237\u90ae\u7bb1\uff1a{{ $('Webhook2').item.json.body.email }}\n\u6d88\u606f\u5185\u5bb9\uff1a{{ $('Webhook2').item.json.body.message }}",
        "options": {}
      },
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        740,
        520
      ],
      "id": "0517610e-0a36-4f23-ae95-a8cbce01e61b",
      "name": "Send Email2",
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "MCP Client": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "DeepSeek Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        []
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Code2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [],
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DeepSeek Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        []
      ]
    },
    "HTTP Request2": {
      "main": [
        []
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        []
      ]
    },
    "Send Email": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code1": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code2": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook1": {
      "main": [
        [
          {
            "node": "Code3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code3": {
      "main": [
        [
          {
            "node": "Send Email1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [],
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook2": {
      "main": [
        [
          {
            "node": "Code4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code4": {
      "main": [
        [
          {
            "node": "If2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If2": {
      "main": [
        [
          {
            "node": "Send Email2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "44ba2069-70ee-4eb2-813a-ed6428a22b25",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "TuyZVF8e36Ddtdgk",
  "tags": []
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

自动发送推文邮件. Uses mcpClientTool, agent, lmChatDeepSeek, httpRequest. Webhook trigger; 23 nodes.

Source: https://github.com/ilpvc/twitterScripy/blob/a3d4d66cac3349206da3a0418bda2cbde92f8551/n8n/2025-06-15.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

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

AI & RAG

This workflow transforms natural language queries into research reports through a five-stage AI pipeline. When triggered via webhook (typically from Google Sheets using the companion [](https://gist.g

Redis, Agent, Output Parser Structured +7
AI & RAG

This n8n workflow orchestrates a powerful suite of AI Agents and automations to manage and optimize various aspects of an e-commerce operation, particularly for platforms like Shopify. It leverages La

Google Sheets, HTTP Request, Slack +10
AI & RAG

secretaria. Uses postgres, n8n-nodes-evolution-api, openAi, httpRequest. Webhook trigger; 71 nodes.

Postgres, N8N Nodes Evolution Api, OpenAI +12
AI & RAG

f1_bot_zoom. Uses stopAndError, httpRequest, emailSend, agent. Webhook trigger; 39 nodes.

Stop And Error, HTTP Request, Email Send +3
AI & RAG

This workflow automates veterinary clinic operations and client communications for animal hospitals and veterinary practices managing appointments, inventory, and patient care. It solves the dual chal

HTTP Request, Agent, OpenAI Chat +4