Overview

  • The worker integrates with up to four Notion databases
  • Database ids are set as [vars] in wrangler.toml; the API key is a Wrangler secret
  • NOTION_DATABASE_ID is required for live event data; shifts, announcements, and an explicit tender-directory DB are optional
  • If NOTION_API_KEY is not configured, /api/events falls back to placeholder data instead of live Notion results

Sources: worker.js (CONFIG section), wrangler.toml


Credentials

wrangler secret put NOTION_API_KEY

The integration token must have read access to every database the worker touches.

Optional QR sync credentials

If you want the Worker to generate Short.io tender QR codes and write them back into Notion, also configure:

wrangler secret put NOTION_QR_SYNC_API_KEY
wrangler secret put SHORT_IO_API_KEY
wrangler secret put TENDER_QR_SYNC_TOKEN
  • NOTION_QR_SYNC_API_KEY should point at a narrower integration with write access to the Pub Tender DB
  • SHORT_IO_API_KEY is the Short.io API token used to create or update links and QR SVGs
  • TENDER_QR_SYNC_TOKEN protects POST /api/sync-tender-qrs

Events Database (NOTION_DATABASE_ID)

Drives both todayEvents and weekEvents in the API response.

Required properties

Notion propertyTypeNotes
NameTitleEvent name
Event StartDateStart date/time, ideally with timezone
Event EndDateEnd date/time, optional but recommended
Include on Pub TVCheckboxMust be checked for the event to appear

Optional properties

Notion propertyTypeNotes
LocationRich text or SelectDisplayed inline with the time on the TV and iPad board. No longer used for filtering — any location value (or none) is fine.
Duration (hrs)NumberUsed to estimate end time if Event End is not set
Source Email SubjectRich textScanned for RC-Direct or RC-Affiliate substrings

TV include gate

The Include on Pub TV checkbox is the sole gate. Location is no longer required to contain "pub" — events at any location can appear on the display.

Sources: worker.js (PROP_TV_INCLUDE, PROP_SOURCE_EMAIL_SUBJECT, PROP_LOCATION)


Shifts Database (NOTION_SHIFTS_DATABASE_ID)

Drives the pub-tender footer and the weekly pub-hours grid.

Required properties

Notion propertyTypeNotes
Date/TimeDate with endFull shift window including setup and cleanup
Not in PubCheckboxIf checked, the shift is excluded from the pub display

Optional properties

Notion propertyTypeNotes
Operational TimeframeDate with endNarrower serving window used for hours display and footer state
Last CallNumberMinutes before operational end to enter the last-call state
Shift StatusSelect or StatusInformational only; not currently used in rendering
Assignments DBRelationLinks shifts to assignment rows

Shift state logic

Full shift window:         |------------------------------------|
Operational timeframe:         |----------------------|
Last call window:                             |---|
                         setup   active   last-call  closed

Sources: worker.js (fetchPubTenderFromNotion, deriveShiftNote)

Assignments relation

The Shifts DB links to an Assignments DB via the Assignments DB relation. Each assignment row links to individual Pub Tender pages via the Pub Tenders DB relation.

flowchart LR
  SHIFT["Shifts DB page"] -- "Assignments DB" --> ASSIGN["Assignment page"]
  ASSIGN -- "Pub Tenders DB" --> TENDER["Pub Tender page"]
  TENDER -- "Name (always)" --> FOOTER["TV footer"]
  TENDER -- "Picture / QR when opted in" --> SLIDE["TV tender slide"]

Sources: worker.js (fetchTenderInfoFromAssignment, fetchTenderInfoFromAssignmentPage)


Pub Tender Database (NOTION_PUB_TENDERS_DATABASE_ID)

This optional env var points directly at the tender directory database used by GET /api/tenders.

If it is not set, the worker can still discover the directory database by following:

Shifts DB -> Assignments DB -> Pub Tenders DB

Setting NOTION_PUB_TENDERS_DATABASE_ID explicitly is still recommended because it is easier to reason about and troubleshoot.

Required properties

Notion propertyTypeNotes
NameTitleTender’s full display name
ActiveCheckboxMust be checked for the tender to appear in /api/tenders and /tenders/

