Skip to content

N8N Integration

Complete guide to integrating S5 Slidefactory with N8N workflows.


Overview

S5 Slidefactory integrates with N8N through:

  1. Native N8N Node - n8n-nodes-slidefactory community package
  2. HTTP API - Direct REST API access
  3. Webhook Triggers - Event-driven automation

Use Cases: - Automated presentation generation from CRM data - Scheduled reports and dashboards - Event-triggered presentations - Multi-source data aggregation into slides


Quick Start

Prerequisites

  • N8N instance (cloud, self-hosted, or Docker)
  • S5 Slidefactory instance with API access
  • API credentials

Install Community Node

Via N8N GUI: 1. Open N8N → SettingsCommunity Nodes 2. Click Install a community node 3. Enter: n8n-nodes-slidefactory 4. Click Install and wait for completion 5. Refresh browser

Via Docker:

services:
  n8n:
    image: n8nio/n8n
    command: /bin/sh -c "npm install -g n8n-nodes-slidefactory && n8n start"
    environment:
      - N8N_CUSTOM_EXTENSIONS=/home/node/.n8n/custom

Configure Credentials

  1. In N8N, add new Slidefactory API credentials:
  2. Host: https://slidefactory.yourcompany.com
  3. Email: Your Slidefactory user email
  4. Password: Your password

  5. Test connection


Available Operations

Generate Presentation

Creates a new presentation from template and data.

Parameters: - Template ID: ID of the template to use - Title: Presentation title - Data: JSON object with slide data

Example:

{
  "template_id": 1,
  "title": "Q4 Sales Report",
  "data": {
    "quarter": "Q4 2024",
    "revenue": "$2.5M",
    "growth": "+15%",
    "slides": [
      {
        "type": "title",
        "title": "Q4 Results",
        "subtitle": "Outstanding Performance"
      },
      {
        "type": "chart",
        "title": "Revenue Trend",
        "data": [2.0, 2.2, 2.3, 2.5]
      }
    ]
  }
}

Returns: - process_id: Generation process ID - status: "processing"

Check Status

Checks the status of a presentation generation job.

Parameters: - Process ID: ID returned from generate operation

Returns: - status: "processing", "completed", or "failed" - progress: Percentage (0-100) - download_url: URL when completed

Download Presentation

Downloads the generated presentation file.

Parameters: - Process ID: ID of completed presentation

Returns: - Binary file data (PPTX)

List Templates

Retrieves all available templates.

Returns: - Array of template objects with ID, name, description

Get Template

Retrieves details of a specific template.

Parameters: - Template ID: Template to retrieve

Returns: - Template details including placeholders


Example Workflows

Automated Daily Report

Schedule Trigger (Daily 8am)
Fetch Data (Database/API)
Transform Data (Function Node)
Generate Presentation (Slidefactory)
Wait for Completion (Loop)
Download Presentation
Send via Email/Slack

CRM-Triggered Presentation

Webhook Trigger (Deal Closed)
Get Deal Data (CRM API)
Format for Template (Function)
Generate Presentation
Upload to SharePoint
Notify Team (Teams/Slack)

Multi-Source Dashboard

Schedule Trigger (Weekly)
┌─ Fetch Sales Data
├─ Fetch Marketing Data
└─ Fetch Finance Data
Merge Data (Function Node)
Generate Dashboard
Share Link (Email)

HTTP API Integration

For direct API access without the community node:

Generate Presentation

{% raw %}

// N8N HTTP Request Node
{
  "method": "POST",
  "url": "{{$credentials.slidefactory.host}}/api/presentations/generate",
  "authentication": "predefinedCredentialType",
  "nodeCredentialType": "slidefactoryApi",
  "body": {
    "template_id": 1,
    "data": {...}
  }
}

Check Status

{% raw %}

{
  "method": "GET",
  "url": "{{$credentials.slidefactory.host}}/api/presentations/status/{{$json.process_id}}",
  "authentication": "predefinedCredentialType",
  "nodeCredentialType": "slidefactoryApi"
}

Wait for Completion Loop

// Function Node: Check if completed
if ($json.status === 'completed') {
  return {completed: true, download_url: $json.download_url};
} else if ($json.status === 'failed') {
  throw new Error('Presentation generation failed: ' + $json.error);
} else {
  // Continue waiting
  return {completed: false};
}

Configuration

Environment Variables

Configure N8N integration in S5 Slidefactory:

# N8N API URL
N8N_API_URL=http://n8n:5678/api/v1

