Category: Automations › Start a New Business · Best for: Solo founders managing their own schedule · Platform: n8n · Steps: 6
What it does
Tell the AI what you want, like 'book lunch Friday at 1', and it adds it to your calendar.
It triggers the workflow whenever a message is sent to the chat interface.
Works with: OpenAI, Memory Buffer Window, Google Calendar, Agent
What you get
- The n8n workflow file (
workflow.json), ready to import - This setup guide
- The list of fields to change for your own accounts (see Install below)
- Email support if you get stuck
Before you start
-
An n8n account. Easiest: n8n Cloud (free trial). Self-host for free with Docker:
docker run -it --rm -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n, then open http://localhost:5678. -
Accounts and API keys for these services:
- OpenAI API key: how to connect (used by OpenAI Chat Model)
- Google (Sheets, Gmail, Drive, Calendar, Docs): how to connect (used by Google Calendar - Get Events, Google Calendar - Create events)
Install
- In n8n, click Create workflow (top right).
- Click the ⋯ menu → Import from file and choose
workflow.json. Or open the file, copy everything and paste it onto the empty canvas with Ctrl/Cmd + V. - Open each node with a red warning triangle and pick or create the matching credential from the list above.
- Point these fields at your own sheets, chats and accounts:
- Google Calendar - Get Events →
calendar: choose your own - Google Calendar - Create events →
calendar: choose your own
- Google Calendar - Get Events →
- Click Save.
Test it
- Click Test workflow (or Execute workflow). When chat message received starts it. Trigger it once with real sample data.
- Click each node to check its output. A green tick means the step worked.
- Fix any red node: it's almost always a credential or a field that still points at a sheet or chat that isn't yours.
Go live
Toggle Active (top right). From now on it runs on its own. Check Executions in the left sidebar to see every run.
How it works, step by step
- When chat message received starts the workflow (Chat).
- OpenAI Chat Model uses AI (OpenAI).
- Window Buffer Memory uses AI (Memory Buffer Window).
- Google Calendar - Get Events uses Google Calendar to getAll.
- Google Calendar - Create events uses Google Calendar.
- Calendar AI Agent uses AI (Agent).
Extra setup notes
These notes are also on the canvas as yellow sticky notes:
Chat trigger - When a message is received
This node is the entry point of the workflow. It triggers the workflow whenever a message is sent to the chat interface.
Options with n8n:
- Embed the chat interface anywhere you want.
- Use a webhook node instead of this node to connect with interfaces like Streamlit or OpenWebUI.
- Use nodes for communication platforms (Slack, Teams, Discord, etc.) if you know how to configure them.
Tools Agent - Calendar AI Agent
This node configures the AI agent for interaction with Google Calendar. It includes the following features:
- A prompt source: This is the user message derived from the chat input of the preceding node (
When chat message is received). - A system message: This defines the system prompt to guide the AI agent's behavior. It incorporates the variable
{{ DateTime.local().toFormat('cccc d LLLL yyyy') }, allowing the AI agent to determine the current date and interact with Google Calendar accordingly. For example, the agent can understand a request like "Create an event called 'n8n workflow review' for next Tuesday."
n8n nodes come with built-in guardrails, ensuring that if the user requests tasks outside the AI agent's setup, it may not function as intended. (Feel free to test it!)
OpenAI chat model
This node specifies the chat model used by the agent. In the template, the default LLM is gpt-4o for its high relevance.
Other options:
- You can try gpt-4o-mini, which is more cost-effective.
- You can also choose other LLM providers besides OpenAI, but make sure the LLM you select supports tool-calling.
Window buffer memory
This node manages the memory of the agent, specifically the context window length for chat history. The default is set to 5 messages.
Note: The memory is temporary. If you want to store conversations with the agent, you should use other nodes like Postgres chat memory. This can be easily set up with services like Supabase.
Google Calendar - Get Events
This sub-node is a tool used by the AI agent. Its purpose is to retrieve events based on the user input. For example: "Can you give me the events from last week about internal process ?"
The AI agent is designed to use this tool only when it has a date range. If the user hasn’t provided a date range, the AI agent will ask the user for it.
The variables {{ $fromAI('start_date') }} and {{ $fromAI('end_date') }} are dynamically filled by the AI.
Google Calendar - Create Events
This sub-node is a tool used by the AI agent. Its purpose is to create events based on the user input. For example: "Can you create an event 'Quarter revenue meeting' on [date] from [hour] to [hour] ?"
The AI agent is designed to use this tool only when it has a date range.
If the user hasn’t provided a date range, the AI agent will ask the user for it.
The variables {{ $fromAI('start_date') }} and {{ $fromAI('end_date') }} are dynamically filled by the AI.
Before creating the event, the AI agent will confirm with the user if the title and description of the event are correct. The variables used for this are:
{{ $fromAI('event_title') }}{{ $fromAI('event_description') }}
Having fun with it ? Here’s how to level up this AI agent !
This workflow demonstrates how easily you can set up an AI agent to call tools for you using n8n. The tasks here are useful but very basic.
If you want to enhance the tool-calling capabilities, consider the following:
-
Explore the "options" in the Google Calendar nodes to see additional features you can use. For example, let the AI agent add attendees to events it creates.
-
Implement the AI agent with your teammates and link it to each calendar. Use a
{{ $fromAI('') }}variable for the calendar field and refine the prompts to suit your needs. -
Add more actions for the AI agent to perform with the Google Calendar API, expanding its functionality.
Troubleshooting
- "Credentials not found": open the node and select your credential again.
- Google "access blocked": in Google Cloud, add your email as a test user on the OAuth consent screen.
- Webhook not firing: copy the node's Production URL (not Test URL) into the other app, and make sure the workflow is Active.
- AI node errors: check your API key has billing enabled and the model name exists on your plan.
- Nothing happens on schedule: the workflow must be Active, and self-hosted n8n must stay running.
Need help?
Reply to your Morning Method order email and we'll help you get it running.
© Morning Method