Optional properties

Notion propertyTypeNotes
Tender IDText / Unique ID / Rich textRequired for stable /tenders/?tender=<id> links and automated QR sync
BioRich textUsed in the directory modal on /tenders/
PictureFiles and mediaUsed in both the directory and TV tender slides
Meet your TenderCheckboxMust be checked for the tender to appear in TV tender slides
QRFiles and mediaPre-rendered QR image shown on TV tender slides
ZelleRich text / URL / Phone / EmailUsed by the /tenders/ modal payment button
VenmoRich text / URLUsed by the /tenders/ modal payment button
QR LinkURL / Rich textWritten by the QR sync flow when available
Short.io Link IDRich text / TextWritten by the QR sync flow when available
Page URLURLGeneral profile URL metadata
URLURLAlternate URL metadata
LinkURLAlternate URL metadata

Current behavior by property

PropertyUsed byCurrent behavior
Active/api/tendersGates directory inclusion
Meet your Tender/api/events TV slidesGates whether the tender becomes a TV profile slide
Tender ID/tenders/?tender=<id>, QR syncCanonical id for deep links and Short.io slug generation
Bio/api/tendersShown in the /tenders/ modal
PictureBothUsed in the directory and TV
QRTV slides, QR syncTV reads only the QR image file; QR sync writes the SVG here
Zelle/tenders/ modalFrontend converts email to mailto: and phone-like values to tel:
Venmo/tenders/ modalFrontend accepts either a full Venmo URL or an @handle-style value
PayPal / Paypal / PayPal URL / Paypal URL/tenders/ modalFrontend accepts a full PayPal URL or a PayPal handle-style value
QR Link / Short.io Link IDQR syncUsed to track or update existing Short.io links
Page URL / QR Link / URL / LinkDirectory metadataUsed to resolve pageUrl on tender objects

QR behavior on TV

The current TV implementation only renders qrImageUrl, which comes from the tender page’s QR file property. The recommended path is to keep that property populated via POST /api/sync-tender-qrs. URL properties like QR Link and Page URL are not turned into a runtime-generated QR on the TV.

Meet your Tender gate

If Meet your Tender is unchecked, the tender can still appear in /tenders/ if Active is checked and can still appear by first name in the TV footer if assigned to the active shift. The checkbox only gates the TV profile slide.

Property name casing

The Meet your Tender checkbox lookup is case-insensitive.

Sources: worker.js (fetchTenderInfoFromAssignmentPage, transformTenderDirectoryPage, extractUrlPropertyByNames)


Announcements Database (NOTION_ANNOUNCEMENTS_DATABASE_ID)

Drives announcement slides in the TV slideshow and the /announcements/ page.

Required properties

Notion propertyTypeNotes
NameTitleFallback announcement text if Content is empty
Include on Pub TVCheckboxMust be checked for the announcement to be returned

Optional properties

Notion propertyTypeNotes
ContentRich textPreferred announcement text source
PrioritySelectOptional styling hint; currently used for high slides
DurationNumberOptional slide duration in seconds
Picture / Image / PNGFiles and mediaOptional announcement image used by both /tv/ and /announcements/

No date filtering

Announcements are not currently filtered by date. Archive or remove stale rows to keep the display clean.

Announcement image routing

The worker rewrites announcement images to same-origin /api/image/announcement/:pageId URLs before handing them to the frontend. This helps embedded TV browsers handle the images more reliably.

Sources: worker.js (fetchAnnouncementsFromNotion)


wrangler.toml configuration

[vars]
NOTION_DATABASE_ID               = "<32-char hex ID from Events DB URL>"
NOTION_SHIFTS_DATABASE_ID        = "<32-char hex ID from Shifts DB URL>"
NOTION_ANNOUNCEMENTS_DATABASE_ID = "<32-char hex ID from Announcements DB URL>"
NOTION_PUB_TENDERS_DATABASE_ID   = "<32-char hex ID from Pub Tenders DB URL>"
PUBLIC_SITE_URL                 = "https://pub.ihnyc-rc.org"
SHORT_IO_DOMAIN                 = "go.example.org"

Database ids are the 32-character hex string in the Notion URL before the ? query string.