docs/en/enterprise/integrations/notion.mdx
Enable your agents to manage users and create comments through Notion. Access workspace user information and create comments on pages and discussions, streamlining your collaboration workflows with AI-powered automation.
Before using the Notion integration, ensure you have:
uv add crewai-tools
export CREWAI_PLATFORM_INTEGRATION_TOKEN="your_enterprise_token"
Or add it to your .env file:
CREWAI_PLATFORM_INTEGRATION_TOKEN=your_enterprise_token
**Parameters:**
- `page_size` (integer, optional): Number of items returned in the response. Minimum: 1, Maximum: 100, Default: 100
- `start_cursor` (string, optional): Cursor for pagination. Return results after this cursor.
**Parameters:**
- `user_id` (string, required): The ID of the user to retrieve.
**Parameters:**
- `parent` (object, required): The parent page or discussion to comment on.
```json
{
"type": "page_id",
"page_id": "PAGE_ID_HERE"
}
```
or
```json
{
"type": "discussion_id",
"discussion_id": "DISCUSSION_ID_HERE"
}
```
- `rich_text` (array, required): The rich text content of the comment.
```json
[
{
"type": "text",
"text": {
"content": "This is my comment text"
}
}
]
```
from crewai import Agent, Task, Crew
# Create an agent with Notion capabilities
notion_agent = Agent(
role="Workspace Manager",
goal="Manage workspace users and facilitate collaboration through comments",
backstory="An AI assistant specialized in user management and team collaboration.",
apps=['notion'] # All Notion actions will be available
)
# Task to list workspace users
user_management_task = Task(
description="List all users in the workspace and provide a summary of team members",
agent=notion_agent,
expected_output="Complete list of workspace users with their details"
)
# Run the task
crew = Crew(
agents=[notion_agent],
tasks=[user_management_task]
)
crew.kickoff()
comment_manager = Agent(
role="Comment Manager",
goal="Create and manage comments on Notion pages",
backstory="An AI assistant that focuses on facilitating discussions through comments.",
apps=['notion/create_comment']
)
# Task to create comments on pages
comment_task = Task(
description="Create a summary comment on the project status page with key updates",
agent=comment_manager,
expected_output="Comment created successfully with project status updates"
)
crew = Crew(
agents=[comment_manager],
tasks=[comment_task]
)
crew.kickoff()
from crewai import Agent, Task, Crew
team_coordinator = Agent(
role="Team Coordinator",
goal="Coordinate team activities and manage user information",
backstory="An AI assistant that helps coordinate team activities and manages user information.",
apps=['notion']
)
# Task to coordinate team activities
coordination_task = Task(
description="""
1. List all users in the workspace
2. Get detailed information for specific team members
3. Create comments on relevant pages to notify team members about updates
""",
agent=team_coordinator,
expected_output="Team coordination completed with user information gathered and notifications sent"
)
crew = Crew(
agents=[team_coordinator],
tasks=[coordination_task]
)
crew.kickoff()
from crewai import Agent, Task, Crew
collaboration_facilitator = Agent(
role="Collaboration Facilitator",
goal="Facilitate team collaboration through comments and user management",
backstory="An AI assistant that specializes in team collaboration and communication.",
apps=['notion']
)
# Task to facilitate collaboration
collaboration_task = Task(
description="""
1. Identify active users in the workspace
2. Create contextual comments on project pages to facilitate discussions
3. Provide status updates and feedback through comments
""",
agent=collaboration_facilitator,
expected_output="Collaboration facilitated with comments created and team members notified"
)
crew = Crew(
agents=[collaboration_facilitator],
tasks=[collaboration_task]
)
crew.kickoff()
from crewai import Agent, Task, Crew
communication_automator = Agent(
role="Communication Automator",
goal="Automate team communication and user management workflows",
backstory="An AI assistant that automates communication workflows and manages user interactions.",
apps=['notion']
)
# Complex communication automation task
automation_task = Task(
description="""
1. List all workspace users and identify team roles
2. Get specific user information for project stakeholders
3. Create automated status update comments on key project pages
4. Facilitate team communication through targeted comments
""",
agent=communication_automator,
expected_output="Automated communication workflow completed with user management and comments"
)
crew = Crew(
agents=[communication_automator],
tasks=[automation_task]
)
crew.kickoff()
Permission Errors
User Access Issues
Comment Creation Issues
API Rate Limits
Parent Object Specification