ChatGPTWorkPlanningAI score · PendingAI-assisted edit · no obvious prompt-injection riskn8n.io

n8n AI Agent: Google Calendar Assistant

Chat input → AI agent (OpenAI + tool calling) → create or query Google Calendar events

BeginnerStepsWorkflowPrompt
Who
n8n beginners building their first AI agent that operates Google Calendar
You get
Create calendar events or retrieve events in a date range via a chat interface
You need
n8n · Google Calendar

Constraints

Prerequisites: n8n instance (cloud or self-hosted), OpenAI API key, Google Calendar OAuth2 credentials. Cost: OpenAI API billed by token usage; Google Calendar API typically free. This template is ready-to-use; the main work is connecting credentials and selecting a calendar.

What they did

Author dataki published a beginner-facing template on n8n that uses a Tools Agent node connected to an OpenAI chat model, window buffer memory, and two Google Calendar tool nodes to create and retrieve calendar events via natural language. Seven sticky notes inside the workflow explain each component.

How it went

The template is presented on n8n.io as "ready-to-use"; the author states you only need to connect OpenAI credentials to start (author_report). The template had over 71,000 views at time of collection.

Worth knowing

1. Memory is temporary with a default of 5 messages. 2. Built-in guardrails may reject requests outside the agent's configured scope. 3. Enhancement ideas: let the agent add attendees, link team members to different calendars via {{ $fromAI('') }}, or add more Google Calendar API actions. 4. This site has not tested the workflow; actual OpenAI calls incur costs.

n8n workflow template

Structure checked · Not run-tested

Use “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.

Setup and test checklist

Credentials to connect

  • OpenAI Chat Model node: connect OpenAI API credentials.
  • Google Calendar - Get Events node: connect Google Calendar OAuth2 credentials.
  • Google Calendar - Create events node: connect Google Calendar OAuth2 credentials.

Configuration to replace

  • Source template is n8n public workflow #2703 (~13 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
  • Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.

Test input and expected output

  • Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
  • Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.

Template changes

  • Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
  • No business-logic edits; verify keys, quotas and privacy compliance before use.

Template retrieved: 2026-10-25

Steps

  1. Configure Chat Trigger

    Add the "When chat message received" node as the workflow entry point. This node triggers the workflow when a message is sent to the chat interface. Options: embed the n8n chat interface, use a Webhook node to connect Streamlit/OpenWebUI, or use platform nodes (Slack, Teams, Discord) if you know how to configure them.

  2. Configure AI Agent and System Prompt

    Add the "Calendar AI Agent" node (Tools Agent type). Set the Prompt source to upstream chat input ({{ $json.chatInput }}). Paste the source-provided system message into the System Message field, which includes the current date variable {{ DateTime.local().toFormat('cccc d LLLL yyyy') }} so the agent understands relative dates like "next Tuesday."

    Execution prompt · Source text。Calendar AI Agent node System Message field

    =You are a Google Calendar assistant.
    Your primary goal is to assist the user in managing their calendar effectively using two tools: Event Creation and Event Retrieval. Always base your responses on the current date: 
    {{ DateTime.local().toFormat('cccc d LLLL yyyy') }}.
    General Guidelines:
    If the user's initial message is vague (e.g., "hello" or a generic greeting) or does not specify a request, explain your capabilities clearly:
    Example: "Hello! I can help you manage your Google Calendar. You can ask me to create an event or retrieve event data. What would you like me to do?"
    If the user specifies a request in their first message, begin preparing to use the appropriate tool:
    For event creation, gather necessary details like start date, end date, title, and description.
    For event retrieval, ask for the date range or time period they want to query.
    Tool: Event Creation
    When asked to create an event:
    
    Request the start and end dates/times from the user.
    Date format: YYYY-MM-DD HH:mm:ss
    Collect the following information:
    start_date: Exact start date and time of the event.
    end_date: Exact end date and time of the event.
    event_title: Event title in uppercase. Suggest one if not provided.
    event_description: Generate a brief description and present it for confirmation.
    Tool: Event Retrieval
    When asked to retrieve events:
    
    Ask for the date range or period they are interested in. Examples:
    For "last week," retrieve events from Monday of the previous week to Friday of the same week.
    For "today," use the current date.
    Format the date range:
    start_date: Start date and time in YYYY-MM-DD HH:mm:ss.
    end_date: End date and time in YYYY-MM-DD HH:mm:ss.
    Key Behaviors:
    Clarity: Provide a clear and helpful introduction when the user's request is unclear.
    Validation: Confirm details with the user before finalizing actions.
    Adaptation: Handle varying levels of detail in requests (e.g., "Add a meeting for next Monday morning" or "Retrieve my events for this weekend").
    Proactivity: Offer suggestions to fill in missing details or clarify ambiguous inputs.
    Language Matching: Ensure all interactions, including event titles, descriptions, and messages, are in the user's language to provide a seamless experience.
  3. Configure OpenAI Chat Model

    Add the "OpenAI Chat Model" node and connect it to the AI agent's Language Model socket. Default model is gpt-4o. You can switch to gpt-4o-mini for lower cost, or use another LLM provider that supports tool-calling.

  4. Configure Window Buffer Memory

    Add the "Window Buffer Memory" node and connect it to the AI agent's Memory socket. Default context window is 5 messages. Note: this memory is temporary and lost on restart; for persistent chat history, switch to nodes like Postgres Chat Memory (e.g., Supabase).

  5. Configure Google Calendar Get Events Tool

    Add the "Google Calendar - Get Events" node and connect it to the AI agent's Tool socket. Set operation to getAll. In timeMin and timeMax, enter {{ $fromAI('start_date') }} and {{ $fromAI('end_date') }} respectively, dynamically filled by the AI agent. Select a target calendar and bind Google Calendar OAuth2 credentials.

  6. Configure Google Calendar Create Events Tool

    Add the "Google Calendar - Create events" node and connect it to the AI agent's Tool socket. For start and end, use {{ $fromAI('start_date') }} and {{ $fromAI('end_date') }}; in additionalFields, set summary to {{ $fromAI('event_title') }} and description to {{ $fromAI('event_description') }}. The AI agent will confirm the title and description with the user before creating. Select a target calendar and bind Google Calendar OAuth2 credentials.

Prompt you can copy

Setup guidance · Editorial suggestion。Give to setup assistant; confirm inputs and permissions first

This block is the prompt. Ads are never placed here.

You are a setup guide for the n8n Template 2703 Google Calendar AI Agent. First confirm: 1) does the user have an n8n instance; 2) do they have an OpenAI API key; 3) have they completed Google Calendar OAuth2 authorization. Then guide them through importing the template, configuring credentials, selecting a calendar, and testing event creation and retrieval.

This prompt is for setup assistance, not a node runtime instruction. The actual system prompt is in step 2 prompts.

Source

AI agent : Google calendar assistant using OpenAI · dataki · n8n.io · 2025-01-07

Comments & feedback

Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.

Loading…

    Related