优惠码搜寻器:通过SerpAPI、Gemini和Telegram自动查找优惠码

高级

这是一个Content Creation、Multimodal AI领域的自动化工作流,包含 18 个节点。主要使用 If、Set、Gmail、Webhook、Telegram 等节点。 优惠码搜寻器:通过SerpAPI、Gemini和Telegram自动查找优惠码

前置要求
  • Google 账号和 Gmail API 凭证
  • HTTP Webhook 端点(n8n 会自动生成)
  • Telegram Bot Token
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "gSKavHnaQxVY6DLe",
  "meta": {
    "instanceId": "c2650793f644091dc80fb900fe63448ad1f4b774008de9608064d67294f8307c",
    "templateCredsSetupCompleted": true
  },
  "name": "优惠码搜寻器:通过SerpAPI、Gemini和Telegram自动查找优惠码",
  "tags": [],
  "nodes": [
    {
      "id": "3c07ac00-df2b-405f-b0bd-492099eaff88",
      "name": "SerpAPI",
      "type": "@n8n/n8n-nodes-langchain.toolSerpApi",
      "position": [
        336,
        368
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "serpApi": {
          "id": "RnX2LOB0xs45mOEw",
          "name": "Login w Github"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "07d248ac-97de-49eb-8d30-c960ae6fcb8d",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        592,
        -864
      ],
      "parameters": {
        "color": 5,
        "width": 464,
        "height": 976,
        "content": "## 如何获取凭证"
      },
      "typeVersion": 1
    },
    {
      "id": "9dcd1a64-5248-402f-9781-618067dec74d",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -656,
        -64
      ],
      "parameters": {
        "width": 672,
        "height": 240,
        "content": "## 工作流运行原理(便签说明)"
      },
      "typeVersion": 1
    },
    {
      "id": "7d1347ac-3335-4b88-9513-1133906bddd7",
      "name": "优惠码搜寻代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        272,
        144
      ],
      "parameters": {
        "text": "=platform: {{ $('Platform').item.json.query }}",
        "options": {
          "systemMessage": "=# Voucher & Discount Finder Expert\n\nYou are a specialized assistant focused on finding valid, working vouchers and discount codes across the internet.\n\n## Your Primary Objectives:\n1. Search for current, active discount codes and vouchers\n2. Verify codes are recent and likely to be working (within last 30 days)\n3. Present results clearly with code and discount value upfront\n4. Focus on the most recent and reliable sources\n\n## Search Strategy:\n- Use web_search to find current voucher codes\n- Look for codes posted within the last 30 days from today's date\n- Prioritize reputable coupon sites and official brand sources\n- Cross-reference multiple sources when possible\n- Check for expiration dates\n\n## Response Format:\nWhen you find vouchers, present them as:\n- **CODE**: [the actual voucher code]\n- **VALUE**: [discount amount or percentage]\n- **EXPIRES**: [expiration date if available]\n- **SOURCE**: [where you found it]\n- **VERIFIED**: [date it was posted/verified]\n\n## Important Notes:\n- Current date: {{$now}}\n- Only search for codes from the last 30 days maximum\n- Be direct - provide codes immediately without lengthy explanations\n- If no valid codes are found, clearly state this and suggest alternatives"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "81953a00-781c-4006-b61e-6106a7e29d1b",
      "name": "Gemini 2.5Pro",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        208,
        368
      ],
      "parameters": {
        "model": "google/gemini-2.5-pro",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "DPrHlBN0s5WFDxi9",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a3c4bcfa-f44e-464a-9667-45665d5d3e52",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -912,
        96
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0bda292f-52b0-479a-9774-c10ed91ba455",
      "name": "平台",
      "type": "n8n-nodes-base.set",
      "position": [
        -464,
        -256
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e7641500-13e1-46ec-8240-0b32e4fec715",
              "name": "query",
              "type": "string",
              "value": "={{ $json.Platform || $json.message?.text || $json.body.platform || '' }}"
            },
            {
              "id": "2813a353-96d0-4a90-906e-8b6340b9d099",
              "name": "receiver",
              "type": "string",
              "value": "={{ $json.chatId || $json.email || $json.body.email || '' }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c9e850a8-1324-41bc-ac1b-dece1e729db5",
      "name": "无操作,不执行任何动作",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -688,
        -256
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1f41e894-393d-4f24-99a7-e25fb6ebba04",
      "name": "Telegram 触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -912,
        -304
      ],
      "webhookId": "899a09bc-da17-4356-8ac8-6024bc89e1f0",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "8ynwakYF3qrbGMJC",
          "name": "Khaisa 2 bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "6e3f07f7-18b8-497c-9862-ee347a24673c",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        464,
        368
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"platform\": \"platform\",\t\n  \"code1\": \"code1\",\n\t\"value\": \"value\",\n    \"terms\": \"terms and conditions\",\n    \"validUntil\": \"promo code period valid until(date)\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "1112adb5-866f-4465-ac12-75e8a1efce98",
      "name": "获取行",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -240,
        -256
      ],
      "parameters": {
        "limit": 3,
        "filters": {
          "conditions": [
            {
              "keyName": "platform",
              "keyValue": "={{ $json.query }}"
            }
          ]
        },
        "matchType": "allConditions",
        "operation": "get",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "taO6FckoITHcml0P",
          "cachedResultUrl": "/projects/HdidsWtKEV9HXZzb/datatables/taO6FckoITHcml0P",
          "cachedResultName": "Kode Promo Valid"
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "4a45c2ce-69e2-40c8-b54e-f17a0637d8ed",
      "name": "代码是否存在?",
      "type": "n8n-nodes-base.if",
      "position": [
        -16,
        -256
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4a12f7e0-f301-4efd-9b06-31489a31b6a3",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.platform }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "49157a6c-a6eb-42da-9f0c-0f6de6e8ca2a",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -912,
        -496
      ],
      "webhookId": "bf149cfe-39e4-4788-aff1-18bf412b708e",
      "parameters": {
        "options": {},
        "formTitle": "Promo Seeker",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Platform",
              "placeholder": "nama platformnya",
              "requiredField": true
            },
            {
              "fieldLabel": "email",
              "placeholder": "nanti kodenya bakal dikirim kesini",
              "requiredField": true
            }
          ]
        },
        "formDescription": "temukan promocode disini"
      },
      "typeVersion": 2.3
    },
    {
      "id": "9a5a4eb7-151d-4d39-b068-27aa67b31690",
      "name": "发送消息",
      "type": "n8n-nodes-base.gmail",
      "onError": "continueErrorOutput",
      "position": [
        336,
        -160
      ],
      "webhookId": "006b2867-4edf-45ef-a326-e9e7255cd13c",
      "parameters": {
        "sendTo": "={{ $('Webhook').item.json.body.email }}",
        "message": "=<!DOCTYPE html>\n<html lang=\"id\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Kode Promo Spesial</title>\n</head>\n<body style=\"margin: 0; padding: 0; font-family: Arial, sans-serif; background-color: #f4f4f4;\">\n    <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background-color: #f4f4f4; padding: 20px;\">\n        <tr>\n            <td align=\"center\">\n                <table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background-color: #ffffff; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);\">\n                    <!-- Header -->\n                    <tr>\n                        <td style=\"background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 30px; text-align: center; border-radius: 8px 8px 0 0;\">\n                            <h1 style=\"margin: 0; color: #ffffff; font-size: 28px;\">🎉 Kode Promo Buatmu nih!</h1>\n                        </td>\n                    </tr>\n                    \n                    <!-- Content -->\n                    <tr>\n                        <td style=\"padding: 40px 30px;\">\n                            <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n                                <tr>\n                                    <td style=\"padding-bottom: 20px;\">\n                                        <table width=\"100%\" cellpadding=\"10\" cellspacing=\"0\" style=\"background-color: #f8f9fa; border-radius: 6px;\">\n                                            <tr>\n                                                <td style=\"font-weight: bold; color: #333333; width: 40%;\">Platform:</td>\n                                                <td style=\"color: #666666;\">{{ $json.platform }}</td>\n                                            </tr>\n                                            <tr>\n                                                <td style=\"font-weight: bold; color: #333333;\">Kode Promo:</td>\n                                                <td>\n                                                    <span style=\"background-color: #667eea; color: #ffffff; padding: 8px 16px; border-radius: 4px; font-family: 'Courier New', monospace; font-size: 18px; font-weight: bold; display: inline-block;\">{{ $json.promoCode }}</span>\n                                                </td>\n                                            </tr>\n                                            <tr>\n                                                <td style=\"font-weight: bold; color: #333333;\">Value Promo:</td>\n                                                <td style=\"color: #28a745; font-weight: bold; font-size: 18px;\">{{ $json.value }}</td>\n                                            </tr>\n                                            <tr>\n                                                <td style=\"font-weight: bold; color: #333333; vertical-align: top;\">Keterangan:</td>\n                                                <td style=\"color: #666666; line-height: 1.6;\">{{ $json.termsConditions }}</td>\n                                            </tr>\n                                            <tr>\n                                                <td style=\"font-weight: bold; color: #333333;\">Masa Berlaku:</td>\n                                                <td style=\"color: #dc3545; font-weight: bold;\">{{ $json.validUntil.split('T')[0] }}</td>\n                                            </tr>\n                                        </table>\n                                    </td>\n                                </tr>\n                            </table>\n                        </td>\n                    </tr>\n                    \n                    <!-- Footer -->\n                    <tr>\n                        <td style=\"background-color: #f8f9fa; padding: 20px; text-align: center; border-radius: 0 0 8px 8px; border-top: 1px solid #e9ecef;\">\n                            <p style=\"margin: 0; color: #6c757d; font-size: 14px;\">\n                                Just for you by <a href=\"https://khmuhtadin.com\" style=\"color: #667eea; text-decoration: none; font-weight: bold;\">khmuhtadin.com</a>\n                            </p>\n                        </td>\n                    </tr>\n                </table>\n            </td>\n        </tr>\n    </table>\n</body>\n</html>",
        "options": {
          "appendAttribution": false
        },
        "subject": "=Kode Promo {{ $json.platform.toUpperCase() || $json.platform }} Sudah Tersedia"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "8p11S7abjY8KddB9",
          "name": "contactmuhtadin"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "9a50f702-f752-49e8-9b31-a045e91508c1",
      "name": "更新/插入行",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        672,
        144
      ],
      "parameters": {
        "columns": {
          "value": {
            "value": "={{ $json.output.value }}",
            "platform": "={{ $json.output.platform }}",
            "promoCode": "={{ $json.output.code1 }}",
            "validUntil": "={{ $json.output.validUntil }}",
            "termsConditions": "={{ $json.output.terms }}"
          },
          "schema": [
            {
              "id": "platform",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "platform",
              "defaultMatch": false
            },
            {
              "id": "promoCode",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "promoCode",
              "defaultMatch": false
            },
            {
              "id": "value",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "value",
              "defaultMatch": false
            },
            {
              "id": "termsConditions",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "termsConditions",
              "defaultMatch": false
            },
            {
              "id": "validUntil",
              "type": "dateTime",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "validUntil",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "filters": {
          "conditions": [
            {
              "keyName": "promoCode",
              "keyValue": "={{ $json.output.code1 }}"
            }
          ]
        },
        "operation": "upsert",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "taO6FckoITHcml0P",
          "cachedResultUrl": "/projects/HdidsWtKEV9HXZzb/datatables/taO6FckoITHcml0P",
          "cachedResultName": "Kode Promo Valid"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "bc5cd4aa-8f91-4f5c-acf4-e2668fc1933b",
      "name": "Telegram通知",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueErrorOutput",
      "position": [
        336,
        -352
      ],
      "webhookId": "8797e5dc-8f45-49b0-b520-ce54bcaf03a2",
      "parameters": {
        "text": "=<b>🎉 Kode Promo Buatmu nih!</b>\n\n<b>Platform:</b> {{ $json.platform }}\n<b>Kode Promo:</b> <code>{{ $json.promoCode }}</code>\n<b>Value Promo:</b> {{ $json.value }}\n<b>Keterangan:</b> {{ $json.termsConditions }}\n<b>Masa Berlaku:</b> {{ $json.validUntil.split('T')[0] }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "parse_mode": "HTML",
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "8ynwakYF3qrbGMJC",
          "name": "Khaisa 2 bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "23461331-3de2-4b4b-b45d-8525ebe9775d",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -912,
        -112
      ],
      "webhookId": "1f3a6ec2-0991-437f-acec-e15bcc5a5b42",
      "parameters": {
        "path": "v1/promo-seeker",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2.1
    },
    {
      "id": "6c8c94e6-0c45-49d5-a378-4864e628ffc5",
      "name": "响应 Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "disabled": true,
      "position": [
        336,
        -544
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.4
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "530912f1-fec3-4e40-a79b-45906765ee8a",
  "connections": {
    "SerpAPI": {
      "ai_tool": [
        [
          {
            "node": "Promo Seeker Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Platform": {
      "main": [
        [
          {
            "node": "Get row(s)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s)": {
      "main": [
        [
          {
            "node": "Code Exist?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code Exist?": {
      "main": [
        [
          {
            "node": "notify telegram",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          },
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Promo Seeker Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini 2.5Pro": {
      "ai_languageModel": [
        [
          {
            "node": "Promo Seeker Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Upsert row(s)": {
      "main": [
        []
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Promo Seeker Agent": {
      "main": [
        [
          {
            "node": "Upsert row(s)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "No Operation, do nothing": {
      "main": [
        [
          {
            "node": "Platform",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Promo Seeker Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

这是一个高级难度的工作流,适用于Content Creation、Multimodal AI等场景。适合高级用户,包含 16+ 个节点的复杂工作流

需要付费吗?

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

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

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

外部链接
在 n8n.io 上查看 →

分享此工作流