Schedule weekly focus-time blocks with Google Calendar, OpenAI, and Slack

Go to Workflow
2 views
Built by kenta kenta
Created on July 28, 2026

Description

Quick overview
This workflow runs every Sunday at 18:00 to scan your Google Calendar for next week, find free gaps of at least two hours within your working hours, auto-book them as β€œπŸ§˜ Focus Time” events, and then DM you a personalized deep-work plan in Slack using OpenAI.

How it works
Runs every Sunday at 18:00 on a schedule.
Loads your working-hour preferences and fetches all events from your Google Calendar.
Calculates weekday-only free gaps within your working hours and keeps only gaps that meet the minimum block length.
If no qualifying gap exists, sends you a Slack DM warning that next week is too fragmented for a focus block.
If gaps exist, limits the number of blocks for the week and creates β€œπŸ§˜ Focus Time (protected by n8n)” events in Google Calendar for each selected slot.
Uses OpenAI to generate a short, personal Slack message that lists the protected blocks and suggests what kind of work fits each.
Sends the generated deep-work plan to you as a Slack DM.

Setup
Add Google Calendar credentials, select the calendar to read from and the calendar to create β€œπŸ§˜ Focus Time” events in.
Add Slack credentials and set your target Slack username in both the plan DM and warning message steps.
Add OpenAI credentials (Chat Model) and ensure the selected model is available for your account.
Adjust the working hours, minimum block length, and maximum blocks per week in the preferences values to match your schedule.

Nodes Used (5)

Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm
Code
n8n-nodes-base.code
Google Calendar
n8n-nodes-base.googleCalendar
OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi
Slack
n8n-nodes-base.slack