FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
lightweight
lightweightglimpse2-runbook-view-glimpse-save-login-react
Remix of lightweight/glimpse2-runbook-view-glimpse-save-login
Public
Like
glimpse2-runbook-view-glimpse-save-login-react
Home
Code
8
_townie
13
backend
7
frontend
5
shared
3
.vtignore
README.md
deno.json
H
main.tsx
Branches
2
Pull requests
Remixes
History
Environment variables
6
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
9/10/2025
Viewing readonly version of main branch: v7
View latest version
README.md

Task Routes

Webhook handlers for Notion integrations, organized into focused modules.

File Structure

/backend/routes/tasks/
├── _tasks.routes.ts          # Main router + catch-all
├── webhook.routes.ts         # Production webhook endpoints
├── debug.routes.ts          # Debug/test endpoints
└── [new-feature].routes.ts  # Future endpoints (auto-mounted safely)

Adding New Endpoints

To add new /tasks endpoints:

  1. Create a new route file (e.g., feature.routes.ts)
  2. Import and mount it in _tasks.routes.ts BEFORE the catch-all
  3. Routes are automatically protected from the catch-all footgun

Webhook Endpoints (Production)

POST /tasks/url

Updates a Notion page's URL property with a glimpse URL.

Authentication: Requires X-API-KEY header with NOTION_WEBHOOK_SECRET value.

Request Body:

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

Alternative payload structures supported:

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

Success Response (200):

{ "success": true, "message": "Page URL updated successfully", "pageId": "page-id-here", "url": "https://your-domain.com/glimpse/page-id-here", "timestamp": "2024-01-01T00:00:00.000Z" }

Error Responses:

400 - Missing page ID:

{ "success": false, "error": "Page ID is required in webhook payload" }

400 - Missing host header:

{ "success": false, "error": "Host header is required" }

500 - Notion API error:

{ "success": false, "error": "Failed to update Notion page with URL", "details": "Notion API error message" }

Testing:

curl -X POST https://your-val.web.val.run/tasks/url \ -H "X-API-KEY: your-notion-webhook-secret" \ -H "Content-Type: application/json" \ -d '{"data": {"id": "your-page-id"}}'

Debug/Test Endpoints

POST /tasks/notion-webhook

Test webhook receiver - logs payload and returns success. Not for production use.

Authentication: Requires X-API-KEY header with NOTION_WEBHOOK_SECRET value.

Response:

{ "success": true }

POST /tasks/test

Test endpoint for webhook authentication.

Authentication: Requires X-API-KEY header with NOTION_WEBHOOK_SECRET value.

Success Response (200):

{ "success": true, "message": "Webhook authentication successful", "timestamp": "2024-01-01T00:00:00.000Z" }

GET /tasks/debug-webhook

Debug endpoint to check webhook configuration.

No authentication required.

Response:

{ "hasSecret": true, "secretLength": 32 }
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.