Workflow: Functionitem Workflow
Integrations: cron, functionItem, hubspot, mailchimp, stopAndError

{"meta": {"instanceId": "workflow-f2bbc004", "versionId": "1.0.0", "createdAt": "2025-09-29T07:07:47.161988", "updatedAt": "2025-09-29T07:07:47.162000", "owner": "n8n-user", "license": "MIT", "category": "automation", "status": "active", "priority": "high", "environment": "production"}, "nodes": [{"id": "35451a0c-1ad5-4c02-804b-d19afd282b09", "name": "Get last execution timestamp", "type": "n8n-nodes-base.functionItem", "position": [540, 100], "parameters": {"functionCode": "// Code here will run once per input item.\n// More info and help: {{ $env.WEBHOOK_URL }}\n// Tip: You can use luxon for dates and $jmespath for querying JSON structures\n\n// Add a new field called 'myNewField' to the JSON of the item\nconst staticData = getWorkflowStaticData('global');\n\nif(!staticData.lastExecution){\n  staticData.lastExecution = new Date();\n}\n\nitem.executionTimeStamp = new Date();\nitem.lastExecution = staticData.lastExecution;\n\n\nreturn item;"}, "typeVersion": 1, "notes": "This functionItem node performs automated tasks as part of the workflow."}, {"id": "18ff2308-216e-4c1e-afb9-bd41ae7b5e4d", "name": "Every day at 07:00", "type": "n8n-nodes-base.cron", "position": [320, 100], "parameters": {"triggerTimes": {"item": [{"hour": 7}]}}, "typeVersion": 1, "notes": "This cron node performs automated tasks as part of the workflow."}, {"id": "53d3203b-2518-471f-9c72-2ab41303cdf2", "name": "Set new last execution timestamp", "type": "n8n-nodes-base.functionItem", "position": [1240, 100], "parameters": {"functionCode": "// Code here will run once per input item.\n// More info and help: {{ $env.WEBHOOK_URL }}\n// Tip: You can use luxon for dates and $jmespath for querying JSON structures\n\n// Add a new field called 'myNewField' to the JSON of the item\nconst staticData = getWorkflowStaticData('global');\n\nstaticData.lastExecution = $item(0).$node[\"Get last execution timestamp\"].executionTimeStamp;\n\nreturn item;"}, "executeOnce": true, "typeVersion": 1, "notes": "This functionItem node performs automated tasks as part of the workflow."}, {"id": "bf6f8843-53e8-4096-8614-da0b43f5f193", "name": "Create/Update contact", "type": "n8n-nodes-base.hubspot", "position": [1020, 100], "parameters": {"email": "={{ $json[\"email_address\"] }}", "resource": "contact", "authentication": "{{ $credentials.appToken }}", "additionalFields": {"lastName": "={{ $json[\"merge_fields\"].LNAME }}", "firstName": "={{ $json[\"merge_fields\"].FNAME }}"}}, "credentials": {"hubspotAppToken": {"id": "{{ $credentials.hubspotAppToken.id }}", "name": "HubSpot App Token account"}}, "typeVersion": 1, "notes": "This hubspot node performs automated tasks as part of the workflow."}, {"id": "6bce7f89-e22e-4372-a1cc-1723756bb617", "name": "Get changed members", "type": "n8n-nodes-base.mailchimp", "position": [780, 100], "parameters": {"list": "bcfb6ff8f1", "options": {"sinceLastChanged": "={{ $json[\"lastExecution\"] }}"}, "operation": "getAll"}, "credentials": {"mailchimpApi": {"id": "{{ $credentials.mailchimpApi.id }}", "name": "Mailchimp account"}}, "typeVersion": 1, "notes": "This mailchimp node performs automated tasks as part of the workflow."}, {"id": "error-8870bdf1", "name": "Error Handler", "type": "n8n-nodes-base.stopAndError", "typeVersion": 1, "position": [1000, 400], "parameters": {"message": "Workflow execution error", "options": {}}}], "connections": {}, "name": "Functionitem Workflow", "description": "Automated workflow: Functionitem Workflow. This workflow processes data and performs automated tasks.", "settings": {"executionOrder": "v1", "saveManualExecutions": true, "callerPolicy": "workflowsFromSameOwner", "errorWorkflow": null, "timezone": "UTC", "executionTimeout": 3600, "maxExecutions": 1000, "retryOnFail": true, "retryCount": 3, "retryDelay": 1000}, "tags": ["automation", "n8n", "production-ready", "excellent", "optimized"], "notes": "Excellent quality workflow: Functionitem Workflow. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."}