# Notion Meetings Processing Skill

Process Notion meeting transcriptions and create tasks.

## How It Works

### The Problem
Notion API blocks transcription blocks — can't read AI summaries programmatically.

### The Solution
Browser-based extraction via Mac node running AppleScript + Chrome.

## Quick Usage

### 1. Read Meeting Content (Mac Node)
```python
# Run on Mac Studio node
nodes.run(
    node="Mac Studio",
    command=["python3", "/Users/assafdagan/.openclaw/skills/notion-meetings/read_meeting.py", "<page_id>"],
    commandTimeoutMs=75000
)
```

Returns JSON with:
- `summary` - AI-generated summary
- `actionItems` - Extracted action items
- `fullText` - Full page text (for custom parsing)

### 2. Update Meeting Properties (VPS - API)
```python
# Update via Notion API
properties = {
    "Title": {"title": [{"text": {"content": "Meeting Title"}}]},
    "AI Processing": {"select": {"name": "Processed"}},
    "Summary": {"rich_text": [{"text": {"content": summary}}]},
    "Action Items": {"rich_text": [{"text": {"content": action_items}}]},
    "Client": {"select": {"name": "Client Name"}}
}
requests.patch(f"https://api.notion.com/v1/pages/{page_id}", headers=HEADERS, json={"properties": properties})
```

### 3. Create Tasks
```python
# Create task linked to project
properties = {
    "Task": {"title": [{"text": {"content": "[Project] Task name"}}]},
    "Status": {"select": {"name": "To Do"}},
    "Source": {"select": {"name": "Meeting"}},
    "Due": {"date": {"start": "2026-02-10"}},
    "Assignee": {"select": {"name": "Assaf"}},
    "Project": {"relation": [{"id": project_id}]}  # Optional
}
requests.post("https://api.notion.com/v1/pages", headers=HEADERS, 
              json={"parent": {"database_id": TASKS_DB}, "properties": properties})
```

## Prerequisites

1. **Chrome on Mac must have "Allow JavaScript from Apple Events" enabled**
   - Chrome → View → Developer → Allow JavaScript from Apple Events

2. **Chrome logged into Notion** (ClawdBrain workspace)

## Database Reference

| Database | ID |
|----------|-----|
| Meetings | `2f0330c2-8646-814f-8be4-c23065765eaa` |
| Tasks | `2f0330c2-8646-815a-878b-dbdd46606837` |
| Projects | `2f0330c2-8646-8181-8e22-dcab522512f6` |

## Meetings Properties
- Title (title)
- Date (date)
- Summary (rich_text)
- Action Items (rich_text)
- AI Processing (select): Processed | Organized | -
- Client (select)
- Project (relation)
- Attendees (rich_text)

## Tasks Properties
- Task (title)
- Status (select)
- Due (date)
- Assignee (select)
- Project (relation)
- Source (select): Meeting | Email | Manual

## Finding Unprocessed Meetings
```bash
curl -s -X POST 'https://api.notion.com/v1/databases/2f0330c2-8646-814f-8be4-c23065765eaa/query' \
  -H "Authorization: Bearer $NOTION_KEY" \
  -H 'Notion-Version: 2022-06-28' \
  -H 'Content-Type: application/json' \
  -d '{"filter":{"or":[{"property":"AI Processing","select":{"is_empty":true}},{"property":"AI Processing","select":{"does_not_equal":"Processed"}}]}}'
```

## Coordination with Local Kitt
This skill is designed to work in tandem:
- **VPS Kitt**: Orchestrates, queries Notion API, creates tasks
- **Mac Node**: Runs browser automation to read transcriptions

Local Kitt can also run this independently using the same scripts.
