Knowledge > Runbooks > Chatbot Ops > Add Chatbot for a New Church
Add Chatbot for a New Church
Provision the ChurchWiseAI chatbot for a church that has purchased a chat or bundle subscription. After this runbook, the church will have a working chatbot and the embed code to add it to their website.
Schema Warning — Verified 2026-03-25
IMPORTANT: The actual
organization_settingstable schema was verified against production on 2026-03-25 and differs significantly from earlier assumptions. Key findings:
- The primary key for joining is
organization_id(UUID), NOTchurch_id- There is NO
pro_website_modecolumn — it does not exist in this table- There is NO
enabledcolumn, NOtiercolumn, NOtheological_lens_idcolumn, NOgreeting_messagecolumn, NOchatbot_namecolumn as top-level columns- Chatbot config (tone, language, theological lens, welcome message, etc.) lives inside the
chatbot_configJSONB column- Agent configuration lives in
agent_config,agent_tool_config,business_agent_config,business_tool_configJSONB columnsActual columns in
organization_settings(as of 2026-03-25):
Column Type Nullable iduuid NO organization_iduuid NO brandingjsonb YES security_settingsjsonb YES notification_preferencesjsonb YES feature_flagsjsonb YES integration_settingsjsonb YES compliance_settingsjsonb YES created_attimestamptz YES updated_attimestamptz YES account_settingsjsonb NO chatbot_configjsonb NO widget_primary_colortext YES widget_positiontext YES agent_configjsonb YES doctrinal_overridesjsonb YES agent_tool_configjsonb YES business_agent_configjsonb YES business_tool_configjsonb YES The steps below have been updated to reflect the actual schema. The
organization_idvalue — and the link between a church and theirorganization_settingsrow — needs to be confirmed against thepremium_churchesorchurchestable join pattern. Agents should query the actual row before writing any SQL updates.
Prerequisites
- Church has an active subscription in
premium_churcheswith a chat-enabled plan - Church UUID from the
churchestable - Supabase MCP or direct DB access
- Church denomination (for auto-selecting theological lens)
Steps
-
Verify the subscription is active and includes chatbot:
SELECT pc.church_id, pc.plan, pc.status, pc.tier, c.name, c.denomination_idFROM premium_churches pcJOIN churches c ON c.id = pc.church_idWHERE pc.church_id = '[uuid]';Confirm
status = 'active'andplanincludes chat (e.g.,starter_chat,pro_chat,suite_chat,starter_bundle,pro_bundle,suite_bundle). -
Determine the theological lens from the church's denomination:
SELECT id, name, traditionFROM sai_theological_lensesORDER BY name;Match the church's denomination to the closest tradition. Use
universal(id=1) if uncertain. -
Check if
organization_settingsrow already exists (may have been auto-created). Note: join viaorganization_id— confirm the correct join key againstpremium_churchesorchurches:SELECT id, organization_id, chatbot_config, agent_config, widget_primary_color, widget_positionFROM organization_settingsWHERE organization_id = '[organization_uuid]'; -
If no row exists, INSERT one with chatbot config inside the
chatbot_configJSONB column:INSERT INTO organization_settings (organization_id,chatbot_config,widget_primary_color,widget_position,updated_at) VALUES ('[organization_uuid]',jsonb_build_object('welcome_message', jsonb_build_object('text', 'Hi! I''m here to help with questions about our church. How can I assist you?','cta_buttons', '[]'::jsonb,'greeting_variants', '[]'::jsonb),'behavior', jsonb_build_object('tone', 'friendly','language', 'en','response_length', 'medium','theological_lens', '[lens_name]' -- e.g. 'ecumenical', 'reformed', etc.),'appearance', jsonb_build_object('logo_url', null,'position', 'bottom-right','custom_css', null,'primary_color', '#4F46E5'),'knowledge_base', jsonb_build_object('max_documents', 100,'scraping_enabled', false,'faq_management_enabled', true)),'#1B365D','bottom-right',now()); -
If a row exists and chatbot needs enabling, update the
chatbot_configJSONB:UPDATE organization_settingsSET chatbot_config = chatbot_config || '{"enabled": true}'::jsonb,updated_at = now()WHERE organization_id = '[organization_uuid]'; -
For Pro Website churches — chatbot is automatically provisioned on signup with a simplified toolset (Q&A + prayer requests only, no RAG). There is no
pro_website_modecolumn inorganization_settings. Pro Website mode restrictions are enforced at the application layer (not the DB schema). Verify the church's chatbot config:SELECT organization_id, chatbot_config, agent_config, agent_tool_configFROM organization_settingsWHERE organization_id = '[organization_uuid]'; -
Provide the church admin with their embed code. Direct them to the admin dashboard:
https://churchwiseai.com/admin/[token]/settingsThe embed code is available there. It includes the church-specific widget script tag.
-
Test the chatbot via the admin dashboard preview or by embedding the widget on a test page:
- Ask a general question about the church
- Submit a prayer request
- Verify the response style matches the theological lens
Verification
organization_settingsrow exists for the church'sorganization_id.chatbot_configJSONB contains a validwelcome_messageandbehaviorblock.- Chatbot responds correctly at the admin preview URL.
- Prayer requests submitted via chatbot appear in
voice_prayer_requests.
Rollback
To disable the chatbot (via application-layer flag in the JSONB config):
UPDATE organization_settings
SET chatbot_config = chatbot_config || '{"enabled": false}'::jsonb,
updated_at = now()
WHERE organization_id = '[organization_uuid]';
Note: confirm with the chatbot route code (
churchwiseai-web/src/app/api/chatbot/stream/route.ts) which field it reads for the enabled/disabled state — it may usepremium_churches.statusrather than anything inorganization_settings.
See Also
- disable-chatbot.md — disable or suspend the chatbot
- update-kb-content.md — add knowledge base content for the church
- chatbot-debug.md — if the chatbot is not responding correctly
- add-voice-agent.md — if the church also purchased voice