|
1 |
| -# plugin-notion-database-query |
2 |
| -This plugin allows users to query pages from a Notion database |
| 1 | +# **Notion Database Query** |
| 2 | +This plugin allows users to query pages from a Notion database. |
| 3 | + |
| 4 | +### 🎯 **It Supports** |
| 5 | +- Filtering data by different property types based on the provided database information. |
| 6 | +- Sorting results in ascending or descending order. |
| 7 | +- Pagination with a specified page size. |
| 8 | + |
| 9 | +### 📝 **User Setting Notes:** |
| 10 | +#### 🔧 **Set Up the Plugin Server:** |
| 11 | +- A plugin server must be set up to use this feature. Follow the detailed guide to set up a plugin server on Render: [How to Deploy the Plugin Server on Render](https://docs.typingmind.com/plugins/plugins-server/how-to-deploy-plugins-server-on-render) |
| 12 | + |
| 13 | +#### 🔑 **Set Up Your Notion API Key:** |
| 14 | +- Go to the [Notion Integration Page](https://www.notion.so/profile/integrations) and create a new integration. |
| 15 | +- Copy the key from the Integration Detail Page. |
| 16 | +- Paste the key into the plugin's user settings: |
| 17 | + **Notion API Key:** `ntn_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX` |
| 18 | + |
| 19 | +For detailed instructions, visit the [Notion Integration API Documentation](https://developers.notion.com/docs/create-a-notion-integration) |
| 20 | + |
| 21 | +#### 🔗 **Share Your Database with the Integration:** |
| 22 | +- Open your database in Notion. |
| 23 | +- Click the **“Share”** button in the top right. |
| 24 | +- Select **“Invite”**, search for your integration name, and click **“Invite”** to grant access. |
| 25 | + |
| 26 | +For detailed instructions, visit the [Notion API Connections Documentation](https://www.notion.com/help/add-and-manage-connections-with-the-api) |
| 27 | + |
| 28 | +### 📌 **Important Notes:** |
| 29 | + |
| 30 | +#### 👉 **Database Context Requirement:** |
| 31 | +To use the plugin, you need to tell the AI your database ID along with the database structure at the beginning. |
| 32 | + |
| 33 | +##### 1. Obtain Your Database ID |
| 34 | +- To get the database ID, open your Notion database as a full page in your browser. |
| 35 | +- Copy the full URL from the address bar. The URL will look something like this: `https://www.notion.so/<DATABASE_ID>?v=<VIEW_ID>` |
| 36 | +- Example URL `https://www.notion.so/12345bcxyz?v=11111aaaaaa`. The **Database ID** is: `12345bcxyz`. |
| 37 | + |
| 38 | +##### 2. Obtain Your Database Structure |
| 39 | +- Manually list out each property, including Name, Type, and Options (Select, Multi-select, Status). |
| 40 | +- Use the [Notion Database Structure Viewer plugin](https://github.com/TypingMind/plugin-notion-database-structure-viewer). |
| 41 | + |
| 42 | +#### ⚠️ **Limitations:** |
| 43 | +- The plugin does **not support** the following property types for querying: Relation, Rollup, Verification, Formula, Unique ID. |
| 44 | + |
| 45 | +#### 👉 **Rate Limits:** |
| 46 | +- There are rate limits for Notion API requests. Learn more at [Notion API Rate Limits](https://developers.notion.com/reference/request-limits#rate-limits). |
| 47 | +- There are size limits on certain parameters, as well as the depth of children in requests. Learn more at [Notion API Size Limits](https://developers.notion.com/reference/request-limits#size-limits) |
| 48 | + |
| 49 | +### 💡 **Example Usage** |
| 50 | +- As an HR professional, I want to filter employees based on specific conditions. First, I need to provide the AI with the context of my database, including the database URL along with the database structure description. |
| 51 | + |
| 52 | +Given the description of my Employee Directory Database as follows: |
| 53 | +> Notion Database URL: `https://www.notion.so/12345bcxyz?v=11111aaaaaa` |
| 54 | +> |
| 55 | +> Database Structure: |
| 56 | +> 1. Name (Title) |
| 57 | +> 2. Years of Experience (Number) |
| 58 | +> 3. Skills (Multi-select) - Options: Project Management, Programming, Data Analysis, Communication, Leadership, Design, Marketing, Sales, MLOps, FullStack |
| 59 | +> 4. Probation Passed (Checkbox) |
| 60 | +> 5. Location (Select) - Options: HQ - New York, Office - London, Office - Singapore, Remote - Domestic, Remote - International, Hybrid, Office - New York |
| 61 | +> 6. Role (Select) - Options: Engineer, Manager, Designer, Analyst, Developer, Director, Coordinator, Specialist |
| 62 | +> 7. LinkedIn Profile (URL) |
| 63 | +> 8. Performance Review Status (Status) - Options: Not started, In progress, Done |
| 64 | +> 9. Email (Email) |
| 65 | +> 10. Start Date (Date) |
| 66 | +> 11. Department (Select) - Options: Engineering, Marketing, Sales, HR, Finance, Operations, Customer Support, Design |
| 67 | +> 12. Attachments (Files) |
| 68 | +> 13. Phone (Phone Number) |
| 69 | +> 14. Notes (Rich Text) |
| 70 | +
|
| 71 | +Then, I can ask the AI to retrieve employees based on my needs. Here are some examples: |
| 72 | + |
| 73 | +Example 1: |
| 74 | +> Filter employees who have not passed probation. |
| 75 | +
|
| 76 | +Example 2: |
| 77 | +> Filter employees in the Engineering Department, sort them by Name (A-Z), and retrieve the first 5 individuals. |
| 78 | +
|
| 79 | +Example 3: |
| 80 | +> Filter employees in the Engineering Department with roles of Engineer or Analyst, hired after 2025-01-01, and sort them by Name (A-Z). |
0 commit comments