跳到主要内容

工作流模板#

创建新工作流时,您可以选择从空白工作流开始,或使用现有的模板

模板提供以下价值:

  • 快速入门指引:n8n 可能已包含满足您需求的现成模板
  • 可构建功能的示例参考
  • 创建自定义工作流的最佳实践

访问模板#

点击查看模板图标 模板 即可进入模板库。

若使用 n8n 官方模板库,系统将跳转至n8n 官网工作流页面;若使用组织提供的自定义库,则可在应用内直接搜索浏览模板。

n8n 正在推进创作者计划并构建模板市场,该项目持续演进中,具体细则可能调整。

自托管 n8n:使用自定义库#

在环境变量中设置 N8N_TEMPLATES_HOST 为您的 API 基础地址。

接口端点#

您的 API 需提供与 n8n 相同的端点及数据结构:

方法路径
GET/templates/workflows/<id>
GET/templates/search
GET/templates/collections/<id>
GET/templates/collections
GET/templates/categories
GET/health

查询参数#

/templates/search 端点支持以下查询参数:

参数类型说明
page整型返回结果页码
rows整型每页最大返回结果数
category逗号分隔的字符串列表(分类)指定搜索分类范围
search字符串搜索关键词

/templates/collections 端点支持以下查询参数:

参数类型说明
category逗号分隔的字符串列表(分类)指定搜索分类范围
search字符串搜索关键词

数据架构#

可通过以下链接查看端点返回响应对象中数据项的结构:

显示 workflow 数据项架构

{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Generated schema for Root",
"type": "object",
"properties": {
"id": {
"type": "number"
},
"name": {
"type": "string"
},
"totalViews": {
"type": "number"
},
"price": {},
"purchaseUrl": {},
"recentViews": {
"type": "number"
},
"createdAt": {
"type": "string"
},
"user": {
"type": "object",
"properties": {
"username": {
"type": "string"
},
"verified": {
"type": "boolean"
}
},
"required": [
"username",
"verified"
]
},
"nodes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"icon": {
"type": "string"
},
"name": {
"type": "string"
},
"codex": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"details": {
"type": "string"
},
"resources": {
"type": "object",
"properties": {
"generic": {
"type": "array",
"items": {
"type": "object",
"properties": {
"url": {
"type": "string"
},
"icon": {
"type": "string"
},
"label": {
"type": "string"
}
},
"required": [
"url",
"label"
]
}
},
"primaryDocumentation": {
"type": "array",
"items": {
"type": "object",
"properties": {
"url": {
"type": "string"
}
},
"required": [
"url"
]
}
}
},
"required": [
"primaryDocumentation"
]
},
"categories": {
"type": "array",
"items": {
"type": "string"
}
},
"nodeVersion": {
"type": "string"
},
"codexVersion": {
"type": "string"
}
},
"required": [
"categories"
]
}
}
},
"group": {
"type": "string"
},
"defaults": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"color": {
"type": "string"
}
},
"required": [
"name"
]
},
"iconData": {
"type": "object",
"properties": {
"icon": {
"type": "string"
},
"type": {
"type": "string"
},
"fileBuffer": {
"type": "string"
}
},
"required": [
"type"
]
},
"displayName": {
"type": "string"
},
"typeVersion": {
"type": "number"
},
"nodeCategories": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"name": {
"type": "string"
}
},
"required": [
"id",
"name"
]
}
}
},
"required": [
"id",
"icon",
"name",
"codex",
"group",
"defaults",
"iconData",
"displayName",
"typeVersion"
]
}
}
},
"required": [
"id",
"name",
"totalViews",
"price",
"purchaseUrl",
"recentViews",
"createdAt",
"user",
"nodes"
]
}

显示 category 项目数据结构

{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"id": {
"type": "number"
},
"name": {
"type": "string"
}
},
"required": [
"id",
"name"
]
}

显示 collection 项目数据结构

{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"id": {
"type": "number"
},
"rank": {
"type": "number"
},
"name": {
"type": "string"
},
"totalViews": {},
"createdAt": {
"type": "string"
},
"workflows": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "number"
}
},
"required": [
"id"
]
}
},
"nodes": {
"type": "array",
"items": {}
}
},
"required": [
"id",
"rank",
"name",
"totalViews",
"createdAt",
"workflows",
"nodes"
]
}

您还可以通过以下链接交互式探索 n8n 的 API 端点:

如需更多支持,请联系我们