Notion AI Tool

AI-powered tool for creating and managing Notion content. Designed for use with AI Agent Nodes.

Overview

The Notion AI Tool node integrates with the Notion API to enable AI-powered creation and management of Notion content. It is designed primarily for use within AI Agent workflows, allowing users to automate tasks such as creating pages with structured content, appending content to existing pages, searching pages, updating page properties, creating database entries, and querying databases.

Common scenarios where this node is beneficial include:

  • Automatically generating well-formatted Notion pages from natural language input.
  • Enhancing existing Notion pages by adding new content blocks programmatically.
  • Searching and retrieving pages or database entries based on queries or filters.
  • Managing metadata and properties of pages and database entries dynamically.
  • Integrating Notion content management into broader AI-driven automation workflows.

Practical examples:

  • Creating a project documentation page with headings, lists, and formatted text from a simple markdown-like input.
  • Adding meeting notes or action items to an existing Notion page automatically after a call.
  • Querying a task database to retrieve all tasks marked as "In Progress" and updating their status.
  • Searching for pages containing specific keywords and extracting their URLs for reporting.

Properties

Name Meaning
Operation The action to perform. Options:
• Create Page with Content
• Add Content to Page
• Search and Retrieve Pages
• Update Page Properties
• Create Database Entry
• Query Database
Page Title Title of the new page to create (required for "Create Page with Content").
Parent Page/Database ID ID or URL of the parent page or database where the new page or database entry will be created (required for "Create Page with Content" and "Create Database Entry").
Content Natural language content to add, which the AI structures into Notion blocks (used in "Create Page with Content" and "Add Content to Page").
Target Page ID ID or URL of the existing page to modify (required for "Add Content to Page" and "Update Page Properties").
Search Query Text query to search pages by title, content, or properties (used in "Search and Retrieve Pages").
Properties to Update JSON or natural language description of page properties to update (used in "Update Page Properties"). Example: {"status": "In Progress", "priority": "High"} or "Set status to Done and priority to Low".
Database ID ID or URL of the database to query (required for "Query Database").
Entry Properties JSON or natural language description of properties for a new database entry (used in "Create Database Entry").
Query Filter Filter criteria in JSON or natural language to filter database entries (used in "Query Database"). Example: "status is Done and priority is High".
Additional Options Collection of optional settings:
• Icon: Emoji icon for the page (e.g., 📝, 🎯, 📊)
• Cover Image URL: URL of cover image for the page
• Max Results: Maximum number of results to return (1-100)

Output

The node outputs a JSON array where each item corresponds to one input item processed. Each output object includes:

  • operation: The operation performed.
  • success: Boolean indicating if the operation succeeded.
  • Operation-specific fields, for example:
    • For Create Page with Content: pageId, title, url, message.
    • For Add Content to Page: pageId, blocksAdded (number of content blocks added), message, result (raw API response).
    • For Search and Retrieve Pages: totalResults, pages (array of page objects), message.
    • For Update Page Properties: pageId, updatedProperties (list of updated property keys), message, result.
    • For Create Database Entry: entryId, databaseId, message, result.
    • For Query Database: databaseId, totalResults, entries (array of database entries), message.

If the node encounters errors and is configured to continue on failure, it outputs objects with error message and success: false.

The node does not output binary data.

Dependencies

  • Requires valid Notion API credentials (an API key or token) configured in n8n.
  • Uses the official Notion API endpoints for pages, blocks, search, and databases.
  • No additional external services beyond Notion API are required.
  • Environment variable NODE_ENV may affect debug logging but is not mandatory.

Troubleshooting

Common Issues

  • Invalid Notion API credentials: The node validates credentials before execution and throws an error if invalid.
  • Malformed JSON in properties or filters: When providing JSON strings for properties or filters, ensure correct syntax; otherwise, the node attempts to parse natural language but may fail or produce unexpected results.
  • No valid content blocks found: When adding content, if the input text cannot be parsed into valid Notion blocks, the node throws an error.
  • Unknown operation: If an unsupported operation value is provided, the node throws an error.

Error Messages and Resolutions

  • "Invalid Notion API credentials": Check that the API key/token is correctly set up and has necessary permissions.
  • "No valid content blocks found to add": Verify the content input is non-empty and properly formatted.
  • "Unknown operation: <operation>": Ensure the operation parameter matches one of the supported options.
  • JSON parsing errors in properties or filters: Validate JSON syntax or use natural language descriptions carefully.

Links and References


This summary is based solely on static analysis of the provided source code and property definitions.

Discussion