• Townie
    AI
  • Blog
  • Docs
  • Pricing
Log inSign up
project logo

lightweight

findings

Remix of lightweight/findings-base
Public
Like
findings
Home
Code
7
_townie
7
backend
8
frontend
1
shared
1
.vtignore
deno.json
H
main.tsx
Branches
2
Pull requests
Remixes
History
Environment variables
8
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
backend
/
routes
/
tasks
/
README.md
Code
/
backend
/
routes
/
tasks
/
README.md
Search
8/28/2025
README.md

Task Routes

Webhook handlers for Notion integrations.

Endpoints

  • POST /tasks/blob - Process PDF extraction and blob storage for Notion pages
  • POST /tasks/dupe - Duplicate Notion page to final reports database with content filtering
  • POST /tasks/convert - Convert page to database based on H2 sections
  • POST /tasks/draft - Duplicate page with filtered child database (excludes specific analysis properties)
  • POST /tasks/notion-webhook - General Notion webhook handler
  • POST /tasks/test - Test endpoint for webhook authentication
  • GET /tasks/debug-webhook - Debug endpoint to check webhook configuration

Architecture

Routes handle HTTP request/response only. Business logic is delegated to:

  • tasks.controller.ts - Orchestrates PDF extraction, blob storage, page duplication, and Notion updates
  • notion.service.ts - Handles Notion API calls
  • pdfExtractor.ts - Handles PDF text extraction

Page Duplication (/tasks/dupe)

The /tasks/dupe endpoint duplicates a Notion page from any database to the final reports database (FINDINGS_REPORTS_DRAFT_DB_ID) with content filtering:

Content Filtering

  • Removes: Callout blocks, code blocks, divider blocks, blocks containing "Evidence summary", blocks containing "Methodology", blocks containing "Executive summary"
  • Preserves: All other content blocks in original order
  • Source: Original page remains unchanged

Webhook Payload

Expects Notion webhook with page ID in data.id:

{ "data": { "id": "page-id-here" } }

Response Format

{ "success": true, "sourcePageId": "source-page-id", "targetPageId": "new-page-id", "blocksCopied": 15, "blocksFiltered": 3, "timestamp": "2025-08-15T22:25:47.000Z" }

Page Duplication with Filtered Database (/tasks/draft)

The /tasks/draft endpoint duplicates a Notion page and its child database to the draft reports database (FINDINGS_REPORTS_DRAFT_DB_ID) with selective property filtering:

Child Database Detection

  • Uses "Results Database ID" property from source page to identify child database
  • If no child database ID found, proceeds with page duplication only

Property Filtering

Excluded from child database:

  • Confidence Score
  • Consensus Level
  • Evidence Summary
  • Methodology

Preserved in child database:

  • Name (title)
  • Status
  • Category
  • Priority
  • All other properties

Content Processing

  • Page Content: Copies all blocks except child_database blocks
  • Child Database: Creates new filtered database with all pages duplicated
  • Name Property: Replaces "(raw)" with "(draft)" or appends "(draft)"

Response Format

{ "success": true, "sourcePageId": "source-page-id", "targetPageId": "new-page-id", "childDatabaseId": "source-child-db-id", "targetChildDatabaseId": "new-child-db-id", "childPagesProcessed": 25, "childPagesSucceeded": 25, "timestamp": "2025-08-15T22:25:47.000Z" }
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareersBrandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.