Generate a Presentation with Slide-by-Slide Generation
This guide demonstrates how to use the SlideSpeak API’s slide-by-slide endpoint to generate a custom presentation with multiple slides, each with specific layouts and content. This approach gives you complete control over your presentation’s structure and flow.
When to Use Slide-by-Slide Generation
Section titled “When to Use Slide-by-Slide Generation”The slide-by-slide endpoint is ideal when you need:
- Precise Control: Define exactly what content goes on each slide
- Custom Flow: Create presentations with specific narrative structures
- Mixed Content Types: Combine different layouts (timeline, comparison, items, etc.) in one presentation
- Complex Presentations: Build presentations that require specific slide sequences
Benefits of Slide-by-Slide Generation
Section titled “Benefits of Slide-by-Slide Generation”- Exact Content Control: Specify exactly what text appears on each slide
- Layout Flexibility: Mix and match different slide layouts within one presentation
- Structured Flow: Create logical presentation sequences with specific transitions
- Image Integration: Add specific images to slides
- Efficient Workflow: Generate complex presentations in a single API call
Example: Business Plan Presentation
Section titled “Example: Business Plan Presentation”Let’s create a 5-slide business plan presentation for a sustainable coffee shop startup. This example demonstrates different layouts and how they work together.
Step 1: Prepare the Request Body
Section titled “Step 1: Prepare the Request Body”{ "template": "default", "language": "ENGLISH", "fetch_images": true, "verbosity": "standard", "include_cover": true, "include_table_of_contents": true, "slides": [ { "title": "Market Opportunity Analysis", "layout": "comparison", "item_amount": 2, "content": "Current Market: Traditional coffee shops dominate with 85% market share, limited sustainable options available, high prices for organic coffee. Our Opportunity: Growing demand for sustainable products (23% annual growth), underserved market segment, competitive pricing strategy with premium positioning." }, { "title": "Key Success Factors", "layout": "items", "item_amount": 4, "content": "Sustainable Sourcing: Partner with certified organic coffee farms, implement fair trade practices, ensure traceability from bean to cup. Location Strategy: Target high-traffic areas near offices and universities, focus on walkable neighborhoods, consider co-working space partnerships. Brand Positioning: Premium sustainable coffee experience, community-focused atmosphere, transparent sourcing story. Technology Integration: Mobile ordering app, loyalty program, digital menu boards, contactless payment options." }, { "title": "Financial Projections", "layout": "big-number", "item_amount": 3, "content": "$450,000: First-year revenue projection based on market research and competitor analysis. 35%: Expected profit margin through efficient operations and premium pricing strategy. 18 months: Break-even timeline with conservative growth assumptions and proper capital allocation." }, { "title": "Implementation Timeline", "layout": "timeline", "item_amount": 5, "content": "Month 1-2: Market research and location scouting, secure initial funding and partnerships. Month 3-4: Lease negotiation and space design, obtain permits and licenses. Month 5-6: Renovation and equipment installation, staff hiring and training. Month 7: Soft launch with limited menu, gather customer feedback and refine operations. Month 8+: Full launch with complete menu, marketing campaigns, and expansion planning." }, { "title": "Risk Assessment", "layout": "swot", "item_amount": 4, "content": "Strengths: Strong market demand for sustainable options, experienced team, unique value proposition. Weaknesses: Limited initial capital, new brand recognition, dependency on coffee suppliers. Opportunities: Growing sustainability trend, potential for franchise expansion, online coffee subscription service. Threats: Competition from established chains, fluctuating coffee bean prices, changing consumer preferences." } ]}
Step 2: Make the API Request
Section titled “Step 2: Make the API Request”const API_KEY = 'your-api-key';const API_BASE = 'https://api.slidespeak.co/api/v1';
async function generateBusinessPlanPresentation() { const response = await fetch(`${API_BASE}/presentation/generate/slide-by-slide`, { method: 'POST', headers: { 'X-API-Key': API_KEY, 'Content-Type': 'application/json' }, body: JSON.stringify({ template: 'default', language: 'ENGLISH', fetch_images: true, verbosity: 'standard', include_cover: true, include_table_of_contents: true, slides: [ { title: 'Market Opportunity Analysis', layout: 'comparison', item_amount: 2, content: "Current Market: Traditional coffee shops dominate with 85% market share, limited sustainable options available, high prices for organic coffee. Our Opportunity: Growing demand for sustainable products (23% annual growth), underserved market segment, competitive pricing strategy with premium positioning." }, { title: 'Key Success Factors', layout: 'items', item_amount: 4, content: "Sustainable Sourcing: Partner with certified organic coffee farms, implement fair trade practices, ensure traceability from bean to cup. Location Strategy: Target high-traffic areas near offices and universities, focus on walkable neighborhoods, consider co-working space partnerships. Brand Positioning: Premium sustainable coffee experience, community-focused atmosphere, transparent sourcing story. Technology Integration: Mobile ordering app, loyalty program, digital menu boards, contactless payment options." }, { title: 'Financial Projections', layout: 'big-number', item_amount: 3, content: "$450,000: First-year revenue projection based on market research and competitor analysis. 35%: Expected profit margin through efficient operations and premium pricing strategy. 18 months: Break-even timeline with conservative growth assumptions and proper capital allocation." }, { title: 'Implementation Timeline', layout: 'timeline', item_amount: 5, content: "Month 1-2: Market research and location scouting, secure initial funding and partnerships. Month 3-4: Lease negotiation and space design, obtain permits and licenses. Month 5-6: Renovation and equipment installation, staff hiring and training. Month 7: Soft launch with limited menu, gather customer feedback and refine operations. Month 8+: Full launch with complete menu, marketing campaigns, and expansion planning." }, { title: 'Risk Assessment', layout: 'swot', item_amount: 4, content: "Strengths: Strong market demand for sustainable options, experienced team, unique value proposition. Weaknesses: Limited initial capital, new brand recognition, dependency on coffee suppliers. Opportunities: Growing sustainability trend, potential for franchise expansion, online coffee subscription service. Threats: Competition from established chains, fluctuating coffee bean prices, changing consumer preferences." } ] }) }); const result = await response.json(); return result;}
Step 3: Poll the Task Status
Section titled “Step 3: Poll the Task Status”async function pollTask(taskId) { const response = await fetch(`${API_BASE}/task_status/${taskId}`, { headers: { 'X-API-Key': API_KEY, 'Content-Type': 'application/json' } }); const result = await response.json(); if (result.task_status === 'SUCCESS') { return result; } else if (result.task_status === 'FAILED') { throw new Error('Task failed'); } await new Promise(res => setTimeout(res, 2000)); // Wait 2 seconds return pollTask(taskId); // Recursive call}
Step 4: Complete Example Usage
Section titled “Step 4: Complete Example Usage”async function createBusinessPlanPresentation() { try { // Generate the presentation const genTask = await generateBusinessPlanPresentation(); console.log('Presentation generation started:', genTask);
// Poll for completion const presResult = await pollTask(genTask.task_id); console.log('Presentation ready:', presResult.task_result.url);
// Download the presentation await downloadPresentation(presResult.task_result.url, 'business-plan.pptx'); console.log('Download started'); } catch (err) { console.error('Error:', err); }}
async function downloadPresentation(downloadUrl, filename = 'presentation.pptx') { const response = await fetch(downloadUrl); const blob = await response.blob(); const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = filename; document.body.appendChild(a); a.click(); a.remove(); window.URL.revokeObjectURL(url);}
Generated PowerPoint
Section titled “Generated PowerPoint”Download Generated PowerPoint (slide-by-slide-generated-presentation.pptx)
Layout Combinations Explained
Section titled “Layout Combinations Explained”This example demonstrates how different layouts work together:
- Comparison Layout: Perfect for showing market analysis with two contrasting viewpoints
- Items Layout: Ideal for listing key success factors with clear bullet points
- Big Number Layout: Great for highlighting important financial metrics
- Timeline Layout: Excellent for showing project phases and milestones
- SWOT Layout: Perfect for comprehensive risk and opportunity analysis
Best Practices
Section titled “Best Practices”- Layout Matching: Ensure your content matches the layout’s item requirements (e.g., SWOT needs exactly 4 items)
- Flow Logic: Order slides to create a logical narrative flow
- Content Length: Provide enough detail for each slide while keeping it concise
- Template Consistency: Use branded templates for professional, on-brand presentations
- All API requests require your
X-API-Key
header. - The process is asynchronous: always poll the
task_id
for status. - Each layout has specific item count requirements - check the Layouts documentation for details.
- Use branded templates for consistent, professional styling across all slides.
For more details, see the API Reference and Layouts.