> ## Documentation Index
> Fetch the complete documentation index at: https://docs.forepost.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Calendar integration

> Schedule 1:1s and follow-ups from a Daily Brief action without leaving Forepost.

When the brief says *"Coach Sarah this week"* and you need a slot in the diary, the **→ Calendar** button on the action finds your next free 30-min slot in working hours and books a "1:1: Sarah" event. No tab-switching, no scheduling friction.

## Connect Google Calendar

OAuth — Google doesn't offer a personal-API-key path for Calendar, so this is a one-click flow rather than a paste-in token.

<Steps>
  <Step title="Click Connect Google Calendar">
    Settings → Integrations → **Connect Google Calendar**.
  </Step>

  <Step title="Authorise on Google">
    Pick the Google account you want Forepost to schedule into. The permissions screen lists exactly what we'll access: read your calendar's free/busy times, and create events on your primary calendar.
  </Step>

  <Step title="Land back in Settings">
    Google redirects you to `app.forepost.ai/integrations/google-calendar/callback`, which exchanges the code for an access token + refresh token (encrypted at rest) and bounces you to Settings.
  </Step>
</Steps>

Tokens refresh automatically. Access tokens expire every hour; Forepost refreshes inline on the next call.

## How → Calendar works

On any pending action in the Daily Brief, click **→ Calendar**:

1. Forepost calls Google `freeBusy` for your primary calendar over the next 5 working days.
2. Walks forward 30 mins at a time, skipping weekends, before-9am, and after-6pm slots, until it finds a free 30-min slot.
3. Parses a name from the action text where possible — *"Coach Sarah"* → event title `1:1: Sarah`. If no name pattern matches, the event is titled *Forepost action follow-up* with the full action text in the description.
4. Creates the event on your primary calendar. Returns the start time and a link to open in Google Calendar.

The action stays pending in Forepost — scheduling is the *delegation*, not the resolution. Mark it taken once the meeting happens.

## Optional: invite an attendee

The `POST /actions/:id/calendar` API accepts `{ attendeeEmail: "..." }` to add an attendee. The SPA doesn't surface this yet; you can hit the API directly if you need it. The default is a no-attendee event (a held slot for yourself).

## What Forepost does NOT do

* **No calendar reads beyond freeBusy.** We never read event content, attendees, or your colleagues' calendars.
* **No cross-calendar scheduling.** Only your primary calendar. If you keep work events on a secondary calendar, that's a future affordance.
* **No timezone smarts.** Slots are picked in UTC working hours (9-6). For most users that's fine; if your day starts at 8am local time, edit the event after creation.
* **No undo.** Created events live in Google. If Forepost picks a slot you don't want, delete the event directly in Google Calendar — Forepost doesn't track what it scheduled.

## Disconnecting

**Settings → Integrations → Google Calendar → Disconnect**. The encrypted access + refresh tokens are deleted immediately. Already-created events stay in Google.

To fully revoke, also remove Forepost from your Google account's authorised apps at [https://myaccount.google.com/permissions](https://myaccount.google.com/permissions).

## Privacy

Forepost stores only the OAuth access token (1h lifetime) and refresh token, both AES-GCM encrypted with the worker's key. We never see or persist event content. Every Calendar call is on-demand at the moment you click **→ Calendar**.

Required scopes:

* `calendar.events` — create events on your primary calendar
* `calendar.freebusy` — read busy ranges (no event details) to find a free slot
* `userinfo.email` — display "Connected as kian@…" in Settings
