💻 安排工作流活动时间
中级
这是一个DevOps, Building Blocks领域的自动化工作流,包含 13 个节点。主要使用 N8n, Set, Merge, ScheduleTrigger 等节点。 使用原生n8n API按计划激活和停用工作流
前置要求
- •无特殊前置要求,导入即可使用
使用的节点 (13)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "cGqPi5Uy2u1ShmoO",
"meta": {
"instanceId": "8fccc85e4982eaaf920505127420cfb3a600b56930a56e499973488bb6dc5e3a",
"templateCredsSetupCompleted": true
},
"name": "💻 安排工作流活动时间",
"tags": [
{
"id": "0IPbflTW7vujkmxO",
"name": "DevOps",
"createdAt": "2025-03-16T13:11:38.707Z",
"updatedAt": "2025-03-16T13:11:38.707Z"
}
],
"nodes": [
{
"id": "294244fd-8c35-4b70-af84-cc466a60541f",
"name": "n8n 激活",
"type": "n8n-nodes-base.n8n",
"position": [
360,
-180
],
"parameters": {
"operation": "activate",
"workflowId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.workflowID }}"
},
"requestOptions": {}
},
"credentials": {
"n8nApi": {
"id": "zYX6aInNigxW08J2",
"name": "n8n acc for Gitlab/hub sync of repos"
}
},
"typeVersion": 1
},
{
"id": "e669e5e3-288a-4d6b-af12-011340e60f64",
"name": "n8n 停用",
"type": "n8n-nodes-base.n8n",
"position": [
360,
140
],
"parameters": {
"operation": "deactivate",
"workflowId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.workflowID }}"
},
"requestOptions": {}
},
"credentials": {
"n8nApi": {
"id": "zYX6aInNigxW08J2",
"name": "n8n acc for Gitlab/hub sync of repos"
}
},
"typeVersion": 1
},
{
"id": "a9c7337f-d0ca-4e7e-873d-1d38813f2717",
"name": "工作流 ID",
"type": "n8n-nodes-base.set",
"position": [
-60,
-80
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "86a66597-b7c3-4e26-aab9-fdf6cc4e43b5",
"name": "workflowID",
"type": "string",
"value": "cGqPi5Uy2u1ShmoO"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "9c641940-fb33-4750-b3ef-ed3d216c339e",
"name": "合并工作流 ID 以停用",
"type": "n8n-nodes-base.merge",
"position": [
180,
140
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineByPosition"
},
"typeVersion": 3
},
{
"id": "1368366d-0bec-45b3-9de9-d1902ca9b30c",
"name": "合并工作流 ID 以激活",
"type": "n8n-nodes-base.merge",
"position": [
180,
-180
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineByPosition"
},
"typeVersion": 3
},
{
"id": "68f765bc-23e2-48c9-8558-a30fc4d8bbb1",
"name": "每天 08:00 激活",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-320,
-200
],
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 8 * * *"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "2b51cc72-55c8-444a-931e-54adb0a7ada8",
"name": "每天 20:00 停用",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-320,
160
],
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 20 * * *"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "27edd566-b0cc-47d8-922b-33a909df9e56",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-180,
-500
],
"parameters": {
"color": 5,
"width": 320,
"height": 800,
"content": "## 设置目标工作流 ID"
},
"typeVersion": 1
},
{
"id": "d568b8e8-aaad-45ae-aa56-b6e6671f246d",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-500,
-500
],
"parameters": {
"color": 5,
"width": 300,
"height": 800,
"content": "## 设置激活/停用计划"
},
"typeVersion": 1
},
{
"id": "d23ff5a9-a8c2-43c7-8241-fcc3ff53f290",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
300,
-500
],
"parameters": {
"color": 5,
"width": 320,
"height": 800,
"content": "## 设置 n8n API 凭据"
},
"typeVersion": 1
},
{
"id": "0dd08d9b-046a-4c11-9bf4-bfb6beffa852",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-500,
-620
],
"parameters": {
"width": 1120,
"height": 100,
"content": "## ⚠️ 警告!"
},
"typeVersion": 1
},
{
"id": "895034b7-5d7d-4e02-a125-6df6e4c44531",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-500,
-740
],
"parameters": {
"color": 4,
"width": 1120,
"height": 100,
"content": "## 安排工作流活动时间"
},
"typeVersion": 1
},
{
"id": "18e464f1-fc3b-4ce5-b5c7-c3769b3fc697",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
640,
-500
],
"parameters": {
"color": 5,
"width": 320,
"height": 800,
"content": "## 激活此工作流!"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "bb1c2014-2e38-41c0-ae1c-952fb98d0504",
"connections": {
"Workflow ID": {
"main": [
[
{
"node": "Merge in Workflow ID for activation",
"type": "main",
"index": 1
},
{
"node": "Merge in Workflow ID for deactivation",
"type": "main",
"index": 0
}
]
]
},
"Activate at 08:00 daily": {
"main": [
[
{
"node": "Workflow ID",
"type": "main",
"index": 0
},
{
"node": "Merge in Workflow ID for activation",
"type": "main",
"index": 0
}
]
]
},
"Deactivate at 20:00 daily": {
"main": [
[
{
"node": "Workflow ID",
"type": "main",
"index": 0
},
{
"node": "Merge in Workflow ID for deactivation",
"type": "main",
"index": 1
}
]
]
},
"Merge in Workflow ID for activation": {
"main": [
[
{
"node": "n8n Activate",
"type": "main",
"index": 0
}
]
]
},
"Merge in Workflow ID for deactivation": {
"main": [
[
{
"node": "n8n Deactivate",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 开发运维, 构建模块
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
高级 n8n 工作流与 GitHub 同步
使用 GitHub 的智能变更检测自动化工作流备份
If
N8n
Set
+10
38 节点Maksym Brashenko
开发运维
自动化n8n工作流备份至GitHub并追踪删除
自动化n8n工作流备份至GitHub并追踪删除
If
N8n
Set
+13
31 节点Marcial Ambriz
开发运维
将您的工作流保存到 GitHub 仓库
每日工作流备份至 GitHub 并发送 Slack 通知
If
N8n
Set
+10
18 节点Andrew
开发运维
使用n8n API和邮件发送生成周度工作流分析报告
使用n8n API和邮件发送生成周度工作流分析报告
N8n
Set
Code
+6
19 节点Wessel Bulte
开发运维
GitHub 同步仪表板 - V2
具有提交历史和回滚功能的 GitHub 工作流版本控制仪表板
If
N8n
Set
+20
94 节点Eduard
开发运维
将N8N审计和失败工作流发送到InfluxDB
通过InfluxDB仪表板监控工作流审计和失败情况
N8n
Set
Merge
+6
29 节点Łukasz
开发运维
工作流信息
难度等级
中级
节点数量13
分类2
节点类型5
作者
Olek
@olekI am a **dataholic** (I trust, everything can be quantified and measured) and an **automation** enthusiast. Q of the day: Why spending 1 hour doing a routinal staff when you could spend 1 day automating it and having fun? PM me on [community.n8n.io](https://community.n8n.io/u/olek/summary) and let me know what do you think about this Q above.
外部链接
在 n8n.io 查看 →
分享此工作流