Skip to main content

Pastor configures Knowledge Base

Persona

A pastor in their first 24 hours after account creation. Excited but slightly overwhelmed. They know the chatbot needs to know about their church — service times, staff, what they believe. They want simple forms with hint text, not blank text boxes. They have 20–30 minutes and will refine later.

Entry points

  1. Training tab — First login; sees "Training" in sidebar, clicks it.
  2. Onboarding wizard — First-login flow shows "Set Up Your Church Knowledge" as Step 2.
  3. Email CTA — "You're almost ready — tell us about [Church Name]" → /admin/[token]?tab=training.

Click-through flow

Steps

  1. Open Training tab?tab=training. Sub-tabs: Church Knowledge (default), This Week, Theology, Agents, Safety. Starter does NOT show: FAQs or Simulator sub-tabs (Pro+). TrainingTab.tsx loads organization_settings for this church.

  2. Fill Church Info — Name (pre-filled), Location, Phone, Website, About Us (200 char). Autosaves every 5 seconds; explicit "Save" updates organization_settings.church_info JSONB.

  3. Fill Service Times — Day of week dropdown, time picker, service type (Main Service, Youth, Prayer, Small Group, Other). Stored in organization_settings.service_times as array.

  4. Add Staff — Name, Title (Pastor, Associate Pastor, Music Minister, Volunteer, Other), Bio (100 char, optional). Stored in organization_settings.staff as array. Staff names and titles are injected into chatbot system prompt so agent can refer callers to the right person.

  5. Document upload (optional) — Drag-and-drop zone. Max 20MB. Accepted: pdf, docx, doc, txt, png, jpg, jpeg. POST to /api/admin/kb-proxy/upload?churchId=[uuid]. File stored in Supabase Storage training-documents/[churchId]/[filename]. Embedding job queued; unified_rag_content rows created with church_id, source='upload'. UI shows "Embedding in progress…" → "Ready" (typically within 5 minutes).

  6. Test chatbot with new knowledge — Navigate to /chat/[slug]. Type "What time is Sunday service?" or "Who is the pastor?" RAG retrieval loads church facts + uploaded documents. Response should reflect service times, staff names, or document context.

Acceptance spec

Canonical: knowledge/acceptance/starter-chat.md (Touchpoints D-1 through D-6).

Starter tier specifics:

  • Church Info, Service Times, Staff forms: available
  • Document upload: available
  • Theology: denomination selector only (full theology editing is Pro+)
  • Agents sub-tab: visible but read-only for Starter
  • Safety sub-tab: available
  • No FAQ management (Pro+ only)
  • No Document simulator (Pro+ only)

Success criteria

  • Form fields clear, not overwhelming (hint text on every field).
  • Data saves without refresh or error message.
  • Uploaded documents show "Embedding..." then "Ready" status.
  • Test message references church name, service times, or staff on next query.
  • Edits to service times are reflected in chatbot response immediately.
  • Document upload rejects files >20MB with a clear error message.

Known failure modes

  • Embedding backlog >5 minutes. Check Supabase cron logs for failed embedding tasks. Monitor unified_rag_content for rows with embedding IS NULL. Source: memory/project_embedding_backlog.md.

  • Duplicate rows in unified_rag_content. Upload endpoint must be idempotent — use (church_id, source_file_hash, source_type) composite unique constraint. Source: memory/feedback_rag_duplicate_detection.md.

  • Staff name not in system prompt. Verify buildSystemPrompt() includes staff.map(s => s.name + ' (' + s.title + ')').join(', '). Source: memory/feedback_staff_not_in_prompt.md.

  • Calendar boundary: today's events excluded. Query must use event_date >= NOW() (not >). Source: memory/feedback_calendar_boundary.md.

  • normalizePlanTier() written back to DB. All writes to premium_churches.plan must use raw Stripe plan keys, never the collapsed tier. Source: memory/feedback_plan_tier_not_persisted.md.