{
  "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: https://docs.n8n.io/nodes/n8n-nodes-base.functionItem\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
    },
    {
      "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
    },
    {
      "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: https://docs.n8n.io/nodes/n8n-nodes-base.functionItem\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
    },
    {
      "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": "appToken",
        "additionalFields": {
          "lastName": "={{ $json[\"merge_fields\"].LNAME }}",
          "firstName": "={{ $json[\"merge_fields\"].FNAME }}"
        }
      },
      "typeVersion": 1
    },
    {
      "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"
      },
      "typeVersion": 1
    },
    {
      "id": "cf6af4fe-2990-5caf-acb9-2c0d02b73f3b",
      "name": "Publication · Overview and setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -800,
        0
      ],
      "parameters": {
        "content": "# get last execution timestamp and every day at 07 00 and set new last execution timestamp\n\n## Purpose and structure\nThis folder contains the **get last execution timestamp and every day at 07 00 and set new last execution timestamp** workflow. Its executable nodes use `cron`, `functionItem`, `hubspot`, `mailchimp`. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.\n\n## Setup\nImport inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.\n\n## Entry points\nEvery day at 07:00\n\n## Verification\nSanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.\n\n## Attribution\nhttps://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Hubspot/0244_HubSpot_Mailchimp_Create_Scheduled.json\nMIT; preserve source notices.",
        "width": 700,
        "height": 800,
        "color": 1
      }
    }
  ],
  "connections": {
    "Every day at 07:00": {
      "main": [
        [
          {
            "node": "Get last execution timestamp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get changed members": {
      "main": [
        [
          {
            "node": "Create/Update contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create/Update contact": {
      "main": [
        [
          {
            "node": "Set new last execution timestamp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get last execution timestamp": {
      "main": [
        [
          {
            "node": "Get changed members",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false
}
