Multiple Google Calendar Events from JSON

Hi, new here and thank you for your help!

Describe the problem/error/question

I want to create multiple google calendar events from a json that is produced by open ai message a bot. The json looks fine.

What is the error message (if any)?

The AI agent generates 7 times the same event in google calendar. Which is good because there are 7 events in the json but bad because it does not move on to the next event with different date, title etc.

Please share your workflow

{
  "nodes": [
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "gpt-4.1-mini",
          "mode": "list",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "messages": {
          "values": [
            {
              "content": "Your role is to extract event  information of all events from the data I pass to you and outpit it in a structured format for the creation of a google calendar event. \n\nYou are to deliver the following: \n- summary: A title that you create for the event\n- start: start time is the time the event starts in CET time zone, if unclear leave blank \n- end: end time is the time the event ends in CET time zone, if unclear leave blank\n- location: The location of the event which may include online or via video conference or a physical location with an address\n- description: a short, 100 word description, that you create from the data\n\nYou receive an input of a <scraped-website>\n\nRespond in JSON Format:\n{\n   \"summary\": \"\",\n   \"start\": \"\",\n   \"end\": \"\",\n   \"location\": \"\",\n   \"description\": \"\"\n}\n",
              "role": "system"
            },
            {
              "content": "=<scraped-website>\n{{ $json.data.markdown }}\n</scraped-website> "
            }
          ]
        },
        "jsonOutput": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        32,
        0
      ],
      "id": "82685e72-9f3b-437f-bee7-932ee34a3272",
      "name": "Message a model",
      "credentials": {
        "openAiApi": {
          "id": "bbEtAqJAE1kOnlh9",
          "name": "n8n free OpenAI API credits"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.message.content.events }}",
        "options": {
          "systemMessage": "=You recieved a structured JSON input from the previous node. You are to create the calendar events based on the information."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.1,
      "position": [
        432,
        0
      ],
      "id": "5945ba0a-6a15-4dda-8363-564c2dc708d3",
      "name": "AI Agent"
    }
  ],
  "connections": {
    "Message a model": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        []
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "45a196cdc949ba42e2842eb9c1981b9f781338c7e7eb2f0d8a40c38f192870a7"
  }
}```

## Share the output returned by the last node
<!-- If you need help with data transformations, please also share your expected output. -->

## Information on your n8n setup
- **n8n version:**
- **Database (default: SQLite):**
- **n8n EXECUTIONS_PROCESS setting (default: own, main):**
- **Running n8n via (Docker, npm, n8n cloud, desktop app):**
- **Operating system:**

Hey @Waldman hope all is well, welcome to the community.

If you share the {{ $json.data.markdown }} or an example of it, we could try to repro and see what goes wrong.

The data structure must comply with the schema expected by Google Calendar (respect ISO 8601 format for dates).

If the array is large, it is recommended to configure the flow to not exceed API limits (batching, rate control).

1 Like