π© Tired of Rewriting Your To-Do List Every Day?
“Typing out the same to-do list every morning was driving me crazy.”
So I decided to try Notion API and build my first little automation.
I wasn’t sure if I could do it at first—but step by step, I figured it out.
π Blog Summary
This post is a beginner-friendly guide to automating your daily tasks in Notion using Python.
You'll learn how to create a bot that automatically generates a new to-do page each day—complete with the current date and your favorite tags or format.
If you've never worked with APIs before, don't worry—I’ll walk you through every step.
π¬ Why I Chose Notion API
When I started learning how to code, Notion was already a big part of my daily life.
I used it to organize study notes, blog ideas, and all my to-dos.
But here's the catch:
I had to recreate the same layout every morning. Manually. Every. Time.
Then I thought…
"What if I could make a script that does this for me?"
After some Googling, I found Notion API. And that’s when my automation journey began.
π ️ What I Wanted to Build
- Automatically create a new Notion page every morning
- Title includes today’s date
- Tags and format are pre-filled based on a template
✨ A small script that saves real time every day.
✅ Step 0: What You’ll Need
- A Notion account
- A Table-style database created in Notion
- Python installed
- A code editor (VS Code recommended)
- Internet connection π
✅ Step 1: Set Up Notion API Access
- Create a Notion database using
/table
→ Add columns likeTask
,Status
,Date
- Click Share → Invite → + Connect integrations
- Visit the Notion Developer Portal
→ Create an integration
→ Copy your Internal Integration Token - Share your database with the integration you just made
π Important: Without sharing the database, your integration won’t work!
✅ Step 2: Set Up Python Environment
In your terminal, run:
pip install requests python-dotenv
requests
→ to send HTTP requestspython-dotenv
→ to safely store API keys
✅ Step 3: Create a .env
File
NOTION_TOKEN=secret_your_token_here
NOTION_DATABASE_ID=your_database_id_here
Also add .env
to your .gitignore
file to protect secrets from GitHub uploads.
✅ Step 4: Write Your Python Script
import os
import requests
from dotenv import load_dotenv
from datetime import datetime
load_dotenv()
NOTION_TOKEN = os.getenv("NOTION_TOKEN")
DATABASE_ID = os.getenv("NOTION_DATABASE_ID")
def create_notion_page():
today = datetime.now().strftime("%Y-%m-%d")
url = "https://api.notion.com/v1/pages"
headers = {
"Authorization": f"Bearer {NOTION_TOKEN}",
"Content-Type": "application/json",
"Notion-Version": "2022-06-28"
}
data = {
"parent": { "database_id": DATABASE_ID },
"properties": {
"Task": {
"title": [
{
"text": {
"content": f"Todo - {today}"
}
}
]
}
}
}
res = requests.post(url, headers=headers, json=data)
print("Status Code:", res.status_code)
print("Response:", res.text)
create_notion_page()
π‘ Note: Change Task
to match your Notion column name.
✅ Step 5: Run Your Script
python yourscript.py
Check your Notion workspace—you should see a new task page titled with today’s date π
✅ Step 6 (Optional): Run It Daily
Use Python's schedule
library:
import schedule
import time
schedule.every().day.at("08:00").do(create_notion_page)
while True:
schedule.run_pending()
time.sleep(60)
Or use:
- Windows: Task Scheduler
- macOS/Linux: crontab
✨ Final Thoughts
- You don’t need a big project to start automating—start small
- Notion API is surprisingly easy to use
- Python is a great way to bring your ideas to life
- Automating something you use daily? Super satisfying π
π¬ What Will You Automate Next?
Have any automation ideas in mind?
Drop them in the comments—I’d love to hear your thoughts!
π Hashtags for SEO
#NotionAPI #PythonAutomation #BeginnerDev #CodingJourney #NotionTips
Comments
Post a Comment