Code
How It Works
Custom Toolscreate_notion_page(): Creates pages in Notionsearch_notion(): Searches database entries- Tools passed to agent via
toolsparameter
notion_clientlibrary for API access- Authenticated with
NOTION_API_KEY - Targets specific database via
NOTION_DATABASE_ID
NOTION_API_KEY: Your Notion integration tokenNOTION_DATABASE_ID: Target database IDOPENROUTER_API_KEY: LLM access
Dependencies
Environment Setup
Create.env file:
Setup
- Create Notion integration at notion.so/my-integrations
- Share database with integration
- Copy database ID from URL
Run
- “Create a page titled ‘Meeting Notes’ with content ‘Discussed Q1 goals’”
- “Add a task to my Notion database: ‘Review project documentation’”
- “Create a database entry for ‘Client Meeting’ with status ‘In Progress‘“
Example API Calls
Message Send Request
Message Send Request
Task get Request
Task get Request