{
  "name": "Rikas \u8bd5\u7528\u7533\u8bf7\u901a\u77e5",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "trial-application",
        "options": {
          "rawBody": false
        }
      },
      "name": "Webhook \u63a5\u6536\u8bd5\u7528\u7533\u8bf7",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        250,
        300
      ],
      "id": "webhook-node-1"
    },
    {
      "parameters": {
        "jsCode": "// \u5904\u7406\u8868\u5355\u6570\u636e\u5e76\u683c\u5f0f\u5316\u4e3a\u98de\u4e66\u5361\u7247\nconst formData = $input.item.json.body;\n\n// \u56e2\u961f\u89c4\u6a21\u6620\u5c04\nconst teamSizeMap = {\n  '1-10': '1-10\u4eba',\n  '11-50': '11-50\u4eba',\n  '51-200': '51-200\u4eba',\n  '201-500': '201-500\u4eba',\n  '500+': '500\u4eba\u4ee5\u4e0a'\n};\n\n// \u6784\u5efa\u98de\u4e66\u5361\u7247\u6d88\u606f\nconst feishuCard = {\n  msg_type: 'interactive',\n  card: {\n    config: {\n      wide_screen_mode: true\n    },\n    header: {\n      title: {\n        tag: 'plain_text',\n        content: '\ud83c\udf89 \u65b0\u7684\u8bd5\u7528\u7533\u8bf7'\n      },\n      template: 'blue'\n    },\n    elements: [\n      {\n        tag: 'div',\n        text: {\n          tag: 'lark_md',\n          content: `**\u7533\u8bf7\u65f6\u95f4:** ${new Date().toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' })}`\n        }\n      },\n      {\n        tag: 'hr'\n      },\n      {\n        tag: 'div',\n        fields: [\n          {\n            is_short: true,\n            text: {\n              tag: 'lark_md',\n              content: `**\u59d3\u540d:**\\n${formData.firstName || ''} ${formData.lastName || ''}`\n            }\n          },\n          {\n            is_short: true,\n            text: {\n              tag: 'lark_md',\n              content: `**\u804c\u4f4d:**\\n${formData.jobTitle || '\u672a\u586b\u5199'}`\n            }\n          },\n          {\n            is_short: true,\n            text: {\n              tag: 'lark_md',\n              content: `**\u90ae\u7bb1:**\\n${formData.workEmail || ''}`\n            }\n          },\n          {\n            is_short: true,\n            text: {\n              tag: 'lark_md',\n              content: `**\u7535\u8bdd:**\\n${formData.phone || '\u672a\u586b\u5199'}`\n            }\n          },\n          {\n            is_short: true,\n            text: {\n              tag: 'lark_md',\n              content: `**\u516c\u53f8:**\\n${formData.company || ''}`\n            }\n          },\n          {\n            is_short: true,\n            text: {\n              tag: 'lark_md',\n              content: `**\u56e2\u961f\u89c4\u6a21:**\\n${teamSizeMap[formData.teamSize] || formData.teamSize}`\n            }\n          }\n        ]\n      },\n      {\n        tag: 'hr'\n      },\n      {\n        tag: 'div',\n        text: {\n          tag: 'lark_md',\n          content: `**\u8ba2\u9605\u8425\u9500\u4fe1\u606f:** ${formData.subscribe ? '\u2705 \u662f' : '\u274c \u5426'}`\n        }\n      },\n      {\n        tag: 'hr'\n      },\n      {\n        tag: 'note',\n        elements: [\n          {\n            tag: 'plain_text',\n            content: '\u8bf7\u5c3d\u5feb\u8054\u7cfb\u5ba2\u6237\uff0c\u63d0\u4f9b\u8bd5\u7528\u8d26\u53f7\u548c\u4ea7\u54c1\u6f14\u793a'\n          }\n        ]\n      },\n      {\n        tag: 'action',\n        actions: [\n          {\n            tag: 'button',\n            text: {\n              tag: 'plain_text',\n              content: '\u53d1\u9001\u8bd5\u7528\u8d26\u53f7'\n            },\n            type: 'primary',\n            url: `mailto:${formData.workEmail}?subject=\u6b22\u8fce\u8bd5\u7528 Rikas AI&body=\u60a8\u597d ${formData.firstName}\uff0c`\n          },\n          {\n            tag: 'button',\n            text: {\n              tag: 'plain_text',\n              content: '\u67e5\u770b\u8be6\u60c5'\n            },\n            type: 'default',\n            url: 'https://rikas.ai/admin/trials'\n          }\n        ]\n      }\n    ]\n  }\n};\n\nreturn {\n  json: {\n    feishuCard: feishuCard,\n    originalData: formData,\n    timestamp: new Date().toISOString()\n  }\n};"
      },
      "name": "\u683c\u5f0f\u5316\u4e3a\u98de\u4e66\u5361\u7247",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        450,
        300
      ],
      "id": "code-node-1"
    },
    {
      "parameters": {
        "url": "={{ $env.FEISHU_WEBHOOK_URL }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": []
        },
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json.feishuCard) }}",
        "options": {}
      },
      "name": "\u53d1\u9001\u5230\u98de\u4e66",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        650,
        300
      ],
      "id": "http-node-1"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({\n  success: true,\n  message: '\u7533\u8bf7\u5df2\u63d0\u4ea4\uff0c\u6211\u4eec\u4f1a\u5c3d\u5feb\u4e0e\u60a8\u8054\u7cfb',\n  timestamp: $json.timestamp\n}) }}"
      },
      "name": "\u8fd4\u56de\u6210\u529f\u54cd\u5e94",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        850,
        300
      ],
      "id": "respond-node-1"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseCode": 500,
        "responseBody": "={{ JSON.stringify({\n  success: false,\n  message: '\u63d0\u4ea4\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5',\n  error: $json.error\n}) }}"
      },
      "name": "\u8fd4\u56de\u9519\u8bef\u54cd\u5e94",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        850,
        450
      ],
      "id": "respond-error-node-1"
    }
  ],
  "connections": {
    "Webhook \u63a5\u6536\u8bd5\u7528\u7533\u8bf7": {
      "main": [
        [
          {
            "node": "\u683c\u5f0f\u5316\u4e3a\u98de\u4e66\u5361\u7247",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u683c\u5f0f\u5316\u4e3a\u98de\u4e66\u5361\u7247": {
      "main": [
        [
          {
            "node": "\u53d1\u9001\u5230\u98de\u4e66",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u53d1\u9001\u5230\u98de\u4e66": {
      "main": [
        [
          {
            "node": "\u8fd4\u56de\u6210\u529f\u54cd\u5e94",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u8fd4\u56de\u9519\u8bef\u54cd\u5e94",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [],
  "triggerCount": 0,
  "updatedAt": "2025-01-13T00:00:00.000Z",
  "versionId": "1"
}