# bagpotato/notion-gmail architecture

> Architecture diagram of the GitHub repository bagpotato/notion-gmail, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bagpotato/notion-gmail
- Repository: https://github.com/bagpotato/notion-gmail

## Overview

This Google Apps Script automation turns qualifying Gmail messages into Notion tasks. The documented workflow includes sender authorization, task details, optional attachment uploads, and Gmail follow-up actions. Configuration supplies API credentials and database IDs; a trigger starts the automation. The source files were not excerpted, so the component boundaries and relationships below reflect README documentation only, not inspected implementation details.

Main entry points: [`Main.gs`](https://github.com/bagpotato/notion-gmail/blob/main/Main.gs) (Sync automation), [`Config.gs`](https://github.com/bagpotato/notion-gmail/blob/main/Config.gs) (API and database config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Email workflow"]
  node_automation["Sync automation<br/>[Main.gs]"]
  node_authorization["Sender security<br/>[Main.gs]"]
  node_task_details["Task details<br/>[Main.gs]"]
  node_thread_link["Gmail deep link<br/>[Main.gs]"]
  node_auto_reply["Confirmation reply<br/>[Main.gs]"]
  node_labeling["Processed or error labels<br/>[Main.gs]"]
end

subgraph group_integrations["Connected services"]
  node_gmail["Gmail"]
  node_notion[("Notion database")]
  node_drive[("Google Drive")]
end

subgraph group_setup["Configuration"]
  node_config["API and database config<br/>[Config.gs]"]
  node_trigger["Automation trigger<br/>[Main.gs]"]
end

node_sender(("Email sender"))

node_sender -->|"sends email"| node_gmail
node_gmail -->|"provides messages"| node_automation
node_trigger -->|"starts"| node_automation
node_config -->|"configures"| node_automation
node_automation -->|"checks sender"| node_authorization
node_automation -->|"extracts details"| node_task_details
node_automation -->|"creates task"| node_notion
node_automation -->|"uploads attachments"| node_drive
node_automation -->|"adds thread link"| node_thread_link
node_automation -->|"sends confirmation"| node_gmail
node_automation -->|"applies labels"| node_gmail

click node_automation "https://github.com/bagpotato/notion-gmail/blob/main/Main.gs"
click node_authorization "https://github.com/bagpotato/notion-gmail/blob/main/Main.gs"
click node_task_details "https://github.com/bagpotato/notion-gmail/blob/main/Main.gs"
click node_config "https://github.com/bagpotato/notion-gmail/blob/main/Config.gs"
click node_trigger "https://github.com/bagpotato/notion-gmail/blob/main/Main.gs"
click node_thread_link "https://github.com/bagpotato/notion-gmail/blob/main/Main.gs"
click node_auto_reply "https://github.com/bagpotato/notion-gmail/blob/main/Main.gs"
click node_labeling "https://github.com/bagpotato/notion-gmail/blob/main/Main.gs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_automation,node_authorization,node_task_details,node_thread_link,node_auto_reply,node_labeling toneBlue
class node_gmail,node_notion,node_drive toneAmber
class node_config,node_trigger toneMint
class node_sender toneIndigo
```

## Components

### Email workflow

- [Sync automation](https://github.com/bagpotato/notion-gmail/blob/main/Main.gs): `Main.gs`
- [Sender security](https://github.com/bagpotato/notion-gmail/blob/main/Main.gs): `Main.gs`
- [Task details](https://github.com/bagpotato/notion-gmail/blob/main/Main.gs): `Main.gs`
- [Gmail deep link](https://github.com/bagpotato/notion-gmail/blob/main/Main.gs): `Main.gs`
- [Confirmation reply](https://github.com/bagpotato/notion-gmail/blob/main/Main.gs): `Main.gs`
- [Processed or error labels](https://github.com/bagpotato/notion-gmail/blob/main/Main.gs): `Main.gs`

### Connected services

- **Gmail**
- **Notion database**
- **Google Drive**

### Configuration

- [API and database config](https://github.com/bagpotato/notion-gmail/blob/main/Config.gs): `Config.gs`
- [Automation trigger](https://github.com/bagpotato/notion-gmail/blob/main/Main.gs): `Main.gs`

### Other components

- **Email sender**

## Connections

- Email sender → Gmail: sends email (evidence: `README.md`)
- Gmail → Sync automation: provides messages (evidence: `README.md`)
- Automation trigger → Sync automation: starts (evidence: `README.md`)
- API and database config → Sync automation: configures (evidence: `README.md`)
- Sync automation → Sender security: checks sender (evidence: `README.md`)
- Sync automation → Task details: extracts details (evidence: `README.md`)
- Sync automation → Notion database: creates task (evidence: `README.md`)
- Sync automation → Google Drive: uploads attachments (evidence: `README.md`)
- Sync automation → Gmail deep link: adds thread link (evidence: `README.md`)
- Sync automation → Gmail: sends confirmation (evidence: `README.md`)
- Sync automation → Gmail: applies labels (evidence: `README.md`)
