Skip to content

Weekly

Block focus time in next week's calendar

Every Sunday evening, two-hour focus blocks are added to next week's free slots and the plan is posted to your Slack.

Runs
Weekly
Apps
Google Calendar, Slack
AI
Optional
Access
Calendar read+write; Slack chat:write

Send this to your assistant

Create a ClickRuntime automation: every Sunday evening, add 2-hour focus blocks to next week's free slots in my Google Calendar and post the plan to my Slack.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A product designer starts every week meaning to protect time for deep work. By Tuesday her calendar is full of short meetings booked into every gap, and the design work happens in the evenings.

Claiming focus blocks before the week starts means colleagues see her as busy and book around them, and the Sunday summary shows her when the real work will happen.

What you get out of it

  • Deep work stops losing to meetings

    Blocks booked before Monday are already in your calendar when others look for a slot, so they plan around them.

  • Only free time is used

    Blocks go into gaps that are actually open, so nothing you already agreed to is moved or double-booked.

  • A plan for the week ahead

    The Slack summary shows when your focus time falls, which makes it easier to decide what to work on in each block.

  • Done every week without thinking

    The habit does not depend on remembering it on a Sunday night; it simply happens.

How it works

What happens, step by step

  1. Every Sunday evening ClickRuntime checks next week's Google Calendar for free time within your working hours.

  2. It picks open two-hour gaps, at most one per day.

  3. It adds a Focus time event in each gap, shown as busy to others.

  4. A short plan of the week's focus blocks is posted to your Slack.

Before it runs live

  • Connect Google Calendar
  • Connect Slack, then invite the app to the channel (type /invite @ClickRuntime there)

What you get

RunsWeekly
Block focus time in next week's calendartoday, 9:00Succeeded
Slack · #meFocus blocks next week: Mon 09:00-11:00, Tue 14:00-16:00, Wed 09:00-11:00, Fri 11:00-13:00

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Run it at a different time, more or less often, or only on weekdays
  • Change what the AI looks for, or how it writes the result
  • Add another app, for example also send it to Google Sheets
  • Combine it with other Google Calendar and Slack steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
weekly_focus_time_blocks.pyexample
from datetime import datetime, timedelta, timezone
from googleapiclient.discovery import build
from google.oauth2.credentials import Credentials
from clickruntime import on_trigger, credentials, notify

@on_trigger
def run(event):
    cal = build("calendar", "v3", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
    monday = (datetime.now(timezone.utc) + timedelta(days=1)).replace(hour=0, minute=0, second=0, microsecond=0)
    busy = cal.freebusy().query(body={"timeMin": monday.isoformat(), "timeMax": (monday + timedelta(days=5)).isoformat(),
                                      "items": [{"id": "primary"}]}).execute()["calendars"]["primary"]["busy"]
    spans = [(datetime.fromisoformat(b["start"].replace("Z", "+00:00")), datetime.fromisoformat(b["end"].replace("Z", "+00:00"))) for b in busy]
    plan = []
    for d in range(5):
        for hour in (9, 11, 14):
            start = monday + timedelta(days=d, hours=hour)
            end = start + timedelta(hours=2)
            if not any(s < end and e > start for s, e in spans):
                cal.events().insert(calendarId="primary", body={"summary": "Focus time", "transparency": "opaque",
                                    "start": {"dateTime": start.isoformat()}, "end": {"dateTime": end.isoformat()}}).execute()
                plan.append(f"{start:%a %H:%M}-{end:%H:%M}")
                break
    notify.slack("Focus blocks next week: " + (", ".join(plan) or "no free 2-hour slots"), channel="#me")
    return {"blocks": len(plan)}

FAQ

Common questions

How many blocks does it add?
Up to one per working day by default. You can choose a weekly total, such as six hours, and the blocks are spread across the week.
Will it book over lunch or early mornings?
No. It only uses the working hours you set, and you can exclude times such as lunch.
Can I move a block once it's booked?
Yes. The blocks are ordinary calendar events, so you can move or delete them like any other.
What permissions does it need?
Calendar read+write; Slack chat:write. Nothing else in your accounts is used.
Does it need AI?
No, but you can ask for an AI step (for example a summary). It then uses ClickRuntime's built-in AI allowance.
How many runs does it use?
One run each time it runs (weekly). Checks that find nothing to do and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Block focus time in next week's calendar” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.