{
  "id": "B8hlmGjCDQd1Aelk",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "entra -> seventhings",
  "tags": [],
  "nodes": [
    {
      "id": "9ca27b03-1308-45e0-951a-9ac9adf4fb0a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        -160
      ],
      "parameters": {
        "width": 480,
        "height": 704,
        "content": "## entra -> seventhings\n\n### How it works\n\nThis workflow transfers the most recently created user from Microsoft Entra into seventhings. It starts from a replaceable manual trigger, fetches all Entra users, sorts and limits the list to the newest account, then creates that user in seventhings.\n\n### Setup steps\n\n- Configure Microsoft Entra credentials with permission to read users.\n- Configure seventhings credentials with permission to create users.\n- Verify the sort node uses the correct Entra creation timestamp field and sort direction for newest-first results.\n- Replace the manual trigger with a production trigger, such as a schedule or webhook, if automation is required.\n\n### Customization\n\nAdjust the trigger timing, filtering, or limit count if you want to sync more than only the newest user."
      },
      "typeVersion": 1
    },
    {
      "id": "9d5677a1-2eab-4f55-a6e5-52cae2defbe7",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 320,
        "content": "## Trigger and fetch users\n\nStarts the workflow with a replaceable manual trigger and retrieves all users from Microsoft Entra."
      },
      "typeVersion": 1
    },
    {
      "id": "6aa0809b-057d-45a8-97d1-d2fdd878182a",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 320,
        "content": "## Select newest user\n\nSorts the retrieved Entra users to find the most recently created account, then limits the output to that single newest user."
      },
      "typeVersion": 1
    },
    {
      "id": "af84eac3-6b55-4320-ac4a-f35d83fff82a",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 240,
        "height": 320,
        "content": "## Create seventhings user\n\nCreates the selected newest Entra user in seventhings."
      },
      "typeVersion": 1
    },
    {
      "id": "c97fa828-0f02-4162-b18c-0660a7304e52",
      "name": "Fetch All Users from Entra",
      "type": "n8n-nodes-base.microsoftEntra",
      "position": [
        208,
        0
      ],
      "parameters": {
        "fields": [
          "createdDateTime",
          "department",
          "givenName",
          "surname",
          "mail",
          "userPrincipalName"
        ],
        "output": "fields",
        "returnAll": true,
        "requestOptions": {}
      },
      "credentials": {
        "microsoftEntraOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6bf1840e-c099-4acd-a982-5060369453a4",
      "name": "Sort by Creation Date",
      "type": "n8n-nodes-base.sort",
      "position": [
        448,
        0
      ],
      "parameters": {
        "options": {},
        "sortFieldsUi": {
          "sortField": [
            {
              "order": "descending",
              "fieldName": "createdDateTime"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "426c2a73-3a56-4859-91d8-e6e8352d9a18",
      "name": "Limit to Latest 10 Users",
      "type": "n8n-nodes-base.limit",
      "position": [
        656,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "b4a714b2-9bb1-44d4-9a52-5c7c40103557",
      "name": "Create Users in Seventhings",
      "type": "@seventhingscompany/n8n-nodes-seventhings.seventhings",
      "position": [
        880,
        0
      ],
      "parameters": {
        "fields": {
          "value": {
            "email": "={{ $json.userPrincipalName }}",
            "last_name": "={{ $json.surname }}",
            "department": "={{ $json.department }}",
            "first_name": "={{ $json.givenName }}"
          },
          "schema": [
            {
              "id": "user_uuid",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "user_uuid",
              "defaultMatch": false
            },
            {
              "id": "first_name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "firstname",
              "defaultMatch": false
            },
            {
              "id": "last_name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "lastname",
              "defaultMatch": false
            },
            {
              "id": "email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "email",
              "defaultMatch": false
            },
            {
              "id": "department",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "GF",
                  "value": "GF"
                },
                {
                  "name": "IT",
                  "value": "IT"
                },
                {
                  "name": "HR",
                  "value": "HR"
                },
                {
                  "name": "Sonstiges",
                  "value": "Sonstiges"
                }
              ],
              "removed": false,
              "required": false,
              "displayName": "department",
              "defaultMatch": false
            },
            {
              "id": "picture",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "picture",
              "defaultMatch": false
            },
            {
              "id": "documents",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "documents",
              "defaultMatch": false
            },
            {
              "id": "updated_by_user_id",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "updated_by_user_id",
              "defaultMatch": false
            },
            {
              "id": "updated_at",
              "type": "dateTime",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "updated_at",
              "defaultMatch": false
            },
            {
              "id": "created_at",
              "type": "dateTime",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "created_at",
              "defaultMatch": false
            },
            {
              "id": "id",
              "type": "number",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": false
            },
            {
              "id": "imported_by_user_id",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "imported_by_user_id",
              "defaultMatch": false
            },
            {
              "id": "imported_at",
              "type": "dateTime",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "imported_at",
              "defaultMatch": false
            },
            {
              "id": "created_on_import_with_template_id",
              "type": "number",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "created_on_import_with_template_id",
              "defaultMatch": false
            },
            {
              "id": "person_uuid",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "person_uuid",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "resource": "person"
      },
      "credentials": {
        "seventhingsApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3afb5c21-9697-439d-857c-d45bc81e4bb9",
      "name": "Manual Start Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "80bf9397-7688-437b-99b9-25e55f8b6a24",
  "nodeGroups": [],
  "connections": {
    "Manual Start Trigger": {
      "main": [
        [
          {
            "node": "Fetch All Users from Entra",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sort by Creation Date": {
      "main": [
        [
          {
            "node": "Limit to Latest 10 Users",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit to Latest 10 Users": {
      "main": [
        [
          {
            "node": "Create Users in Seventhings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch All Users from Entra": {
      "main": [
        [
          {
            "node": "Sort by Creation Date",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}