Back-End Functions
The CommCenter Azure Functions app provides the shared server-side services behind Academy District 20 websites and related applications. It is more than a CommCenter component: the public websites, calendar, directory, school directory, shared interface components and Hasura automation all depend on functions in this app.
The implementation is in the asd20-commcenter/functions directory. It uses TypeScript on Node.js and is deployed to Azure Functions separately from CommCenter and the public websites.
This page describes the active functionality reviewed in September 2026. The current app contains 34 HTTP-triggered functions and one scheduled function. A legacy AI site-search function remains in the source repository's archived directory but is not part of the active surface.
What the Functions Layer Provides
The functions layer handles work that should not run directly in a visitor's browser or in the CommCenter interface, including:
- protecting service credentials for Azure Search, AI models, Microsoft Graph, Google Analytics, translation, storage and delivery systems
- providing browser-safe search APIs for website content, files, events and people
- building and maintaining the search indexes used by websites and other apps
- generating AI-assisted search answers, summaries, polished content and image alt text
- synchronizing calendars, employee data and website analytics
- validating, moderating, rate-limiting, auditing and delivering public form submissions
- producing RSS feeds
- running data-retention, role-reconciliation and group-membership maintenance
- starting and monitoring public website deployments
Some functions respond directly to a browser request. Others are invoked by CommCenter, a Hasura action or event trigger, a Hasura cron schedule, an Azure timer or an administrative maintenance workflow.
Search, AI Search and Search Reporting
These functions provide the public search experience while keeping Azure Search credentials out of browser applications.
| Function | Route | Functionality |
|---|---|---|
httpSearchMessages | /api/search/messages | Searches messages used for announcements, stories, notifications and other feed content. It supports the public website and the calendar, directory and school directory apps. |
httpSearchPages | /api/search/pages | Searches published website pages and returns the Azure Search response expected by website search components. |
httpSearchFiles | /api/search/files | Searches indexed public files and their categories, owners, organizations, tags and other metadata. |
httpSearchEvents | /api/search/events | Searches synchronized calendar events for website and calendar views. |
httpSearchPeople | /api/search/people | Searches public directory profiles without exposing Azure Search configuration to the directory app. |
httpAiSiteChat | /ai-site-chat | Runs the current conversational website search. It retrieves relevant indexed content, builds a grounded answer, supplies supporting links and carries limited conversation context for follow-up questions. |
httpAiContentSearch | /ai-content-search | Supports the earlier/fallback AI content-search contract. It searches indexed website content and produces an answer for compatible website callers. |
httpLogSearchAnalytics | /log-search-analytics | Records search questions, search type, result counts, related-page counts, organization context, response details and timing for the AI Search Analytics dashboard. |
httpLogSearchFeedback | /log-search-feedback | Records helpful/not-helpful ratings and optional visitor feedback for an existing search log. |
The five /api/search/* routes are shared platform contracts. Changing their routes, request formats or response shapes can affect multiple repositories and public experiences.
Editor and Accessibility Assistance
These functions support tools that editors see in CommCenter and translation features used by CommCenter or public websites.
| Function | Route | Functionality |
|---|---|---|
httpContentPolish | /content-polish | Uses the configured AI provider to polish message HTML or generate a summary. It preserves supported links, images, formatting and template tokens, and normalizes common heading problems in the returned content. |
httpContentQuality | /content-quality | Evaluates message content for grammar, link wording, heading structure and excessive bolding. It also calculates readability, skimability, accessibility and related text statistics used by quality reporting. |
httpImageAltText | /image-alt-text | Analyzes an uploaded image or image URL, proposes concise alt text and returns warnings for text-heavy images and QR codes that may create accessibility problems. |
httpTranslateText | /translate | Sends plain text or HTML to Azure Translation, splits long inputs into acceptable request sizes and returns the translated pieces in their original order. |
The AI editor functions require an authenticated, allowed caller even though their Azure HTTP trigger metadata permits the request to reach the function. Editors should review all generated content before publishing it.
Search Index Maintenance
Search results do not query the CommCenter database directly. Indexing functions transform CommCenter records or stored files into search documents and send them to the appropriate Azure Search index.
| Function | Route | Functionality |
|---|---|---|
httpIndexAllAiContent | /index-all-ai-content | Rebuilds the consolidated content used for AI retrieval from published pages, messages and other supported public records. |
httpIndexAllMessages | /index-all-messages | Rebuilds the complete message index used by search, notifications and RSS feeds. |
httpIndexAllPages | /index-all-pages | Rebuilds the published page index, including searchable page content and supported page-like records. |
httpIndexAllPeople | /index-all-people | Rebuilds the directory people index from profiles, employee details, organizations and groups. |
httpIndexMessage | /index-message | Adds, updates or removes one message search document after a relevant message change. |
httpIndexPage | /index-page | Adds, updates or removes one page search document, including text assembled from its published messages. |
httpUpdateSearchDocument | /update-search-document | Processes Hasura data-change events for supported search entities and their many-to-many relationships, then merges, uploads or deletes the affected search document. |
httpUpdateSearchFilesIndex | /update-search-files | Creates or verifies the Files index and synchronizes metadata from Azure Blob Storage. It supports targeted file updates, deletions, normal refreshes and full rebuilds for authorized administrators. |
The single-record and trigger-driven functions keep indexes current after routine edits. The IndexAll functions are bulk reconciliation tools used by scheduled jobs or operations when an entire index needs to be rebuilt.
Calendars and RSS
Calendar functions connect CommCenter subscription records to public event search. RSS functions convert indexed messages into feeds for downstream systems.
| Function | Route | Functionality |
|---|---|---|
httpCalendarSubscriptionHasuraTrigger | /calendar-subscriptions/hasura-trigger | Responds to calendar subscription changes by creating, updating, disabling or deleting the matching Hasura cron schedule. |
httpCalendarSubscriptionSync | /calendar-subscriptions/sync | Reads a configured iCal or Microsoft Graph calendar, records sync-job progress, removes the calendar's previously indexed events and writes the refreshed event set. |
httpListGraphCalendars | /calendar-subscriptions/graph-calendars | Lists Microsoft Graph calendars available to an authenticated, allowed CommCenter user so an administrator can select the correct calendar ID. |
httpRssAnnouncements | /announcements-rss | Produces a public RSS feed from published messages in the Announcements channel, with organization, category and item-limit filtering. |
httpRssFeatures | /features-rss | Produces a public RSS feed from published News & Stories content and includes a cover-image enclosure when one is available. |
See Calendars for subscription setup and sync history, and RSS Feeds for feed behavior and query options.
Public Forms and Directory Email
The public submission functions act as a controlled boundary between anonymous website visitors and internal delivery systems. They apply request validation, origin controls and abuse protections before sending accepted submissions onward.
| Function | Route | Functionality |
|---|---|---|
httpGetPublicForm | /api/public-forms/{formId} | Returns the safe, public field definition for an enabled form in the server-side form registry. This allows a website to render an approved form without exposing delivery configuration. |
httpSubmitPublicForm | /api/public-forms/{formId}/submissions | Validates an allowlisted form submission, checks rate limits and CAPTCHA when configured, sanitizes the payload, records content-free audit metadata and delivers the request to the configured support queue. |
httpSendAccessibilityIssue | /api/accessibility/issues | Preserves the earlier accessibility-report route while passing the submission through the same generic public-form engine using the fixed accessibility-issue form definition. |
httpSendDirectoryEmail | /api/directory/email | Accepts contact messages from public directory experiences, validates recipient and sender data, applies CAPTCHA, rate limits and content moderation, records delivery/audit status and relays accepted messages. |
The public-form registry currently contains the active accessibility issue form and a configuration-gated Special Education records-request form. A form must be present and enabled in the server registry before its definition or submission route will accept it.
Analytics, Directory Data and Platform Operations
These functions support administrative reporting, data freshness, retention, permissions and website publishing.
| Function | Route or schedule | Functionality |
|---|---|---|
httpSyncGoogleAnalytics | /sync-google-analytics | Retrieves GA4 page metrics for a requested date range, associates website hosts with CommCenter organizations, classifies content and writes daily reporting rows used by Website Analytics. It supports authorized manual and scheduled calls. |
timerSyncGoogleAnalytics | Configured Azure timer | Runs the same GA4 synchronization automatically for a rolling date window. This is the only active non-HTTP function. |
httpUpdateEmployees | /update-employees | Downloads the current employee export, normalizes organization, office, title and contact fields, and replaces the employee snapshot used by directory profiles and maintenance jobs. |
httpCleanup | /cleanup | Runs recurring housekeeping: old calendar sync jobs and message revisions are removed; old search logs are aggregated and purged; email/form audit retention is applied; obsolete role assignments and eligible stale unassigned users are reconciled; and the CommCenter Editor role can be synchronized to the Microsoft 365 Web Editors group. Stale-user deletion and group synchronization have enable and dry-run settings, while all three identity-maintenance tasks use conservative data and change-limit safeguards. |
httpWebsiteDeploy | /website-deploy/{action?} | Allows an authenticated CommCenter administrator to check deployment availability, start one-site or all-site Netlify builds and poll their status. It prevents duplicate active builds and can be disabled by environment. |
See Analytics & Reporting for the dashboards and sync behavior, and Website Publishing for the administrator deployment workflow.
How the Pieces Work Together
A typical content change moves through several layers:
- An editor saves structured content in CommCenter, which writes it through Hasura to PostgreSQL.
- Hasura events or scheduled jobs invoke an indexing function when the related search document must change.
- Public websites call a search proxy or AI search function, which queries Azure Search with server-held credentials.
- Search and feedback functions write usage information back through Hasura for administrative reporting.
Other workflows follow the same boundary pattern. Calendar subscriptions are stored in CommCenter but synchronized into the event index by functions. GA4 remains the source for website traffic, but functions import its data into reporting tables. Public forms are displayed by the website, but their validation, abuse controls, audit record and delivery happen in the functions layer.
Access and Operational Boundaries
An Azure trigger marked as anonymous is not automatically an unrestricted administrative feature. Depending on the route, the implementation also uses one or more of the following controls:
- Microsoft Entra ID authentication and allowed audiences, roles or groups
- CommCenter role and permission checks
- Function keys for server-to-server jobs
- Hasura role or event payload validation
- CORS origin allowlists
- strict payload and form-registry validation
- CAPTCHA, rate limiting and content moderation
- feature-enable switches, dry-run settings and maximum-change safeguards
Service credentials and environment-specific settings belong in Azure Function App settings, not in website code or this guide.
The Functions app is released independently. Publishing CommCenter or rebuilding a public website does not deploy function changes. Similarly, saving content does not guarantee that every search index, calendar feed or analytics report is refreshed immediately; the relevant event, sync or scheduled job must finish.
Troubleshooting Starting Points
| Symptom | Start with |
|---|---|
| A page, message or person is missing from search | Confirm the record is published and eligible, then check the appropriate single-record or IndexAll workflow and Azure Search index. |
| Calendar events are missing or old | Review the subscription's Sync History and job details, then confirm its iCal URL or Microsoft Graph calendar ID and automatic sync schedule. |
| A file does not appear in search | Confirm the file metadata and storage record, then use the authorized Files index refresh and review its result. |
| AI search gives weak or outdated answers | Verify the source content first, then confirm the AI content index is current and review AI Search Analytics and visitor feedback. |
| Website Analytics is stale | Check the most recent GA sync and run the authorized manual sync if fresh data is required. |
| A public email or form was not delivered | Review Email Reporting for validation, CAPTCHA, moderation, rate-limit and delivery status. Do not ask the submitter to send sensitive data through an unapproved channel. |
| A website deployment cannot start | Check whether deployment is enabled, whether an existing build is active and whether the organization is an enabled deployment target. |
