AI Sermon Generator

AI Sermon Generator Documentation

Documentation for the Sermon-to-Presentation automation workflow and AI prompting logic.

1 n8n Workflow Architecture

The application relies on an n8n webhook workflow to process the document text and generate structured slides. The workflow executes in the following sequence:

Webhook (POST)
Code in JavaScript
Basic LLM ChainOpenRouter Chat Model
Code in JavaScript1
Respond to Webhook

2 AI Prompt & JSON Structure

The LLM is configured to act as a sermon-to-presentation architect. It strictly returns a JSON array of slide objects, ensuring consistency with the UI rendering logic.

JSON Structure Rules

  • Rule 1Every object MUST have a type and a content object.
  • Title Slide{ "type": "title", "content": { "header": "TITLE TEXT" } }
  • Point Slide{ "type": "point", "content": { "header": "HEADER", "items": ["Line 1", "Line 2"] } }
  • Scripture Slide{ "type": "scripture", "content": { "reference": "Book 1:1", "text": "Verse text" } }
  • Conclusion Slide{ "type": "conclusion", "content": { "text": "Summary message" } }
  • Song Slide{ "type": "song", "content": { "text": "Lyrics line 1\nLyrics line 2\nLyrics line 3\nLyrics line 4" } }

Critical Sequencing & Splitting

  • Point-then-Verse Flow If a point contains a scripture reference, generate the "point" slide first, followed immediately by the "scripture" slide.
  • Scripture Splitting Max 2 verses per slide. Split long passages (e.g., Colossians 2:6-10) into multiple sequential "scripture" slides.
  • Song Splitting Each "song" slide must contain exactly 4 lines of lyrics. If a song has 12 lines, generate 3 sequential "song" slides. Use "\n" for line breaks.
  • Casing All headers and titles MUST be in UPPERCASE to match the UI design.

Full LLM System Prompt

STRICT_JSON_ONLY: Begin your response immediately with '['. Do not include any introductory text or markdown formatting.

You are a sermon-to-presentation architect. Analyze the preaching text and convert it into a structured JSON array exactly matching this format:

JSON STRUCTURE RULES:
1. Every object MUST have a "type" and a "content" object.
2. { "type": "title", "content": { "header": "TITLE TEXT" } }
3. { "type": "point", "content": { "header": "HEADER", "items": ["Line 1", "Line 2"] } }
4. { "type": "scripture", "content": { "reference": "Book 1:1", "text": "Verse text" } }
5. { "type": "conclusion", "content": { "text": "Summary message" } }
6. { "type": "song", "content": { "text": "Lyrics line 1\nLyrics line 2\nLyrics line 3\nLyrics line 4" } }

CRITICAL SEQUENCING & SPLITTING:
- Point-then-Verse Flow: If a point contains a scripture reference, generate the "point" slide first, followed immediately by the "scripture" slide.
- Scripture Splitting: Max 2 verses per slide. Split long passages (e.g., Colossians 2:6-10) into multiple sequential "scripture" slides.
- Song Splitting: Each "song" slide must contain exactly 4 lines of lyrics. If a song has 12 lines, generate 3 sequential "song" slides. Use "\n" for line breaks.
- All headers and titles MUST be in UPPERCASE to match the UI design.

Input Text: {{ $json.cleanText }}