Skip to main content

Knowledge > Runbooks > Chatbot Ops > Update Knowledge Base Content for a Church

Update Knowledge Base Content for a Church

Add or update FAQ and knowledge base entries that the chatbot uses to answer questions about a specific church. Content is stored in unified_rag_content with category='church_kb'.

Prerequisites

  • Church UUID from organization_settings or churches table
  • Supabase MCP or direct DB access
  • Content to add (Q&A pairs, service info, pastor bios, program descriptions)

How It Works

The chatbot performs pgvector similarity search on unified_rag_content to find relevant content before generating a response. The better the KB content, the more accurate and specific the chatbot's answers.

Content is embedded lazily — the vector embedding is generated on first search. For large batch updates, optionally pre-generate embeddings using the embedding script.

Steps

View existing KB content for a church

SELECT id, content, source, is_public, created_at
FROM unified_rag_content
WHERE church_id = '[uuid]'
AND category = 'church_kb'
AND is_public = true
ORDER BY created_at DESC
LIMIT 20;

Add a new FAQ entry

INSERT INTO unified_rag_content (
church_id,
category,
content,
source,
is_public,
created_at,
updated_at
) VALUES (
'[uuid]',
'church_kb',
'Q: What are your service times?
A: We hold Sunday worship at 9:00 AM and 11:00 AM, and Wednesday evening Bible study at 7:00 PM.',
'admin',
true,
now(),
now()
);

Format content as a Q&A pair for maximum chatbot utility. The chatbot uses both the question and answer in similarity matching.

Add multiple entries in one statement

INSERT INTO unified_rag_content (church_id, category, content, source, is_public, created_at, updated_at)
VALUES
('[uuid]', 'church_kb', 'Q: Where are you located?\nA: We are at 123 Main Street, Springfield. Free parking is available in the lot behind the building.', 'admin', true, now(), now()),
('[uuid]', 'church_kb', 'Q: Who is the lead pastor?\nA: Our lead pastor is Rev. James Carter. He has served our congregation since 2015.', 'admin', true, now(), now()),
('[uuid]', 'church_kb', 'Q: Do you have children''s programs?\nA: Yes, we offer Kids Church during both Sunday services for children ages 3–12, plus a weekly AWANA program on Wednesdays.', 'admin', true, now(), now());

Update existing content

UPDATE unified_rag_content
SET content = 'Q: What are your service times?
A: Sunday worship is at 9:30 AM and 11:00 AM. We also offer an online stream at 9:30 AM.',
updated_at = now()
WHERE id = '[content-uuid]'
AND church_id = '[uuid]'; -- always scope by church_id as a safety guard

Hide outdated content (do NOT delete)

UPDATE unified_rag_content
SET is_public = false, updated_at = now()
WHERE id = '[content-uuid]'
AND church_id = '[uuid]';

Never DELETE from unified_rag_content without explicit founder approval. Set is_public = false to suppress content from search.

Content Guidelines

  • Write content as Q&A pairs — the question improves semantic search matching.
  • Keep each entry focused on one topic (hours, location, programs, staff, etc.).
  • Use plain language — the chatbot paraphrases, so formal phrasing is fine.
  • Maximum ~500 words per entry for optimal embedding quality.
  • Include variations of the question if callers phrase it differently.

Verification

After adding content, test the chatbot with a question that should match the new entry:

curl -X POST https://churchwiseai.com/api/chatbot/stream \
-H "Content-Type: application/json" \
-d '{"message": "What time are your services?", "churchId": "[uuid]", "conversationId": "[new-uuid]"}'

The response should include the specific service times you just added.

See Also