Exporter les relations de membres de groupes intelligents Jamf en rapport CSV consultable vers Slack

Avancé

Ceci est unDevOpsworkflow d'automatisation du domainecontenant 21 nœuds.Utilise principalement des nœuds comme Set, Code, Slack, Webhook, SplitOut. Exporter les relations de membres de groupes intelligents Jamf en rapport CSV consultable vers Slack

Prérequis
  • Token Bot Slack ou URL Webhook
  • Point de terminaison HTTP Webhook (généré automatiquement par n8n)
  • Peut nécessiter les informations d'identification d'authentification de l'API cible

Catégorie

Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "meta": {
    "instanceId": "894b3446666dc2807d20dfad165e2f6f3696905c2f8c352081f4fd666cdd7b1c"
  },
  "nodes": [
    {
      "id": "5fa718ad-f53d-4a5a-8106-f1f1aef44d47",
      "name": "Lors du clic sur 'Exécuter le workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1780,
        820
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c137c6b0-1b24-43e4-b6a6-6ed59270d87d",
      "name": "Boucler sur les groupes",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -840,
        680
      ],
      "parameters": {
        "options": {
          "reset": false
        }
      },
      "typeVersion": 3,
      "alwaysOutputData": false
    },
    {
      "id": "09fe9c6e-aefd-491a-b888-339311577ef7",
      "name": "Obtenir les membres du groupe",
      "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": "Séparer les membres",
      "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": "Séparer les groupes",
      "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": "Convertir en 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": "Serveur Jamf",
      "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": "En-têtes 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": "Note adhésive",
      "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": "IDs",
      "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": "Note adhésive1",
      "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": "Note adhésive2",
      "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": "Note adhésive3",
      "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": "Note adhésive4",
      "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": "Note adhésive5",
      "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": "Boucle des membres",
      "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": "Note adhésive6",
      "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": "Note adhésive7",
      "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": "Note adhésive8",
      "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": "Canal 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
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Avancé - DevOps

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Avancé
Nombre de nœuds21
Catégorie1
Types de nœuds11
Description de la difficulté

Adapté aux utilisateurs avancés, avec des workflows complexes contenant 16+ nœuds

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34