JamfのスマートグループメンバーシップをSlackへ可視CSVレポートとしてエクスポート

上級

これはDevOps分野の自動化ワークフローで、21個のノードを含みます。主にSet, Code, Slack, Webhook, SplitOutなどのノードを使用。 JamfのインテリジェントグループメンバーシップをSlackへ閲覧可能なCSVレポートとしてエクスポート

前提条件
  • Slack Bot Token または Webhook URL
  • HTTP Webhookエンドポイント(n8nが自動生成)
  • ターゲットAPIの認証情報が必要な場合あり

カテゴリー

ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "meta": {
    "instanceId": "894b3446666dc2807d20dfad165e2f6f3696905c2f8c352081f4fd666cdd7b1c"
  },
  "nodes": [
    {
      "id": "5fa718ad-f53d-4a5a-8106-f1f1aef44d47",
      "name": "「ワークフロー実行」クリック時",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1780,
        820
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c137c6b0-1b24-43e4-b6a6-6ed59270d87d",
      "name": "グループをループ処理",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -840,
        680
      ],
      "parameters": {
        "options": {
          "reset": false
        }
      },
      "typeVersion": 3,
      "alwaysOutputData": false
    },
    {
      "id": "09fe9c6e-aefd-491a-b888-339311577ef7",
      "name": "グループメンバーを取得",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -640,
        660
      ],
      "parameters": {
        "url": "=https://{{ $('Jamf Server').item.json.server }}.jamfcloud.com/api/v2/computer-groups/smart-group-membership/{{ $json.value }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "oAuth2Api"
      },
      "credentials": {
        "oAuth2Api": {
          "id": "SRjYS4PQ8cCMgZLK",
          "name": "Unnamed credential"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d79584bf-5dbb-42a2-a84d-03bc7f2b0672",
      "name": "メンバーを分割",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -440,
        660
      ],
      "parameters": {
        "include": "selectedOtherFields",
        "options": {},
        "fieldToSplitOut": "members",
        "fieldsToInclude": "={{ $('Split groups').item.json.key }}"
      },
      "typeVersion": 1
    },
    {
      "id": "1db7afe2-6a80-40ee-a2e5-5d595689aeb2",
      "name": "グループを分割",
      "type": "n8n-nodes-base.code",
      "position": [
        -1080,
        740
      ],
      "parameters": {
        "jsCode": "const input = items[0].json;\nconst result = [];\n\nfor (const key in input) {\n  result.push({\n    json: {\n      key,\n      value: input[key]\n    }\n  });\n}\n\nreturn result;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "198f7370-f57b-42f7-ad89-5ce85ffda239",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1780,
        620
      ],
      "webhookId": "d0baf32a-ccec-43dc-9d68-5ffd536b8a1c",
      "parameters": {
        "path": "d0baf32a-ccec-43dc-9d68-5ffd536b8a1c",
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "a7f64b31-e442-4478-809b-c11c4684fb44",
      "name": "csv に変換",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        160,
        660
      ],
      "parameters": {
        "options": {
          "fileName": "=_",
          "headerRow": true
        },
        "binaryPropertyName": "=data"
      },
      "typeVersion": 1.1
    },
    {
      "id": "a3c00893-c871-4988-a2fd-dab9d655add4",
      "name": "Jamf Server",
      "type": "n8n-nodes-base.set",
      "position": [
        -1540,
        740
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ff1f57d8-399e-4b4d-89a6-b3ac44f40923",
              "name": "server",
              "type": "string",
              "value": "yourSercer"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f91f4654-9d36-4ccd-91df-7489aeced998",
      "name": "CSV ヘッダー",
      "type": "n8n-nodes-base.set",
      "position": [
        -40,
        660
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1cf47bfc-0457-4b6a-ac61-d439bff50691",
              "name": "Device Name",
              "type": "string",
              "value": "={{ $json.general.name }}"
            },
            {
              "id": "3af207c9-eb53-4eec-a5aa-7a125af3c76e",
              "name": "Last contact",
              "type": "string",
              "value": "={{ $json.general.lastContactTime.substring(0,10) }}"
            },
            {
              "id": "d9a77e89-2bee-44e6-9220-06fac550a604",
              "name": "S/N",
              "type": "string",
              "value": "={{ $json.hardware.serialNumber }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ca2d2077-4ed4-4952-8365-e790480b2166",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1620,
        520
      ],
      "parameters": {
        "width": 480,
        "height": 420,
        "content": "## Set\n**Node: Jamf Server**\nSet your jamf BaseURL from your jamf URL\nhttps://yourServer.jamfcloud.com\n\n**Node: IDs**\nSet the smart group IDs "
      },
      "typeVersion": 1
    },
    {
      "id": "7e0484b8-2151-4ed7-b241-2c1de919e93a",
      "name": "ID",
      "type": "n8n-nodes-base.set",
      "position": [
        -1300,
        740
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f7cff112-42bd-4672-9a2f-c0c0b65bb216",
              "name": "Smart Group 1",
              "type": "string",
              "value": "70"
            },
            {
              "id": "a3b44780-bcee-431c-8ab5-913eb20dd0b6",
              "name": "Smart Group 2",
              "type": "string",
              "value": "166"
            },
            {
              "id": "d0ae5b18-9417-4186-9d14-b39d1d9c7aa3",
              "name": "Smart Group 3",
              "type": "string",
              "value": "208"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "69993c27-ab3d-4e36-825d-d87d00095392",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1120,
        520
      ],
      "parameters": {
        "color": 3,
        "width": 220,
        "height": 420,
        "content": "## Split  \nSplit previous node array into items"
      },
      "typeVersion": 1
    },
    {
      "id": "273b0995-4b40-4f8e-ab94-affbfafe8f2c",
      "name": "付箋2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        240
      ],
      "parameters": {
        "color": 7,
        "width": 1430,
        "height": 700,
        "content": "## Loop\n"
      },
      "typeVersion": 1
    },
    {
      "id": "163460ca-44fa-4b8c-9545-e71e6f713ade",
      "name": "付箋3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -680,
        460
      ],
      "parameters": {
        "color": 4,
        "width": 180,
        "height": 400,
        "content": "## Get  \nGet group members IDs"
      },
      "typeVersion": 1
    },
    {
      "id": "484bb691-c2b0-4da1-8294-89b55baad943",
      "name": "付箋4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        460
      ],
      "parameters": {
        "color": 3,
        "width": 180,
        "height": 400,
        "content": "## Split  \nSplit members array into individual members"
      },
      "typeVersion": 1
    },
    {
      "id": "e5c86151-13f6-41d9-9017-8be5c5faa1de",
      "name": "付箋5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        460
      ],
      "parameters": {
        "color": 7,
        "width": 180,
        "height": 400,
        "content": "## 2nd Loop\n\nNested loops don't work very well so using a sub workflow is the cleanest solution\n-Loop over members and get their details"
      },
      "typeVersion": 1
    },
    {
      "id": "7deab3c2-a171-4492-8de4-feb2af3755ce",
      "name": "メンバーループ",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        -240,
        660
      ],
      "parameters": {
        "options": {
          "waitForSubWorkflow": "={{ true }}"
        },
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "UYr3yGHbhA6RFyND",
          "cachedResultName": "get members"
        },
        "workflowInputs": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "eba5da43-adb7-4804-bc9b-12cf4d8cead7",
      "name": "付箋6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        460
      ],
      "parameters": {
        "color": 5,
        "width": 180,
        "height": 400,
        "content": "## Select\nSet the CSV header"
      },
      "typeVersion": 1
    },
    {
      "id": "b9232c0e-65bd-4e23-92e5-98050a784532",
      "name": "付箋7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        120,
        460
      ],
      "parameters": {
        "color": 2,
        "width": 180,
        "height": 400,
        "content": "## Convert\nConvert JSON ouput to CSV for each group"
      },
      "typeVersion": 1
    },
    {
      "id": "0a5f5bcd-0c7c-49a0-a4cc-7996c5b50dfe",
      "name": "付箋8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        460
      ],
      "parameters": {
        "width": 200,
        "height": 400,
        "content": "## Post\nPost the group and members summary into a Slack channel"
      },
      "typeVersion": 1
    },
    {
      "id": "e46998ca-b549-45b1-8e41-2b7c516bdd67",
      "name": "Slack チャンネル",
      "type": "n8n-nodes-base.slack",
      "position": [
        380,
        720
      ],
      "webhookId": "b21eb82b-589d-469d-8181-7e5c002cc20a",
      "parameters": {
        "options": {
          "fileName": "data.csv",
          "channelId": "C07PQP5J1BJ",
          "initialComment": "=🚨<https://{{ $('Jamf Server').item.json.server }}.jamfcloud.com/smartComputerGroups.html?id={{ $('Split groups').item.json.value }}|{{ $('Split groups').item.json.key }} Group>🚨\n"
        },
        "resource": "file"
      },
      "credentials": {
        "slackApi": {
          "id": "8kwaKSXWJHzDApmZ",
          "name": "Slack"
        }
      },
      "executeOnce": true,
      "typeVersion": 2.3
    }
  ],
  "pinData": {},
  "connections": {
    "7e0484b8-2151-4ed7-b241-2c1de919e93a": {
      "main": [
        [
          {
            "node": "1db7afe2-6a80-40ee-a2e5-5d595689aeb2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "198f7370-f57b-42f7-ad89-5ce85ffda239": {
      "main": [
        [
          {
            "node": "a3c00893-c871-4988-a2fd-dab9d655add4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f91f4654-9d36-4ccd-91df-7489aeced998": {
      "main": [
        [
          {
            "node": "a7f64b31-e442-4478-809b-c11c4684fb44",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a3c00893-c871-4988-a2fd-dab9d655add4": {
      "main": [
        [
          {
            "node": "7e0484b8-2151-4ed7-b241-2c1de919e93a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7deab3c2-a171-4492-8de4-feb2af3755ce": {
      "main": [
        [
          {
            "node": "f91f4654-9d36-4ccd-91df-7489aeced998",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1db7afe2-6a80-40ee-a2e5-5d595689aeb2": {
      "main": [
        [
          {
            "node": "c137c6b0-1b24-43e4-b6a6-6ed59270d87d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e46998ca-b549-45b1-8e41-2b7c516bdd67": {
      "main": [
        [
          {
            "node": "c137c6b0-1b24-43e4-b6a6-6ed59270d87d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a7f64b31-e442-4478-809b-c11c4684fb44": {
      "main": [
        [
          {
            "node": "e46998ca-b549-45b1-8e41-2b7c516bdd67",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c137c6b0-1b24-43e4-b6a6-6ed59270d87d": {
      "main": [
        [],
        [
          {
            "node": "09fe9c6e-aefd-491a-b888-339311577ef7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "09fe9c6e-aefd-491a-b888-339311577ef7": {
      "main": [
        [
          {
            "node": "d79584bf-5dbb-42a2-a84d-03bc7f2b0672",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d79584bf-5dbb-42a2-a84d-03bc7f2b0672": {
      "main": [
        [
          {
            "node": "7deab3c2-a171-4492-8de4-feb2af3755ce",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5fa718ad-f53d-4a5a-8106-f1f1aef44d47": {
      "main": [
        [
          {
            "node": "a3c00893-c871-4988-a2fd-dab9d655add4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

上級 - DevOps

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
上級
ノード数21
カテゴリー1
ノードタイプ11
難易度説明

上級者向け、16ノード以上の複雑なワークフロー

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34