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

# Google Integration

> Connect Fliiq to Gmail, Calendar, Drive, Sheets, Docs, and Slides via OAuth

Fliiq integrates with Google in two distinct ways. Understanding the difference is important:

<CardGroup cols={2}>
  <Card title="Fliiq's Own Channel" icon="robot">
    Give Fliiq its own Gmail address so people can email it directly — like texting a friend. Fliiq receives messages and responds from its own inbox.

    This is a **channel** — a way to talk *to* Fliiq.

    [Set up Fliiq's email channel →](/channels/email)
  </Card>

  <Card title="Managing Your Accounts" icon="inbox">
    Authorize Fliiq to access *your* Gmail, Calendar, Drive, Sheets, Docs, and Slides. Fliiq manages your inbox, schedules meetings, organizes files, builds spreadsheets, and drafts documents.

    This is **account access** — Fliiq acts as your personal assistant.

    Keep reading below ↓
  </Card>
</CardGroup>

The rest of this guide covers the second use case: giving Fliiq access to your Google accounts so it can manage your email, calendar, and Google Workspace files.

## Prerequisites

You need a Google Cloud project with OAuth credentials. This is a one-time setup.

### 1. Create a Google Cloud Project

1. Go to the [Google Cloud Console](https://console.cloud.google.com/)
2. Create a new project (or select an existing one)
3. Name it something like "Fliiq"

### 2. Enable APIs

Enable these APIs in your project:

* **Gmail API** — [Enable here](https://console.cloud.google.com/apis/library/gmail.googleapis.com)
* **Google Calendar API** — [Enable here](https://console.cloud.google.com/apis/library/calendar-json.googleapis.com)
* **Google Drive API** — [Enable here](https://console.cloud.google.com/apis/library/drive.googleapis.com)
* **Google Sheets API** — [Enable here](https://console.cloud.google.com/apis/library/sheets.googleapis.com)
* **Google Docs API** — [Enable here](https://console.cloud.google.com/apis/library/docs.googleapis.com)
* **Google Slides API** — [Enable here](https://console.cloud.google.com/apis/library/slides.googleapis.com)

You only need to enable the APIs you plan to use. Gmail and Calendar are the most common starting point.

### 3. Create OAuth Credentials

1. Go to **APIs & Services → Credentials**
2. Click **Create Credentials → OAuth client ID**
3. Application type: **Web application**
4. Add `http://localhost:8080/callback` as an **Authorized redirect URI**
5. Copy your **Client ID** and **Client Secret**

### 4. Add to `.env`

```bash .env theme={null}
GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=GOCSPX-your-client-secret
```

<Note>
  **OAuth consent screen:** If prompted, configure the consent screen as "External" for testing. Add your own Gmail addresses as test users. You don't need to publish the app — test mode works fine for personal use.
</Note>

## Authorize Your Accounts

Once OAuth credentials are configured, authorize each Google account you want Fliiq to access:

```bash theme={null}
fliiq google auth
```

This opens your browser to the Google consent screen. Sign in with the Google account you want to authorize, grant permission, and you're done. Tokens are saved to `~/.fliiq/google_tokens.json` and auto-refresh.

Authorize as many accounts as you need:

```bash theme={null}
fliiq google auth    # Authorize your personal Gmail
fliiq google auth    # Authorize your work Gmail (sign in with work account)
```

After each authorization, Fliiq prompts you to add the account to your user profile with a label (personal, work, etc.).

### View Authorized Accounts

```bash theme={null}
fliiq google accounts
```

Lists all Google accounts you've authorized.

## User Profile

When you authorize accounts, Fliiq adds them to `~/.fliiq/user.yaml`:

```yaml theme={null}
name: Alice Doe
emails:
  - address: alice@gmail.com
    label: personal
  - address: alice.work@company.com
    label: work
```

This profile is loaded into the agent's system prompt every session, so when you say "check my work email" or "look at my personal calendar," Fliiq knows which account to use.

## What Fliiq Can Do With Your Accounts

### Gmail

With access to your Gmail, Fliiq can:

* **Read emails** — fetch your inbox, filter by unread/read/all; extracts `Message-ID`, `In-Reply-To`, `References`, `To`, and `CC` headers for full threading context
* **Send emails** — compose and send from your address, with support for `cc`, `bcc`, `in_reply_to`, and `references` for proper conversation threading
* **Mark as read** — clear unread status on processed emails
* **Archive** — move emails from Inbox to All Mail
* **Delete** — move emails to Trash
* **Daemon email listener** — when Gmail credentials are configured, the daemon polls your inbox every 60 seconds and routes inbound messages to the agent automatically. Disable with `FLIIQ_EMAIL_LISTENER=0`. Check status with `fliiq daemon status` (reports `Email: active/inactive`).

All email skills accept a `gmail_address` parameter to specify which authorized account to use. If you don't specify, Fliiq uses the first authorized account.

```
"Check my work email for unread messages"
"Send a reply to Alice's email from my personal account"
"Reply to that email and CC bob@example.com"
"Archive all the newsletters in my inbox"
"Delete the spam emails you found"
```

See the [Gmail Assistant example](/examples/gmail-assistant) for a full walkthrough.

### Google Calendar

With access to your Calendar, Fliiq can:

* **List calendars** — discover all your calendars (personal, work, shared, subscribed)
* **List events** — fetch events within any time range on any calendar
* **Create events** — schedule meetings with attendees, location, agenda, and optional Google Meet link
* **Update events** — change time, title, attendees, or details (auto-notifies attendees); add a Meet link to existing events
* **Delete events** — cancel events (auto-notifies attendees)

The calendar skill supports multi-calendar operations. Fliiq can check availability across your personal and work calendars, then schedule on the right one:

```
"What's on my calendar today?"
"Find a free 30-minute slot this week across both my work and personal calendars"
"Schedule a dentist appointment for Tuesday at 2pm on my personal calendar"
"Move tomorrow's standup to 10am and add Jake to the invite"
"Schedule a team sync for Thursday at 3pm and add a Google Meet link"
```

See the [Calendar Assistant example](/examples/calendar-assistant) for a full walkthrough.

### Google Drive

With access to your Drive, Fliiq can:

* **List files** — browse folders and see what's in them
* **Search files** — find files by name, type, or content
* **Upload files** — add new files to Drive (plain text or base64, max 5MB)
* **Export files** — export Google Docs/Sheets/Slides to PDF, CSV, and other formats
* **Create folders** — organize your Drive structure
* **Delete files** — move files to Trash

```
"Find all PDFs in my project folder on Drive"
"Upload this report to my shared team folder"
"Export the Q4 budget spreadsheet as a CSV"
```

### Google Sheets

With access to Sheets, Fliiq can:

* **Create spreadsheets** — start new spreadsheets from scratch
* **Read cell ranges** — fetch data in A1 notation (e.g. `Sheet1!A1:D10`)
* **Write cell ranges** — update data in specific cells
* **Append rows** — add new rows to existing sheets

```
"Create a spreadsheet tracking this week's expenses"
"Read the data in the Sales sheet from A1 to F50"
"Append today's metrics to the tracking spreadsheet"
```

### Google Docs

With access to Docs, Fliiq can:

* **Create documents** — start new documents
* **Read documents** — fetch document content
* **Insert text** — add content at specific positions
* **Batch update** — apply multiple formatting and content updates at once

```
"Create a meeting notes doc for today's standup"
"Read the project brief and summarize the key points"
```

### Google Slides

With access to Slides, Fliiq can:

* **Create presentations** — start new slide decks
* **Read presentations** — fetch slide content and structure
* **Add slides** — insert new slides with specific layouts
* **Insert text** — add content to shapes and text boxes
* **Batch update** — apply multiple slide updates at once

```
"Create a presentation summarizing last quarter's metrics"
"Add a new slide with the project timeline"
```

## How Authentication Works

Fliiq uses a smart resolution order for credentials:

1. **OAuth first** — if you've authorized accounts via `fliiq google auth`, Fliiq uses those tokens. They auto-refresh and give access to both Gmail and Calendar.
2. **App password fallback** — if no OAuth tokens exist, Fliiq falls back to the `GMAIL_ADDRESS` / `GMAIL_APP_PASSWORD` env vars (Gmail only, no Calendar).

For the best experience, use OAuth. It unlocks Calendar access and is more secure than app passwords.

## Fliiq's Own Email vs Your Email

A quick reference for how Fliiq decides which account to use:

| When you say...                                    | Fliiq uses...                 | Configured via                          |
| -------------------------------------------------- | ----------------------------- | --------------------------------------- |
| "Check **my** email"                               | Your authorized Gmail (OAuth) | `fliiq google auth`                     |
| "Send from **my work** email"                      | Your work Gmail (OAuth)       | `fliiq google auth` + `user.yaml` label |
| "Check **your** inbox" / "Check **Fliiq's** email" | Fliiq's own bot email         | `FLIIQ_GMAIL_ADDRESS` in `.env`         |
| "What's on **my** calendar?"                       | Your Google Calendar (OAuth)  | `fliiq google auth`                     |

Fliiq's system prompt includes both its own identity (bot email) and your user profile (authorized accounts), so it understands the context naturally.
