Exporter les stratégies Jamf en CSV vers Slack pour un audit instantané

Avancé

Ceci est unSecOpsworkflow d'automatisation du domainecontenant 19 nœuds.Utilise principalement des nœuds comme Set, Xml, Slack, Webhook, SplitOut. Exporter les stratégies Jamf en CSV vers Slack pour un audit instantané

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
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",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "5ca81fc1-614a-4631-8c7c-e5245be5cf17",
      "name": "Note adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        -112
      ],
      "parameters": {
        "width": 260,
        "height": 320,
        "content": "## Set  \nSet your jamf BaseURL \nfrom your jamf URL\nhttps://yourServer.jamfcloud.com"
      },
      "typeVersion": 1
    },
    {
      "id": "ba77dd94-871d-42ff-821d-197568974504",
      "name": "Note adhésive1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -112
      ],
      "parameters": {
        "color": 3,
        "width": 188,
        "height": 320,
        "content": "## Get  \nGet the list of policies from your jamf patch management"
      },
      "typeVersion": 1
    },
    {
      "id": "7d304368-ae37-4508-b76d-d9f5dca6e353",
      "name": "Cliquer",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -640,
        80
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "359efbe9-baef-4136-85e2-ace0e53d0f21",
      "name": "Boucler sur les éléments",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        528,
        32
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "361358cd-6e1a-4453-8d2b-5c1aa1f23476",
      "name": "Note adhésive8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        -112
      ],
      "parameters": {
        "color": 6,
        "width": 170,
        "height": 320,
        "content": "## Split\nSplit the array return into items"
      },
      "typeVersion": 1
    },
    {
      "id": "d8ba1ba1-d77d-4062-801a-83a594b266a1",
      "name": "Serveur Jamf",
      "type": "n8n-nodes-base.set",
      "position": [
        -368,
        48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d5945b47-962f-4cea-8bb8-a8f61ee468ec",
              "name": "server",
              "type": "string",
              "value": "youserver"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "0f55f295-4b0c-49d4-8d99-2658d17742a2",
      "name": "XML",
      "type": "n8n-nodes-base.xml",
      "onError": "continueRegularOutput",
      "position": [
        752,
        -96
      ],
      "parameters": {
        "options": {},
        "dataPropertyName": "=data"
      },
      "typeVersion": 1
    },
    {
      "id": "b72b34e8-2c7c-4b19-81bf-a4bbfa730dd0",
      "name": "Webhook-policies",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -640,
        -112
      ],
      "webhookId": "",
      "parameters": {
        "path": "",
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "ef2147db-2fc3-4906-ac31-864666bd755e",
      "name": "Note adhésive9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        -112
      ],
      "parameters": {
        "color": 2,
        "width": 188,
        "height": 320,
        "content": "## Convert \nJamf v1 api JSS uses xml, so this node is needed to convert the output to JSON"
      },
      "typeVersion": 1
    },
    {
      "id": "f3e2dd39-75d2-4021-80a2-ba252066474e",
      "name": "XML-JSON",
      "type": "n8n-nodes-base.xml",
      "position": [
        96,
        48
      ],
      "parameters": {
        "options": {},
        "dataPropertyName": "=data"
      },
      "typeVersion": 1
    },
    {
      "id": "bebaba2f-376e-4b3e-96af-7c9424f26108",
      "name": "Diviser les ID de stratégies",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        320,
        48
      ],
      "parameters": {
        "include": "selectedOtherFields",
        "options": {},
        "fieldToSplitOut": "policies.policy",
        "fieldsToInclude": "server"
      },
      "typeVersion": 1
    },
    {
      "id": "0ffca65c-85dc-47e6-96a1-a2ccfa79056e",
      "name": "Obtenir les IDs de stratégies",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -128,
        48
      ],
      "parameters": {
        "url": "=https://{{ $json.server }}.jamfcloud.com/JSSResource/policies",
        "options": {},
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "oAuth2Api",
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/xml"
            }
          ]
        }
      },
      "credentials": {
        "oAuth2Api": {
          "id": "",
          "name": ""
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "9ce5001c-3bb2-4afb-9e99-a6995e7a59ad",
      "name": "Obtenir la stratégie :id",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        752,
        80
      ],
      "parameters": {
        "url": "=https://{{ $('Jamf Server').item.json.server }}.jamfcloud.com/JSSResource/policies/id/{{ $json['policies.policy'].id }}",
        "options": {},
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "oAuth2Api",
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/xml"
            }
          ]
        }
      },
      "credentials": {
        "oAuth2Api": {
          "id": "",
          "name": ""
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d73f87b7-a4c2-4ac2-9986-fe4ba78e45b3",
      "name": "Publier vers Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        1456,
        -96
      ],
      "webhookId": "4ae7b233-a125-4249-b76c-226b26340331",
      "parameters": {
        "options": {
          "fileName": "Policies.csv",
          "channelId": ""
        },
        "resource": "file"
      },
      "credentials": {
        "slackApi": {
          "id": "8kwaKSXWJHzDApmZ",
          "name": "Slack"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "6e5d07d9-6ef0-4a0b-b800-bcd6c1b4dc0c",
      "name": "Note adhésive10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -240
      ],
      "parameters": {
        "color": 4,
        "width": 470,
        "height": 520,
        "content": "## Loop\n\nLoop on each ID to get the policy details.\nOnce done the XML output is converted to JSON\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a9352d9b-b4d4-4a42-b1f7-9a311312485b",
      "name": "Note adhésive2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        976,
        -240
      ],
      "parameters": {
        "height": 360,
        "content": "## Set\nSet the fields to show in the XLSX output"
      },
      "typeVersion": 1
    },
    {
      "id": "46f2f4ce-a981-465c-a5af-4d4316164385",
      "name": "Définir les champs",
      "type": "n8n-nodes-base.set",
      "position": [
        1040,
        -96
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "bfeee80d-4878-4e0b-b4b1-84c648f901ff",
              "name": "ID",
              "type": "number",
              "value": "={{ $json.policy.general.id }}"
            },
            {
              "id": "be741659-a897-4190-837c-1e91958cd26f",
              "name": "Policy Name",
              "type": "string",
              "value": "={{ $json.policy.general.name }}"
            },
            {
              "id": "b69579f9-200b-4960-b985-62ccddf1251d",
              "name": "Category",
              "type": "string",
              "value": "={{ $json.policy.general.category.name }}"
            },
            {
              "id": "10420196-7d61-463b-ab21-b74929e1d0cb",
              "name": "Trigger",
              "type": "string",
              "value": "={{ $json.policy.general.trigger }}"
            },
            {
              "id": "fcfa2c98-d7b7-46cd-91a7-09f10c743ea6",
              "name": "Frequency",
              "type": "string",
              "value": "={{ $json.policy.general.frequency }}"
            },
            {
              "id": "744213ce-da86-4b07-9707-63c28dcbd5f0",
              "name": "Scope - Computers",
              "type": "string",
              "value": "={{ \n  $json.policy.scope.all_computers === \"true\"\n    ? \"All\"\n    : Array.isArray($json.policy.scope.computers?.computer)\n      ? $json.policy.scope.computers.computer.length\n      : $json.policy.scope.computers?.computer\n        ? \"1\"\n        : \"None\"\n}}\n"
            },
            {
              "id": "dc229e19-652a-4c92-9b76-e4f4eae15c13",
              "name": "Self Service",
              "type": "string",
              "value": "={{ $json.policy.self_service.use_for_self_service }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "fd80fda5-d6c8-4b26-b45c-7d60571064b2",
      "name": "Note adhésive3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1248,
        -240
      ],
      "parameters": {
        "color": 7,
        "width": 340,
        "height": 360,
        "content": "## Convert & Send\nConvert the selected JSON field to xlsx and send the file to slack"
      },
      "typeVersion": 1
    },
    {
      "id": "59596d74-768a-4e0f-9074-80580d1b5bf6",
      "name": "Convertir",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        1280,
        -96
      ],
      "parameters": {
        "options": {},
        "binaryPropertyName": "=data"
      },
      "typeVersion": 1.1
    }
  ],
  "pinData": {},
  "connections": {
    "0f55f295-4b0c-49d4-8d99-2658d17742a2": {
      "main": [
        [
          {
            "node": "46f2f4ce-a981-465c-a5af-4d4316164385",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7d304368-ae37-4508-b76d-d9f5dca6e353": {
      "main": [
        [
          {
            "node": "d8ba1ba1-d77d-4062-801a-83a594b266a1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "59596d74-768a-4e0f-9074-80580d1b5bf6": {
      "main": [
        [
          {
            "node": "d73f87b7-a4c2-4ac2-9986-fe4ba78e45b3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f3e2dd39-75d2-4021-80a2-ba252066474e": {
      "main": [
        [
          {
            "node": "bebaba2f-376e-4b3e-96af-7c9424f26108",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "46f2f4ce-a981-465c-a5af-4d4316164385": {
      "main": [
        [
          {
            "node": "59596d74-768a-4e0f-9074-80580d1b5bf6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d8ba1ba1-d77d-4062-801a-83a594b266a1": {
      "main": [
        [
          {
            "node": "0ffca65c-85dc-47e6-96a1-a2ccfa79056e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9ce5001c-3bb2-4afb-9e99-a6995e7a59ad": {
      "main": [
        [
          {
            "node": "359efbe9-baef-4136-85e2-ace0e53d0f21",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "359efbe9-baef-4136-85e2-ace0e53d0f21": {
      "main": [
        [
          {
            "node": "0f55f295-4b0c-49d4-8d99-2658d17742a2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "9ce5001c-3bb2-4afb-9e99-a6995e7a59ad",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0ffca65c-85dc-47e6-96a1-a2ccfa79056e": {
      "main": [
        [
          {
            "node": "f3e2dd39-75d2-4021-80a2-ba252066474e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b72b34e8-2c7c-4b19-81bf-a4bbfa730dd0": {
      "main": [
        [
          {
            "node": "d8ba1ba1-d77d-4062-801a-83a594b266a1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "bebaba2f-376e-4b3e-96af-7c9424f26108": {
      "main": [
        [
          {
            "node": "359efbe9-baef-4136-85e2-ace0e53d0f21",
            "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é - Opérations de sécurité

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œuds19
Catégorie1
Types de nœuds10
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