Workflow: Production Workflow
Integrations: function, if, merge, notion, set, stopAndError, webhook

{"nodes": [{"name": "Extract Name and Email", "type": "n8n-nodes-base.set", "position": [950, 130], "parameters": {"values": {"string": [{"name": "Name", "value": "={{$json[\"body\"][\"name\"]}}"}, {"name": "Email", "value": "={{$json[\"body\"][\"email\"]}}"}], "boolean": []}, "options": {}, "keepOnlySet": true}, "typeVersion": 1, "id": "node-00d3fe62"}, {"name": "Sign Up", "type": "n8n-nodes-base.webhook", "notes": "Example Input Data: {\"name\":\"John Doe\",\"email\":\"doe.j@northeastern.edu\"}", "position": [720, 130], "webhookId": "6d60a1b4-6706-4f21-a5fb-bace13c24b53", "parameters": {"path": "sign-up", "options": {"responseData": ""}, "httpMethod": "POST", "authentication": "{{ $credentials.basicAuth }}"}, "credentials": {"httpBasicAuth": {"id": "{{ $credentials.httpBasicAuth.id }}", "name": "Oasis Basic Auth Creds"}}, "notesInFlow": true, "typeVersion": 1, "id": "node-7e47ae02"}, {"name": "If user exists", "type": "n8n-nodes-base.if", "position": [1560, 150], "parameters": {"conditions": {"string": [], "boolean": [{"value1": "={{Object.keys($json).includes(\"id\") }}", "value2": true}]}}, "executeOnce": false, "typeVersion": 1, "alwaysOutputData": false, "id": "node-d59b24d4"}, {"name": "Create User", "type": "n8n-nodes-base.notion", "position": [1750, 240], "parameters": {"resource": "databasePage", "databaseId": "27a30c5b-c418-4200-8f48-d7fb7b043fbe", "propertiesUi": {"propertyValues": [{"key": "Name|title", "title": "={{$json[\"Name\"]}}"}, {"key": "{{ $credentials.key }}", "emailValue": "={{$json[\"Email\"]}}"}]}}, "credentials": {"notionApi": {"id": "{{ $credentials.notionApi.id }}", "name": "Oasis Hub Production"}}, "typeVersion": 1, "id": "node-db9bfe80"}, {"name": "Query for User", "type": "n8n-nodes-base.notion", "position": [1150, 230], "parameters": {"options": {"filter": {"singleCondition": {"key": "{{ $credentials.key }}", "condition": "equals", "emailValue": "={{$json[\"Email\"]}}"}}}, "resource": "databasePage", "operation": "getAll", "databaseId": "27a30c5b-c418-4200-8f48-d7fb7b043fbe"}, "credentials": {"notionApi": {"id": "{{ $credentials.notionApi.id }}", "name": "Oasis Hub Production"}}, "executeOnce": false, "typeVersion": 1, "alwaysOutputData": true, "id": "node-ea410b9d"}, {"name": "Query Current Semester", "type": "n8n-nodes-base.notion", "position": [2180, -30], "parameters": {"options": {"sort": {"sortValue": [{"key": "{{ $credentials.key }}", "direction": "descending", "timestamp": true}]}, "filter": {"singleCondition": {"key": "{{ $credentials.key }}", "condition": "equals", "checkboxValue": true}}}, "resource": "databasePage", "operation": "getAll", "returnAll": true, "databaseId": "2003319a-bc73-423a-9378-01999b4884fb"}, "credentials": {"notionApi": {"id": "{{ $credentials.notionApi.id }}", "name": "Oasis Hub Production"}}, "typeVersion": 1, "id": "node-b5ad55f4"}, {"name": "Select Semester ID", "type": "n8n-nodes-base.set", "position": [2370, -30], "parameters": {"values": {"number": [], "string": [{"name": "currentSemesterID", "value": "={{$json[\"id\"]}}"}]}, "options": {}, "keepOnlySet": true}, "typeVersion": 1, "id": "node-df3cf317"}, {"name": "Update Semester for User", "type": "n8n-nodes-base.notion", "position": [3050, 110], "parameters": {"pageId": "={{$json[\"id\"]}}", "resource": "databasePage", "operation": "update", "propertiesUi": {"propertyValues": [{"key": "{{ $credentials.key }}", "relationValue": ["={{$json[\"allSemesterIDs\"].join(',')}}"]}]}}, "credentials": {"notionApi": {"id": "{{ $credentials.notionApi.id }}", "name": "Oasis Hub Production"}}, "typeVersion": 1, "id": "node-b99cfac9"}, {"name": "Merge Semester ID", "type": "n8n-nodes-base.merge", "position": [2590, 110], "parameters": {"mode": "multiplex"}, "typeVersion": 1, "id": "node-7c993263"}, {"name": "Concatenate Semester IDs", "type": "n8n-nodes-base.function", "position": [2820, 110], "parameters": {"functionCode": "for (item of items) {\n  // Get the current semester ID\n  const currentSemesterID = item.json[\"currentSemesterID\"]\n  let allSemesterIDs = [currentSemesterID];\n\n  // Add semesters that the user is already associated with\n  if (item.json[\"Semesters\"]?.length > 0) {\n    allSemesterIDs = allSemesterIDs.concat(item.json[\"Semesters\"].filter(semesterID => semesterID !== currentSemesterID));\n  }\n\n  // Set allSemesterIDs which is used to update the relation\n  item.json[\"allSemesterIDs\"] = allSemesterIDs\n}\n\nreturn items;\n"}, "typeVersion": 1, "id": "node-0c9447dd"}, {"name": "Merge", "type": "n8n-nodes-base.merge", "position": [1340, 150], "parameters": {"mode": "mergeByKey", "propertyName1": "Email", "propertyName2": "Email"}, "typeVersion": 1, "id": "node-776f29ce"}, {"name": "Query User", "type": "n8n-nodes-base.notion", "position": [1950, 130], "parameters": {"options": {"filter": {"singleCondition": {"key": "{{ $credentials.key }}", "condition": "equals", "emailValue": "={{$json[\"Email\"]}}"}}}, "resource": "databasePage", "operation": "getAll", "returnAll": true, "databaseId": "27a30c5b-c418-4200-8f48-d7fb7b043fbe"}, "credentials": {"notionApi": {"id": "{{ $credentials.notionApi.id }}", "name": "Oasis Hub Production"}}, "typeVersion": 1, "alwaysOutputData": true, "id": "node-fc9f87f0"}, {"id": "error-bf74c630", "name": "Error Handler", "type": "n8n-nodes-base.stopAndError", "typeVersion": 1, "position": [1000, 400], "parameters": {"message": "Workflow execution error", "options": {}}}], "connections": {}, "name": "Production Workflow", "settings": {"executionOrder": "v1", "saveManualExecutions": true, "callerPolicy": "workflowsFromSameOwner", "errorWorkflow": null, "timezone": "UTC", "executionTimeout": 3600, "maxExecutions": 1000, "retryOnFail": true, "retryCount": 3}, "meta": {"instanceId": "workflow-5928ee22", "versionId": "1.0.0", "createdAt": "2025-09-29T07:07:51.182418", "updatedAt": "2025-09-29T07:07:51.182451", "owner": "n8n-user", "license": "MIT", "category": "automation", "status": "active", "priority": "high", "environment": "production"}, "tags": ["automation", "n8n", "production-ready", "excellent", "optimized"], "description": "Production-ready workflow: Production Workflow. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."}