8
n8n 中文网amn8n.com

通过OpenRouter使用Kimi K2以自然语言访问Stripe数据

中级

这是一个CRM, AI Chatbot领域的自动化工作流,包含 12 个节点。主要使用 StripeTool, Agent, ChatTrigger, LmChatOpenRouter, MemoryBufferWindow 等节点。 通过OpenRouter使用Kimi K2自然语言管理Stripe数据

前置要求
  • Stripe API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "lc8NKe6V14iG51T4",
  "meta": {
    "instanceId": "9219ebc7795bea866f70aa3d977d54417fdf06c41944be95e20cfb60f992db19",
    "templateCredsSetupCompleted": true
  },
  "name": "通过 OpenRouter 使用 Kimi K2 以自然语言访问 Stripe 数据",
  "tags": [],
  "nodes": [
    {
      "id": "fc80d268-934e-4bb7-a854-0483732bfb34",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -48,
        -112
      ],
      "parameters": {
        "options": {
          "systemMessage": "=You are an AI agent with authorized access to a defined set of Stripe tools. Your core objective is to understand and respond to user queries by securely interacting with Stripe's API, enabling read and write operations in accordance with their requests and permissions.\n\nTool Access and Capabilities\nRead Data Capabilities\nYou can retrieve the following information from Stripe:\nCustomers: Access and list multiple customer records.\nCharges: Retrieve and list multiple charge transactions.\nCoupons: Get lists of existing coupons.\nBalance: Obtain the current balance details.\n\nWrite Data Capabilities\nYou are authorized to:\nCreate Coupons: Generate new coupons within the Stripe system.\n\nStrictly follow these rules:\n\nNever access or attempt to retrieve data outside of the above abilities.\nAlways confirm actions (especially when creating coupons) and provide users with a summary of the resulting Stripe operation.\nClearly explain any Stripe terminology or usage as needed.\nReject and inform users if they request actions beyond your tool permissions.\nYour responses must be concise, accurate, and tailored to the user's intent regarding Stripe operations. \nUse Stripe data responsibly and in line with best practices for financial data access."
        }
      },
      "typeVersion": 2
    },
    {
      "id": "0dc1fc15-7958-4f01-be6d-bed3946d60c9",
      "name": "OpenRouter 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -64,
        112
      ],
      "parameters": {
        "model": "moonshotai/kimi-k2",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "TG7gYjmueITLXr7m",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6edc5f19-be6c-4842-b69d-efc7bb46ad7f",
      "name": "当聊天消息收到时",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -256,
        -112
      ],
      "webhookId": "ee12c9ab-62ac-4e5a-b657-4677bcfcf6d0",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "8f520f8d-5085-420a-907f-65958f4ca843",
      "name": "简单内存",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        80,
        112
      ],
      "parameters": {
        "contextWindowLength": 20
      },
      "typeVersion": 1.3
    },
    {
      "id": "08695c48-3f6d-404d-acca-d799708f101b",
      "name": "在 Stripe 中创建优惠券",
      "type": "n8n-nodes-base.stripeTool",
      "position": [
        320,
        368
      ],
      "parameters": {
        "resource": "coupon",
        "percentOff": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Percent_Off', ``, 'number') }}"
      },
      "credentials": {
        "stripeApi": {
          "id": "zMFMWhEPuLeplXSo",
          "name": "Stripe account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c37f6b38-638b-46f6-a8d9-3ff526a7599b",
      "name": "在 Stripe 中获取余额",
      "type": "n8n-nodes-base.stripeTool",
      "position": [
        816,
        96
      ],
      "parameters": {},
      "credentials": {
        "stripeApi": {
          "id": "zMFMWhEPuLeplXSo",
          "name": "Stripe account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1adee53c-0f39-44cb-b2c6-83779340bb0b",
      "name": "在 Stripe 中获取多个费用",
      "type": "n8n-nodes-base.stripeTool",
      "position": [
        496,
        96
      ],
      "parameters": {
        "limit": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Limit', ``, 'number') }}",
        "resource": "charge",
        "operation": "getAll"
      },
      "credentials": {
        "stripeApi": {
          "id": "zMFMWhEPuLeplXSo",
          "name": "Stripe account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b9c48bc6-a79a-4e2b-bb2f-23837bd936af",
      "name": "在 Stripe 中获取多个优惠券",
      "type": "n8n-nodes-base.stripeTool",
      "position": [
        672,
        96
      ],
      "parameters": {
        "limit": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Limit', ``, 'number') }}",
        "resource": "coupon",
        "operation": "getAll"
      },
      "credentials": {
        "stripeApi": {
          "id": "zMFMWhEPuLeplXSo",
          "name": "Stripe account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "94ce8cf5-c2cf-4cb5-8a05-2a72c8011213",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        -32
      ],
      "parameters": {
        "width": 688,
        "height": 304,
        "content": "## 读取数据"
      },
      "typeVersion": 1
    },
    {
      "id": "5f79a25d-eab2-452d-ac07-8ccf3778ac2c",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        288
      ],
      "parameters": {
        "width": 224,
        "height": 256,
        "content": "## 写入数据"
      },
      "typeVersion": 1
    },
    {
      "id": "4f9598f9-3e48-4979-a1f5-8c64b5c7b44c",
      "name": "在 Stripe 中获取多个客户",
      "type": "n8n-nodes-base.stripeTool",
      "position": [
        320,
        96
      ],
      "parameters": {
        "limit": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Limit', ``, 'number') }}",
        "filters": {},
        "resource": "customer",
        "operation": "getAll"
      },
      "credentials": {
        "stripeApi": {
          "id": "zMFMWhEPuLeplXSo",
          "name": "Stripe account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1cfd5b2f-36d7-42c8-ba67-0d2906d0bd93",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -624,
        96
      ],
      "parameters": {
        "color": 5,
        "width": 464,
        "height": 192,
        "content": "## 要求"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "58807a0c-a099-4d5f-9722-3bfce4363f80",
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get a balance in Stripe": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create a coupon in Stripe": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get many charges in Stripe": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get many coupons in Stripe": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many customers in Stripe": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 客户关系管理, AI 聊天机器人

需要付费吗?

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

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

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

作者
Aitor | 1Node

Aitor | 1Node

@aitoralonso

Hi, I’m Aitor. At 1Node we deploy private AI infrastructure that saves teams above 5 figures annually switching from cloud Enterprise solutions. Guaranteed. We also enjoy playing around with n8n workflows. Need help integrating AI or have questions that need answers and guidance? Feel free to send us a message.

外部链接
在 n8n.io 查看

分享此工作流