Overview

Enable your agents to manage pages, databases, and content through Notion. Create and update pages, manage content blocks, organize knowledge bases, and streamline your documentation workflows with AI-powered automation.

Prerequisites

Before using the Notion integration, ensure you have:

  • A CrewAI Enterprise account with an active subscription
  • A Notion account with appropriate workspace permissions
  • Connected your Notion account through the Integrations page

Setting Up Notion Integration

1. Connect Your Notion Account

  1. Navigate to CrewAI Enterprise Integrations
  2. Find Notion in the Authentication Integrations section
  3. Click Connect and complete the OAuth flow
  4. Grant the necessary permissions for page and database management
  5. Copy your Enterprise Token from Account Settings

2. Install Required Package

uv add crewai-tools

Available Actions

Usage Examples

Basic Notion Agent Setup

from crewai import Agent, Task, Crew
from crewai_tools import CrewaiEnterpriseTools

# Get enterprise tools (Notion tools will be included)
enterprise_tools = CrewaiEnterpriseTools(
    enterprise_token="your_enterprise_token"
)

# Create an agent with Notion capabilities
notion_agent = Agent(
    role="Documentation Manager",
    goal="Manage documentation and knowledge base in Notion efficiently",
    backstory="An AI assistant specialized in content management and documentation.",
    tools=[enterprise_tools]
)

# Task to create a meeting notes page
create_notes_task = Task(
    description="Create a new meeting notes page in the team database with today's date and agenda items",
    agent=notion_agent,
    expected_output="Meeting notes page created successfully with structured content"
)

# Run the task
crew = Crew(
    agents=[notion_agent],
    tasks=[create_notes_task]
)

crew.kickoff()

Filtering Specific Notion Tools

from crewai_tools import CrewaiEnterpriseTools

# Get only specific Notion tools
enterprise_tools = CrewaiEnterpriseTools(
    enterprise_token="your_enterprise_token",
    actions_list=["notion_create_page", "notion_update_block", "notion_search_pages"]
)

content_manager = Agent(
    role="Content Manager",
    goal="Create and manage content pages efficiently",
    backstory="An AI assistant that focuses on content creation and management.",
    tools=enterprise_tools
)

# Task to manage content workflow
content_workflow = Task(
    description="Create a new project documentation page and add structured content blocks for requirements and specifications",
    agent=content_manager,
    expected_output="Project documentation created with organized content sections"
)

crew = Crew(
    agents=[content_manager],
    tasks=[content_workflow]
)

crew.kickoff()

Knowledge Base Management

from crewai import Agent, Task, Crew
from crewai_tools import CrewaiEnterpriseTools

enterprise_tools = CrewaiEnterpriseTools(
    enterprise_token="your_enterprise_token"
)

knowledge_curator = Agent(
    role="Knowledge Curator",
    goal="Curate and organize knowledge base content in Notion",
    backstory="An experienced knowledge manager who organizes and maintains comprehensive documentation.",
    tools=[enterprise_tools]
)

# Task to curate knowledge base
curation_task = Task(
    description="""
    1. Search for existing documentation pages related to our new product feature
    2. Create a comprehensive feature documentation page with proper structure
    3. Add code examples, images, and links to related resources
    4. Update existing pages with cross-references to the new documentation
    """,
    agent=knowledge_curator,
    expected_output="Feature documentation created and integrated with existing knowledge base"
)

crew = Crew(
    agents=[knowledge_curator],
    tasks=[curation_task]
)

crew.kickoff()

Content Structure and Organization

from crewai import Agent, Task, Crew
from crewai_tools import CrewaiEnterpriseTools

enterprise_tools = CrewaiEnterpriseTools(
    enterprise_token="your_enterprise_token"
)

content_organizer = Agent(
    role="Content Organizer",
    goal="Organize and structure content blocks for optimal readability",
    backstory="An AI assistant that specializes in content structure and user experience.",
    tools=[enterprise_tools]
)

# Task to organize content structure
organization_task = Task(
    description="""
    1. Get content from existing project pages
    2. Analyze the structure and identify improvement opportunities
    3. Update content blocks to use proper headings, tables, and formatting
    4. Add table of contents and improve navigation between related pages
    5. Create templates for future documentation consistency
    """,
    agent=content_organizer,
    expected_output="Content reorganized with improved structure and navigation"
)

crew = Crew(
    agents=[content_organizer],
    tasks=[organization_task]
)

crew.kickoff()

Automated Documentation Workflows

from crewai import Agent, Task, Crew
from crewai_tools import CrewaiEnterpriseTools

enterprise_tools = CrewaiEnterpriseTools(
    enterprise_token="your_enterprise_token"
)

doc_automator = Agent(
    role="Documentation Automator",
    goal="Automate documentation workflows and maintenance",
    backstory="An AI assistant that automates repetitive documentation tasks.",
    tools=[enterprise_tools]
)

# Complex documentation automation task
automation_task = Task(
    description="""
    1. Search for pages that haven't been updated in the last 30 days
    2. Review and update outdated content blocks
    3. Create weekly team update pages with consistent formatting
    4. Add status indicators and progress tracking to project pages
    5. Generate monthly documentation health reports
    6. Archive completed project pages and organize them in archive sections
    """,
    agent=doc_automator,
    expected_output="Documentation automated with updated content, weekly reports, and organized archives"
)

crew = Crew(
    agents=[doc_automator],
    tasks=[automation_task]
)

crew.kickoff()

Troubleshooting

Common Issues

Permission Errors

  • Ensure your Notion account has edit access to the target workspace
  • Verify that the OAuth connection includes required scopes for Notion API
  • Check that pages and databases are shared with the authenticated integration

Invalid Page and Block IDs

  • Double-check page IDs and block IDs for correct UUID format
  • Ensure referenced pages and blocks exist and are accessible
  • Verify that parent page or database IDs are valid when creating new pages

Property Schema Issues

  • Ensure page properties match the database schema when creating pages in databases
  • Verify that property names and types are correct for the target database
  • Check that required properties are included when creating or updating pages

Content Block Structure

  • Ensure block content follows Notion’s rich text format specifications
  • Verify that nested block structures are properly formatted
  • Check that media URLs are accessible and properly formatted

Search and Filter Issues

  • Ensure search queries are properly formatted and not empty
  • Use valid field names in filter formulas: query, filter.value, direction, page_size
  • Test simple searches before building complex filter conditions

Parent-Child Relationships

  • Verify that parent page or database exists before creating child pages
  • Ensure proper permissions exist for the parent container
  • Check that database schemas allow the properties you’re trying to set

Rich Text and Media Content

  • Ensure URLs for external images, PDFs, and bookmarks are accessible
  • Verify that rich text formatting follows Notion’s API specifications
  • Check that code block language types are supported by Notion

Archive and Deletion Operations

  • Understand the difference between archiving (reversible) and deleting (permanent)
  • Verify that you have permissions to archive or delete the target content
  • Be cautious with bulk operations that might affect multiple pages or blocks

Getting Help

Need Help?

Contact our support team for assistance with Notion integration setup or troubleshooting.