# N8N API Key (create in N8N UI → Settings → API)
N8N_API_KEY=your-n8n-api-key

# Timeout for workflow execution
N8N_WORKFLOW_TIMEOUT=300

API Scopes

Required scopes for N8N integration:

[
  "presentations:generate",
  "presentations:read",
  "templates:read"
]

Optional scopes:

[
  "templates:write",    // For template management
  "workflows:execute"   // For triggering workflows
]

Best Practices

Error Handling

Always include error handling in workflows:

// Try-Catch Node
try {
  // Generate presentation
  const result = await generatePresentation(data);
  return result;
} catch (error) {
  // Log error
  console.error('Generation failed:', error);

  // Send notification
  await sendSlackMessage({
    text: `Presentation generation failed: ${error.message}`
  });

  // Re-throw or return error
  throw error;
}

Status Polling

Use exponential backoff for status checking:

// Wait with increasing delays
let delay = 2000; // Start with 2 seconds
let maxAttempts = 30;

for (let i = 0; i < maxAttempts; i++) {
  const status = await checkStatus(processId);

  if (status.completed) {
    return status.download_url;
  }

  await sleep(delay);
  delay = Math.min(delay * 1.5, 30000); // Max 30 seconds
}

throw new Error('Timeout waiting for presentation');

Data Validation

Validate data before sending to API:

// Function Node: Validate data
const required = ['title', 'quarter', 'revenue'];
const missing = required.filter(field => !data[field]);

if (missing.length > 0) {
  throw new Error(`Missing required fields: ${missing.join(', ')}`);
}

// Validate data types
if (typeof data.revenue !== 'number') {
  throw new Error('Revenue must be a number');
}

return data;

Template Management

Cache template list to reduce API calls:

// Function Node: Get or cache templates
const cacheKey = 'slidefactory_templates';
const cacheExpiry = 3600000; // 1 hour

let templates = $context.get(cacheKey);
let cacheTime = $context.get(cacheKey + '_time');

if (!templates || Date.now() - cacheTime > cacheExpiry) {
  // Fetch fresh templates
  templates = await fetchTemplates();
  $context.set(cacheKey, templates);
  $context.set(cacheKey + '_time', Date.now());
}

return templates;

Troubleshooting

Connection Failed

Symptom: Cannot connect to Slidefactory API

Solutions: 1. Verify host URL is correct 2. Check network connectivity 3. Verify API credentials 4. Check Slidefactory logs:

docker-compose logs web | grep -i "api\|auth"

Generation Timeout

Symptom: Presentation generation takes too long

Solutions: 1. Increase N8N_WORKFLOW_TIMEOUT 2. Check template complexity 3. Verify data size is reasonable 4. Check Celery worker:

docker-compose logs worker

Invalid Data Format

Symptom: 422 Validation Error

Solutions: 1. Validate data structure matches template 2. Check required fields are present 3. Verify data types (string, number, array) 4. Review template placeholders 5. Test with minimal data first

Download Fails

Symptom: Cannot download presentation

Solutions: 1. Check presentation status is "completed" 2. Verify download URL is valid 3. Check presigned URL hasn't expired (1 hour default) 4. Generate new share link if expired


Advanced Usage

Dynamic Template Selection

Select template based on data:

// Function Node: Choose template
const templateMap = {
  'sales': 1,
  'marketing': 2,
  'finance': 3
};

const reportType = $json.report_type;
const templateId = templateMap[reportType];

if (!templateId) {
  throw new Error(`Unknown report type: ${reportType}`);
}

return {template_id: templateId, data: $json};

Batch Generation

Generate multiple presentations:

// Split In Batches Node
const reports = $json.reports;

// For each report
for (const report of reports) {
  const result = await generatePresentation({
    template_id: report.template_id,
    data: report.data
  });

  // Wait for completion
  await waitForCompletion(result.process_id);
}

Conditional Logic

Different workflows based on status:

// IF Node: Check status
if ($json.status === 'completed') {
  // Success path: Send to recipients
  return [true, false, false];
} else if ($json.status === 'failed') {
  // Error path: Notify admin
  return [false, true, false];
} else {
  // Retry path: Wait and check again
  return [false, false, true];
}


Community Node Package

The official n8n-nodes-slidefactory package is maintained at: https://github.com/yourorg/n8n-nodes-slidefactory

Example Workflows

See n8n-workflows/ directory in the repository for ready-to-use workflow templates.