8
n8n 中文网amn8n.com

自动发送每日GLPI待处理工单通知到Microsoft Teams

高级

这是一个Ticket Management领域的自动化工作流,包含 19 个节点。主要使用 If, SplitOut, Aggregate, HttpRequest, MicrosoftTeams 等节点。 自动发送每日GLPI待处理工单通知到Microsoft Teams

前置要求
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "9a6585d268bcb16af660ea2f3e8e0a8881962c92868e9c530eb83c6c580731c3",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "b42b5224-f6c3-4f89-a1de-4edc6b4be539",
      "name": "获取待处理案例",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1488,
        -240
      ],
      "parameters": {
        "url": "https://\"your_glpi_server\"/apirest.php/search/Ticket/",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "criteria[0][field]",
              "value": "5"
            },
            {
              "name": "criteria[0][searchtype]",
              "value": "equals"
            },
            {
              "name": "criteria[0][value]",
              "value": "8"
            },
            {
              "name": "criteria[1][link]",
              "value": "AND"
            },
            {
              "name": "criteria[1][field]",
              "value": "12"
            },
            {
              "name": "criteria[1][searchtype]",
              "value": "equals"
            },
            {
              "name": "criteria[1][value]",
              "value": "2"
            },
            {
              "name": "criteria[2][link]",
              "value": "AND"
            },
            {
              "name": "criteria[2][field]",
              "value": "15"
            },
            {
              "name": "criteria[2][searchtype]",
              "value": "morethan"
            },
            {
              "name": "criteria[2][value]",
              "value": "2024-08-01"
            },
            {
              "name": "criteria[3][link]",
              "value": "AND"
            },
            {
              "name": "criteria[3][field]",
              "value": "80"
            },
            {
              "name": "criteria[3][searchtype]",
              "value": "contains"
            },
            {
              "name": "criteria[3][value]",
              "value": "entity_name"
            },
            {
              "name": "order",
              "value": "DESC"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Session-Token",
              "value": "={{ $json.session_token }}"
            },
            {
              "name": "App-Token",
              "value": "=\"Your App Token is here\""
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "1fcb5ffb-a90a-4b15-be54-e82f5c0cdefc",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -2592,
        -112
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 8
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8851baa4-a224-4167-907a-47a4e9e37539",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -624,
        -352
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "8becb3db-a506-4928-bc7c-e5e436d1832d",
      "name": "无操作,不执行任何操作",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -848,
        48
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "ec77f17f-56da-4992-8c68-83bb2269fa2f",
      "name": "创建聊天消息",
      "type": "n8n-nodes-base.microsoftTeams",
      "position": [
        -112,
        16
      ],
      "webhookId": "271fa446-06a9-4f8b-ae2e-108bab4a7d50",
      "parameters": {
        "chatId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "message": "=## Action Required: Pending Cases\n\n**Title:** {{ $json['1'] }}\n\n**ID:** {{ $json['2'] }}\n\n**Due Date:** {{ $json['18'] }}",
        "options": {
          "includeLinkToWorkflow": false
        },
        "resource": "chatMessage"
      },
      "credentials": {
        "microsoftTeamsOAuth2Api": {
          "id": "oerlPnsFHwreLDUb",
          "name": "Microsoft Teams account 2"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "41990118-4edf-4945-b5d4-8a21381b5914",
      "name": "拆分输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -896,
        -304
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "data"
      },
      "typeVersion": 1
    },
    {
      "id": "86a3660a-7985-4045-8514-a411ce9eb756",
      "name": "聚合",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        -336,
        -432
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "0a8a2fa2-9e52-4bfd-ac48-d41e1d0926d3",
      "name": "无操作,不执行任何操作1",
      "type": "n8n-nodes-base.noOp",
      "position": [
        192,
        -432
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "fbf9fa0f-cfa5-4ea2-935a-18286fd9817d",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2656,
        -288
      ],
      "parameters": {
        "height": 320,
        "content": "## 计划触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "8f908a3f-db32-42e8-bdcc-9586b4f8affd",
      "name": "获取会话令牌",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2064,
        -128
      ],
      "parameters": {
        "url": "https://\"your_glpi_server\"/apirest.php/initSession/",
        "options": {},
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBasicAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "App-Token",
              "value": "\"Your App Token is here\""
            }
          ]
        }
      },
      "credentials": {
        "httpBasicAuth": {
          "id": "7dcUgKfChVkBmVFm",
          "name": "GLPI"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "6cee6b63-c04d-4981-b153-d6b6056c45c9",
      "name": "便签 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2384,
        -448
      ],
      "parameters": {
        "color": 4,
        "width": 544,
        "height": 480,
        "content": "## 节点 HTTP 请求"
      },
      "typeVersion": 1
    },
    {
      "id": "54572b4a-0383-42d8-bca5-25a215eb89d8",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1808,
        -688
      ],
      "parameters": {
        "color": 4,
        "width": 480,
        "height": 720,
        "content": "## 节点 HTTP 请求"
      },
      "typeVersion": 1
    },
    {
      "id": "f2dc0e3a-c751-42d2-8d19-0b985ca71287",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1280,
        -496
      ],
      "parameters": {
        "height": 464,
        "content": "## 节点 IF"
      },
      "typeVersion": 1
    },
    {
      "id": "6a1e7b75-a078-4b4d-8e1b-06ac30e86da4",
      "name": "是否有任何进行中的案例?",
      "type": "n8n-nodes-base.if",
      "position": [
        -1200,
        -224
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "64c7b2af-b7be-4e72-bee4-380072abe2b7",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json.totalcount }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "a239f6ad-6e4b-4c94-b453-0cae8890c536",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        -496
      ],
      "parameters": {
        "width": 224,
        "height": 352,
        "content": "## 节点拆分输出"
      },
      "typeVersion": 1
    },
    {
      "id": "233cfc69-c272-4c75-a37d-8889efb7537b",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -432,
        -544
      ],
      "parameters": {
        "width": 272,
        "height": 272,
        "content": "## 节点聚合"
      },
      "typeVersion": 1
    },
    {
      "id": "60d13886-f13c-441a-8afa-b5ec6c527a43",
      "name": "结束会话",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -32,
        -432
      ],
      "parameters": {
        "url": "https://\"your_glpi_server\"/apirest.php/killSession/",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Session-Token",
              "value": "={{ $('Get session token').item.json.session_token }}"
            },
            {
              "name": "App-Token",
              "value": "\"Your App Token is here\""
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c0c8285f-54c0-4d8d-8e91-51f28068f0a4",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -704
      ],
      "parameters": {
        "width": 272,
        "height": 432,
        "content": "## 节点结束会话"
      },
      "typeVersion": 1
    },
    {
      "id": "0d5a053a-452e-4cad-8106-a87d1098faf4",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        -224
      ],
      "parameters": {
        "color": 5,
        "width": 832,
        "height": 400,
        "content": "## 创建聊天消息"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Aggregate": {
      "main": [
        [
          {
            "node": "End session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "End session": {
      "main": [
        [
          {
            "node": "No Operation, do nothing1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create chat message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get session token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get pending cases": {
      "main": [
        [
          {
            "node": "Are there any ongoing cases?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get session token": {
      "main": [
        [
          {
            "node": "Get pending cases",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create chat message": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Are there any ongoing cases?": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 工单管理

需要付费吗?

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

工作流信息
难度等级
高级
节点数量19
分类1
节点类型9
难度说明

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

作者
Luis Hernandez

Luis Hernandez

@integropen

About the Author GLPI & Automation Enthusiast I've been working with GLPI and service desk tools for several years, and I got tired of manually checking for pending tickets every morning. Like many IT folks, I found myself either forgetting to check or spending too much time hunting through the interface.

外部链接
在 n8n.io 查看

分享此工作流