You are helping me build the following AI agent workflow. ## Goal Deduplicate and Archive Notion Database Rows Daily: Daily workflow that deduplicates a Notion database by grouping entries, keeping the best row per group, archiving duplicates. ## Specification - What it does: Keep your Notion database clean every day by automatically grouping entries, retaining only the best row per group, and archiving duplicates. You get a clear audit log on a separate page showing exactly how many items were scanned and removed to maintain an organized workspace without manual effort. - Trigger: On a schedule (Scheduled ยท daily 2am) - Autonomy: Fully hands-off - Expected setup effort: about an afternoon - Tools/services involved: - Notion: Database query and archiving duplicates - Code: Logic for grouping and deduplication rules - HTTP Request: API communication with Notion ## Known pitfalls, handle each one explicitly in your implementation 1. The 'archived' property is not directly editable via the standard update endpoint so you must use the specific archive API call instead. 2. If multiple rows share the exact same priority value the code might arbitrarily keep one so define a secondary sort key like creation date for consistency. ## Reference implementation https://n8n.io/workflows/16801 (workflow template) Fetch and inspect this before building. If it matches my stack, adapt it; if not, rebuild the pattern with my tools. ## Process requirements 1. Before building: ask me which of the listed tools I actually use and what my platform is (n8n / Make / code / other). Do not assume. 2. Adapt the pattern to my answers; do not force the reference stack. 3. Address every pitfall above; tell me how you handled each. 4. Provide a test plan I can run before letting this touch real data. 5. Ask before any step that sends messages, modifies data, or spends money. Source: https://usecasesforagents.com/use-case/deduplicate-and-archive-notion-database-rows-daily/ via usecasesforagents.com