Daily
Archive empty and duplicate Notion pages
Your database stays clean, and you get an email listing what was archived so you can restore anything from the trash.
- Runs
- Daily
- Apps
- Notion
- AI
- Not needed
- Access
- read+write
Send this to your assistant
Create a ClickRuntime automation: every night at 11pm, archive pages in my Notion Links database that are empty or have the same URL as an older page, then email me a list of what was archived.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Notion databases collect junk. A person clicks New and leaves without typing, an import runs twice, a form integration creates the same contact on each retry. After a year, a CRM database has 200 untitled pages and 80 duplicate companies, filters return confusing results, and a count of customers is wrong. Cleaning it takes a tedious afternoon that nobody schedules, so the clutter grows and trust in the data falls.
Every night ClickRuntime goes through the database's pages, identifies empty ones that have no blocks and no filled properties, finds duplicates by a key property such as email or title, archives them, and emails an audit log of what was archived. Archived pages are not deleted outright, so a mistake can be reversed in Notion.
Anyone who keeps a CRM, a contact list or an inventory in Notion benefits from regular tidying.
What you get out of it
Counts and views become reliable
With duplicates gone, the number of customers is the real number. Reports and rollups built on the database stop being quietly wrong. Reports and rollups built on the database stop being quietly wrong, and filters return what you expect.
Cleanup stops being a project
The nightly run removes clutter before it builds up. Nobody has to schedule a half-day to tidy the database before an important review. Nobody has to schedule a half day to tidy the database before an important review or client demo.
Nothing is lost permanently
Pages are archived and can be restored from Notion's trash if a decision was wrong. That safety makes it reasonable to run the cleanup unattended. That safety makes it reasonable to run the cleanup unattended every night without worry.
A log tells you exactly what changed
The email lists each archived page and the reason, empty or duplicate. If someone asks where a record went, the audit log answers it. If someone asks where a record went, the audit log gives the answer in seconds.
Imports can be rerun safely
A double import or an integration retry no longer permanently doubles your records. Duplicates are caught the next night, which removes fear from bulk loads. That removes the fear from bulk loads and re-syncs, since duplicates are caught the next night.
How it works
What happens, step by step
Every day ClickRuntime goes through every page in your Notion database.
It finds pages that are empty and pages that duplicate another entry with the same link.
Those pages are archived in Notion, not deleted, so you can restore them.
You get an email listing each archived page and why.
Before it runs live
- Connect Notion and share the database you want it to use
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Run it at a different time, more or less often, or only on weekdays
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other Notion steps into one automation
Under the hood
The code that runs this automation
from clickruntime import on_trigger, credentials, http, notify
NOTION = "https://api.notion.com/v1"
def headers():
return {"Authorization": f"Bearer {credentials.secret('NOTION_TOKEN')}", "Notion-Version": "2022-06-28"}
def query(db, body=None):
resp = http.post(f"{NOTION}/databases/{db}/query", headers=headers(), json=body or {})
resp.raise_for_status()
return resp.json()["results"]
def title(page, prop="Name"):
return "".join(t["plain_text"] for t in page["properties"][prop]["title"])
LINKS = "links-database-id"
@on_trigger
def run(event):
pages = query(LINKS, {"sorts": [{"timestamp": "created_time", "direction": "ascending"}], "page_size": 100})
seen, archived = set(), []
for page in pages:
name, url = title(page), page["properties"]["URL"]["url"]
if not name and not url:
reason = "empty"
elif url and url in seen:
reason = f"duplicate of {url}"
else:
seen.add(url)
continue
http.patch(f"{NOTION}/pages/{page['id']}", headers=headers(), json={"archived": True}).raise_for_status()
archived.append(f"{name or '(untitled)'}: {reason}")
if archived:
notify.email_me(f"Archived {len(archived)} Notion pages", "\n".join(archived))
return {"archived": len(archived)}FAQ
Common questions
How are duplicates identified?
Will it archive pages that are only partly filled in?
Can I preview what it would archive?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Get reminders for Notion tasks due soon
Each morning you get the tasks due in the next two days, overdue ones move to today, and anything a week late is flagged as stale.
See how it worksLog daily prices and exchange rates in Notion
A new dated row with the latest prices and rates is added to your database every day.
See how it worksEmail yourself a weekly Notion database backup
Each week a CSV copy of your database properties lands in your inbox.
See how it worksKeep exploring
Set up “Archive empty and duplicate Notion pages” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.