|
| 1 | +--- |
| 2 | +title: "Developer & Team Workflows with Notion + Continue CLI" |
| 3 | +description: "Use Continue CLI with Notion to generate docs, manage tasks, and automate project workflows – all through natural-language prompts." |
| 4 | +sidebarTitle: "Notion with Continue" |
| 5 | +--- |
| 6 | + |
| 7 | +<Card title="What You'll Build" icon="notion"> |
| 8 | + |
| 9 | + A workflow that lets you query, update, and create Notion pages or database |
| 10 | + entries from natural-language prompts. Generate PRDs, sprint tasks, meeting |
| 11 | + notes, or status reports automatically – perfect for individual developers |
| 12 | + and cross-functional teams. |
| 13 | + |
| 14 | +</Card> |
| 15 | + |
| 16 | +## What You'll Learn |
| 17 | + |
| 18 | +This guide teaches you to: |
| 19 | +- Use natural language to connect to the Notion API directly with Continue CLI for powerful automation |
| 20 | +- Configure Notion API access with proper permissions and security |
| 21 | +- Run prompts in both TUI (interactive) and headless modes |
| 22 | +- Create automated workflows that generate docs, manage tasks, and sync data |
| 23 | + |
| 24 | +## Prerequisites |
| 25 | + |
| 26 | +Before starting, ensure you have: |
| 27 | + |
| 28 | +- [Continue CLI](https://docs.continue.dev/cli/overview) installed (`npm i -g @continuedev/cli`) |
| 29 | +- A [Notion workspace](https://notion.so) with Editor (or higher) access |
| 30 | +- Node.js 18+ installed locally |
| 31 | +- [Continue account](https://hub.continue.dev) with **Hub access** |
| 32 | + |
| 33 | +<Warning> |
| 34 | + |
| 35 | + **Agent usage requires credits** – create a Continue API key at |
| 36 | + [hub.continue.dev/settings/api-keys](https://hub.continue.dev/settings/api-keys) |
| 37 | + and store it as a secret. |
| 38 | + |
| 39 | +</Warning> |
| 40 | + |
| 41 | +<Steps> |
| 42 | + <Step title="Install Continue CLI"> |
| 43 | + ```bash |
| 44 | + npm i -g @continuedev/cli |
| 45 | + ``` |
| 46 | + Verify installation: |
| 47 | + ```bash |
| 48 | + cn --version |
| 49 | + ``` |
| 50 | + </Step> |
| 51 | + |
| 52 | + <Step title="Create Notion Integration & Get API Key"> |
| 53 | + 1. Go to **[Notion Integrations](https://www.notion.so/my-integrations)** |
| 54 | + 2. Click **+ New integration** → give it a name (e.g. "Continue Integration") |
| 55 | + 3. Select your workspace |
| 56 | + 4. Under **Content Capabilities**, enable: |
| 57 | + - ✅ Read content |
| 58 | + - ✅ Update content |
| 59 | + - ✅ Insert content |
| 60 | + 5. Under **Comment Capabilities**, enable: |
| 61 | + - ✅ Read comments |
| 62 | + - ✅ Insert comments |
| 63 | + 6. Under **User Capabilities**, select: |
| 64 | + - ✅ Read user information including email addresses |
| 65 | + 7. Click **Submit** and copy the **Internal Integration Secret** (starts with `secret_`) |
| 66 | + |
| 67 | + <Info> |
| 68 | + |
| 69 | + This token is your `NOTION_API_KEY`. |
| 70 | + Keep it safe – you won't be able to view it again. |
| 71 | + |
| 72 | + </Info> |
| 73 | + |
| 74 | + 8. In Notion, open each database or top-level page you want accessible → **Share** → **Invite** your new integration → **Full access**. |
| 75 | + </Step> |
| 76 | + |
| 77 | + <Step title="Configure API Access"> |
| 78 | + Set your Notion API key as an environment variable in your terminal: |
| 79 | + |
| 80 | + ```bash |
| 81 | + export NOTION_API_KEY="secret_xxx" |
| 82 | + ``` |
| 83 | + |
| 84 | + <Tip> |
| 85 | + |
| 86 | + Running this command sets your API key for the current terminal session only. |
| 87 | + When you close the terminal, the variable won't persist. To test your API key, run the curl command below in the same session. |
| 88 | + |
| 89 | + ```bash |
| 90 | + curl -H "Authorization: Bearer $NOTION_API_KEY" \ |
| 91 | + -H "Notion-Version: 2022-06-28" \ |
| 92 | + https://api.notion.com/v1/databases |
| 93 | + ``` |
| 94 | + </Tip> |
| 95 | + |
| 96 | + </Step> |
| 97 | + <Step title="Add Workspace Keys to Terminal Session"> |
| 98 | + Depending on what you want `cn` to accomplish, you'll need to add your Notion workspace keys to the terminal session. The workspace key is your Notion database ID. Run the following command: |
| 99 | + |
| 100 | + ```bash |
| 101 | + export NOTION_DATABASE_ID="your_database_id" |
| 102 | + ``` |
| 103 | + <Tip> |
| 104 | + |
| 105 | + You can find your database ID by: |
| 106 | + 1. Opening your Notion changelog database |
| 107 | + 2. Looking at the URL - it will be something like: |
| 108 | + https://www.notion.so/your-workspace/DATABASE_ID?v=... |
| 109 | + 3. The DATABASE_ID is the long string of characters between the last / and the ? |
| 110 | + |
| 111 | + </Tip> |
| 112 | + </Step> |
| 113 | +</Steps> |
| 114 | + |
| 115 | +## Running Continue AI Agent with Notion API |
| 116 | + |
| 117 | +<Card title="🚀 Choose Your Interface" icon="zap"> |
| 118 | + |
| 119 | + Continue CLI offers two powerful modes for Notion automation: |
| 120 | + **TUI mode** for interactive workflows and **Headless mode** for automated scripts. |
| 121 | + |
| 122 | +</Card> |
| 123 | + |
| 124 | +<Tabs> |
| 125 | + <Tab title="🖥️ TUI Mode (Interactive)"> |
| 126 | + |
| 127 | + <Steps> |
| 128 | + <Step title="Launch Interactive Mode"> |
| 129 | + Navigate to your project directory and run: |
| 130 | + ```bash |
| 131 | + cn |
| 132 | + ``` |
| 133 | + </Step> |
| 134 | + |
| 135 | + <Step title="Run Your First Prompt"> |
| 136 | + In the TUI interface, enter: |
| 137 | + ``` |
| 138 | + 1. Fetch my Notion databases using the Notion API key |
| 139 | + and Database ID stored in this terminal session. |
| 140 | + 2. Look at the last week of Merged GitHub PRs, and create |
| 141 | + a changelog entry in Notion summarizing the features and breaking changes. |
| 142 | + ``` |
| 143 | + |
| 144 | + <Tip> |
| 145 | + |
| 146 | + TUI mode lets you review and approve each action before execution, |
| 147 | + perfect for learning and debugging. |
| 148 | + |
| 149 | + </Tip> |
| 150 | + </Step> |
| 151 | + </Steps> |
| 152 | + </Tab> |
| 153 | + |
| 154 | + <Tab title="🤖 Headless Mode (Automated)"> |
| 155 | + <Steps> |
| 156 | + <Step title="Run Automated Commands"> |
| 157 | + Execute prompts directly from the command line: |
| 158 | + ```bash |
| 159 | + cn -p --auto " |
| 160 | + 1. Fetch my Notion databases using the Notion API key |
| 161 | + and Database ID stored in this terminal session. |
| 162 | + 2. Analyze all merged GitHub PRs from the past week. |
| 163 | + 3. Extract feature descriptions and breaking changes. |
| 164 | + 4. Create a technical changelog in Notion with PR links." |
| 165 | + ``` |
| 166 | + |
| 167 | + **Flags explained:** |
| 168 | + - `-p`: Run without TUI interface |
| 169 | + - `--auto`: Execute without manual approval |
| 170 | + |
| 171 | + <Warning> |
| 172 | + |
| 173 | + Always test prompts in TUI mode first before running |
| 174 | + them with `--auto` in production. |
| 175 | + |
| 176 | + </Warning> |
| 177 | + </Step> |
| 178 | + </Steps> |
| 179 | + </Tab> |
| 180 | +</Tabs> |
| 181 | + |
| 182 | +<Accordion title="API Connection Notes"> |
| 183 | + |
| 184 | + - Environment variable `NOTION_API_KEY` must be set before running Continue CLI |
| 185 | + - Continue automatically uses the API key to authenticate with Notion |
| 186 | + - No need for manual curl commands - just reference "the API key stored in this session" |
| 187 | + - For complex workflows, Continue maintains the API connection throughout |
| 188 | + - Consider creating aliases or scripts for frequently used prompts |
| 189 | + |
| 190 | +</Accordion> |
| 191 | + |
| 192 | +--- |
| 193 | + |
| 194 | +## Quick Start Example |
| 195 | + |
| 196 | +Working example that demonstrates the power of Continue with Notion API: |
| 197 | + |
| 198 | +<Card title="📊 Weekly Sprint Summary" icon="chart-line"> |
| 199 | + |
| 200 | + **This exact command has been tested and works:** |
| 201 | + |
| 202 | + ```bash |
| 203 | + # Weekly Sprint Summary |
| 204 | + cn -p --auto " |
| 205 | + 1. Fetch Notion Sprint database |
| 206 | + 2. Analyze completed tasks vs planned |
| 207 | + 3. Generate sprint retrospective page |
| 208 | + 4. Add velocity metrics and burndown chart" |
| 209 | + ``` |
| 210 | + |
| 211 | + **What this does:** |
| 212 | + 1. Connects to your Notion workspace using the API key |
| 213 | + 2. Analyzes your sprint data |
| 214 | + 3. Calculates completion metrics |
| 215 | + 4. Creates a comprehensive retrospective with visualizations |
| 216 | + |
| 217 | +</Card> |
| 218 | + |
| 219 | + |
| 220 | +## Example Prompts & Workflows |
| 221 | + |
| 222 | +With the Notion API configured, you can use natural language prompts to automate your workspace. Here are examples for both TUI and headless modes: |
| 223 | + |
| 224 | +<CardGroup cols={1}> |
| 225 | + <Card title="API Documentation" icon="code"> |
| 226 | + **TUI Mode:** |
| 227 | + ```bash |
| 228 | + cn " |
| 229 | + 1. Fetch my Notion databases using the API key and secrets stored in this session |
| 230 | + 2. Generate API documentation for all endpoints |
| 231 | + in src/api/routes with request/response schemas |
| 232 | + 3. Create a page in Technical Docs database |
| 233 | + " |
| 234 | + ``` |
| 235 | + |
| 236 | + **Headless Mode:** |
| 237 | + ```bash |
| 238 | + cn -p --auto "Fetch my Notion databases using the API key and secrets stored in this session. Generate API docs |
| 239 | + for src/api/routes and save to Notion in Technical Docs database" |
| 240 | + ``` |
| 241 | + </Card> |
| 242 | + |
| 243 | + <Card title="Sprint Planning from Code" icon="list-checks"> |
| 244 | + **Headless Mode (Automated):** |
| 245 | + ```bash |
| 246 | + cn -p --auto " |
| 247 | + 1. Fetch my Notion databases using the API key stored in this session |
| 248 | + 2. Scan codebase for TODO and FIXME comments |
| 249 | + 3. Create tasks in my Notion Engineering Backlog database |
| 250 | + 4. Include file paths and complexity estimates" |
| 251 | + ``` |
| 252 | + </Card> |
| 253 | + |
| 254 | + <Card title="Changelog from PRs" icon="rocket"> |
| 255 | + ```bash |
| 256 | + cn -p --auto " |
| 257 | + 1. Fetch my Notion databases using the API key stored in this session |
| 258 | + 2. Analyze all merged GitHub PRs from past month |
| 259 | + 3. In my Notion Launch Database, review the Launch Template. |
| 260 | + 4. Create an October Launch doc in Notion with a week of launches and materials based on the Launch documents based on the PR analysis and launch documents." |
| 261 | + ``` |
| 262 | + |
| 263 | + </Card> |
| 264 | + |
| 265 | + <Card title="Daily Standup Automation" icon="comments"> |
| 266 | + ```bash |
| 267 | + cn -p --auto " |
| 268 | + 1. Fetch my Tasks database from Notion using the API key |
| 269 | + 2. Find tasks completed yesterday |
| 270 | + 3. Find tasks in progress |
| 271 | + 4. Create standup note with: completed, |
| 272 | + in-progress, and blockers sections" |
| 273 | + ``` |
| 274 | + </Card> |
| 275 | +</CardGroup> |
| 276 | + |
| 277 | +## Advanced Workflows |
| 278 | + |
| 279 | +<CardGroup cols={1}> |
| 280 | + <Card title="Notion + GitHub" icon="github"> |
| 281 | + ```bash |
| 282 | + cn -p --auto " |
| 283 | + 1. Connect to Notion using the API key in this session |
| 284 | + 2. Get merged PRs from last 7 days using GitHub |
| 285 | + 3. Extract feature descriptions and changes |
| 286 | + 4. Create formatted changelog in Notion |
| 287 | + 5. Add links back to GitHub PRs" |
| 288 | + ``` |
| 289 | + |
| 290 | + <Info> |
| 291 | + |
| 292 | + Requires GitHub repository access. To add GitHub access, update your [integration settings](https://hub.continue.dev/settings/integrations). |
| 293 | + |
| 294 | + </Info> |
| 295 | + </Card> |
| 296 | + |
| 297 | + <Card title="Test Coverage Report" icon="chart-bar"> |
| 298 | + ```bash |
| 299 | + cn -p --auto " |
| 300 | + 1. Connect to Notion using the API key in this session |
| 301 | + 2. Run test coverage report (npm test -- --coverage) |
| 302 | + 3. Parse coverage metrics |
| 303 | + 4. Update Test Metrics database in Notion |
| 304 | + 5. Flag files with coverage below 80%" |
| 305 | + ``` |
| 306 | + </Card> |
| 307 | + |
| 308 | + <Card title="Blog Post Review" icon="magnifying-glass"> |
| 309 | + ```bash |
| 310 | + cn " |
| 311 | + 1. Connect to Notion using the API key in this session |
| 312 | + 2. In my Blog Posts Database, find drafts tagged 'Review' |
| 313 | + 3. Review all blog posts for grammar and clarity and suggest improvements through comments. |
| 314 | + ``` |
| 315 | + </Card> |
| 316 | + |
| 317 | + <Card title="Weekly Report Generation" icon="list"> |
| 318 | + ```bash |
| 319 | + cn -p --auto " |
| 320 | + 1. Connect to Notion databases using API key |
| 321 | + 2. Aggregate completed tasks from the week |
| 322 | + 3. Calculate velocity and burndown metrics |
| 323 | + 4. Generate weekly report with charts |
| 324 | + 5. Share link in Slack #team-updates" |
| 325 | + ``` |
| 326 | + </Card> |
| 327 | +</CardGroup> |
| 328 | + |
| 329 | +## Security Best Practices |
| 330 | + |
| 331 | +<Warning> |
| 332 | + |
| 333 | + **Protect Your API Keys:** |
| 334 | + - Never commit `NOTION_API_KEY` to version control |
| 335 | + - Use environment variables or secure secret managers |
| 336 | + - Rotate API keys every 90 days |
| 337 | + - Grant integration access only to required databases/pages |
| 338 | + - Monitor API usage through Notion's integration dashboard |
| 339 | + - Use `.env` files with `.gitignore` for local development |
| 340 | + |
| 341 | +</Warning> |
| 342 | + |
| 343 | + |
| 344 | +## Next Steps |
| 345 | + |
| 346 | +- Create a **GitHub Actions** workflow to automate changelog generation on releases |
| 347 | +- Build a **daily standup bot** that runs every morning and posts to Slack |
| 348 | +- Set up **database templates** in Notion for consistent formatting |
| 349 | +- Explore **batch operations** to update multiple pages efficiently |
| 350 | +- Implement **error handling** for API rate limits and network issues |
| 351 | + |
| 352 | +--- |
| 353 | + |
| 354 | +## Troubleshooting |
| 355 | + |
| 356 | +<Accordion title="Common Issues and Solutions"> |
| 357 | + |
| 358 | + **API Key Not Found:** |
| 359 | + - Ensure `NOTION_API_KEY` is exported in your current shell session |
| 360 | + - Check for typos in the environment variable name |
| 361 | + - Verify the key starts with `secret_` |
| 362 | + |
| 363 | + **Database Access Denied:** |
| 364 | + - Share the specific database with your integration in Notion |
| 365 | + - Ensure the integration has the correct permissions (Read, Write, Insert) |
| 366 | + |
| 367 | + **Connection Issues:** |
| 368 | + - Verify Continue CLI has internet access |
| 369 | + - Check network connectivity to api.notion.com |
| 370 | + - Ensure your Notion workspace allows API access |
| 371 | + |
| 372 | + **Rate Limiting:** |
| 373 | + - Notion API has rate limits (3 requests per second) |
| 374 | + - Implement exponential backoff for automated scripts |
| 375 | + - Consider batching operations when possible |
| 376 | + |
| 377 | +</Accordion> |
0 commit comments