Automate Task & Calendar Management with n8n & OpenAI Agents

Discover how this unique n8n workflow integrates OpenAI LangChain agents to automate task creation in Notion and calendar events in Google Calendar, reducing manual scheduling errors and saving hours weekly.
agent
toolWorkflow
lmChatOpenAi
+6
Workflow Identifier: 1210
NODES in Use: webhook, set, chatTrigger, agent, toolWorkflow, memoryBufferWindow, lmChatOpenAi, toolHttpRequest, respondToWebhook
Automate tasks with n8n and OpenAI

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What This Workflow Does

This n8n workflow listens to chat messages and figures out if the user wants to schedule a calendar event or create a task in Notion.
It uses AI agents to understand the request and routes it to the right tool automatically.
The workflow saves time by avoiding manual entry and prevents double-bookings or missed task details.


Who Should Use This Workflow

This workflow is good for anyone managing many meetings and tasks in Google Calendar and Notion.
It helps those who want to reduce time spent on manual scheduling and task logging.
Professionals with multiple projects and tight schedules will find it useful.


Tools and Services Used

  • OpenAI GPT-4o Model: Understands chat messages with zero randomness for clear results.
  • LangChain Agents: Split tasks between calendar and task creation based on user intent.
  • Google Calendar API: Checks availability and books events.
  • Notion API: Creates and manages tasks in the user’s Notion database.
  • n8n Webhook: Receives secure POST chat requests with authentication headers.
  • Window Buffer Memory: Saves conversation context for up to 15 chat turns per session.

Inputs, Processing, and Output

Inputs

The workflow starts with the Webhook node receiving JSON payloads with “prompt” (the chat text) and “sessionID” (to keep track of the conversation).

Processing Steps

  • Extract and map raw chat data using a Set (Map Fields) node.
  • The Main LangChain Agent reads the prompt and session context to decide which sub-agent to use.
  • If the message relates to calendar events, the calendarAgent sub-workflow checks calendar availability via Google Calendar API.
  • If booking conflicts exist, the calendar agent suggests alternative times and seeks user confirmation before scheduling.
  • If it’s a task request, the taskAgent sub-workflow chats with the user for required info and then creates tasks in Notion.
  • Window Buffer Memory nodes keep past conversation details so the AI remembers session context.

Output

The workflow replies through the Respond to Webhook node sending clean, formatted text back to the user.
Tasks appear in Notion, and calendar events show up in Google Calendar.


Beginner Step-by-Step: How to Use This Workflow in n8n

Step 1: Import Workflow

  1. Click the Download button on this page to save the workflow file.
  2. Inside n8n, go to the editor and select Import from File.
  3. Choose the downloaded file to load all nodes and settings.

Step 2: Add and Update Credentials

  1. Provide Google Calendar OAuth2 credentials in n8n’s credential manager.
  2. Provide Notion API key and update the Notion database ID in the HTTP Request node for task creation.
  3. Enter the OpenAI API key with GPT-4o enabled.

Step 3: Configure Webhook

  1. Make sure header authentication matches your chat client setup.
  2. Note the webhook URL path like “46116445-3b13-48c0-9a38-cd034bee92ac” to send chat messages.

Step 4: Test the Workflow

  1. Send a POST request to the webhook URL with a JSON body:
{
  "prompt": "Schedule a meeting with team",
  "sessionID": "session123"
}

Check if the workflow replies and creates calendar events or Notion tasks appropriately.

Step 5: Activate for Production

  1. Activate the main workflow and the two sub-workflows in n8n.
  2. Monitor logs to confirm smooth operation.
  3. Share the webhook URL and usage instructions with your team.

For running n8n on your own server, consider self-host n8n for better control.


Common Problems and Fixes

  • 401 Unauthorized Errors: Usually caused by expired or wrong API keys.
    Fix by redoing authentication in n8n credentials.
  • Memory Context Lost Between Requests: Happens when session IDs are not consistent.
    Ensure the same sessionId key is used in all memory nodes.
  • Tasks Not Created in Notion: Could be wrong database ID or missing permissions.
    Check the Notion database ID and API token scope.

Customization Ideas

  • Change default timezone for calendar events by editing the Settings1 node.
  • Modify Notion task priority options in the HTTP Request node payload.
  • Increase conversation memory length by adjusting Window Buffer Memory nodes.
  • Tweak OpenAI temperature to vary how creative AI responses are.
  • Add more agents and sub-workflows for other services beyond calendar and tasks.

Summary of Results

✓ Saves roughly 5 hours per week by cutting manual scheduling and task entry.
✓ Prevents double-bookings and missed task details.
✓ Supports multi-turn chat conversations with lasting context.
✓ Automatically books Google Calendar events and creates Notion tasks.
→ Lets users focus more on managing work and less on data entry.


Automate tasks with n8n and OpenAI

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

The Main LangChain Agent reads user chat input and routing context, then decides if the request relates to calendar events or task creation. It sends the request to either the calendarAgent or taskAgent sub-workflows.
It uses Window Buffer Memory nodes with a context window of 15, keyed by sessionId. This stores prior chat turns to maintain context and improve response accuracy.
Check that the Notion database ID is correct and that the API token has permissions to create entries. Adjust settings in the HTTP Request node if needed.
No. The workflow currently only supports Google Calendar using OAuth2. Integrating other calendar services requires modifying the HTTP Request nodes and API calls accordingly.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.