Package Information
Documentation
n8n-nodes-surna-elearning
Official n8n community node for the Surna eLearning Platform. Create and manage eLearning courses through visual workflows and AI-powered automation.
Features
⨠Two Integration Approaches:
- Surna Node: Full-featured node for manual workflow building with visual configuration
- Surna AI Tools: Tools for AI Agent nodes to enable autonomous course creation
š Key Capabilities:
- Create, update, and manage courses, lessons, and content blocks
- Support for 18 block types (text, images, videos, quizzes, interactive elements)
- Batch operations for efficient multi-item creation (3+ items recommended)
- Multi-language course version management
- AI image generation and asset management
- Import/export courses as portable JSON
- Progressive tool discovery with
search_tools
ā” Performance Optimized:
- Batch operations reduce API calls by 60-90%
- Atomic transactions ensure data consistency
- Efficient tool discovery without loading all definitions
Installation
Method 1: Via n8n Community Nodes (Recommended)
- Open your n8n instance
- Go to Settings ā Community Nodes
- Click Install a community node
- Enter:
n8n-nodes-surna-elearning - Click Install
Method 2: Via npm (Manual)
# In your n8n installation directory
npm install n8n-nodes-surna-elearning
# Restart n8n
Method 3: From Source (Development)
# Clone the repository
git clone https://github.com/discoverelearning/n8n-nodes-surna-elearning.git
cd n8n-nodes-surna-elearning
# Install dependencies and build
npm install
npm run build
# Link to your n8n installation
cd /path/to/n8n/installation
npm link /path/to/n8n-nodes-surna-elearning
# Restart n8n
Setup
1. Get Your Surna API Key
- Log in to your Surna account
- Go to Settings ā API Keys
- Click Generate New API Key
- Copy the API key (you won't be able to see it again!)
2. Configure Credentials in n8n
- In your n8n workflow, add a Surna or Surna AI Tools node
- Click Create New Credentials
- Enter:
- API Key: Your Surna API key
- API URL:
https://app.surna.io/api(default for production)
- Click Save
Usage
Using the Surna Node (Visual Workflows)
The Surna node provides a visual interface for all operations:
Example 1: Create a Simple Course
[Manual Trigger]
ā
[Surna Node]
Resource: Course
Operation: Create
Title: "Employee Onboarding"
Description: "Welcome to the team!"
ā
[Surna Node]
Resource: Lesson
Operation: Create
Course ID: {{$node["Surna"].json.id}}
Title: "Day 1: Introduction"
ā
[Surna Node]
Resource: Block
Operation: Create
Lesson ID: {{$node["Surna1"].json.id}}
Type: paragraph
Content: {"text": "Welcome to your first day!"}
Example 2: Batch Create Multiple Lessons
[HTTP Request]
Fetch course outline from external API
ā
[Code Node]
Transform outline into lessons array:
[
{"title": "Introduction"},
{"title": "Getting Started"},
{"title": "Best Practices"}
]
ā
[Surna Node]
Resource: Lesson
Operation: Batch Create
Course ID: {{$parameter.courseId}}
Lessons: {{$json.lessons}}
Example 3: Generate AI Image and Use in Course
[Manual Trigger]
ā
[Surna Node]
Resource: Asset
Operation: Generate AI Image
Prompt: "A friendly robot teaching in a modern classroom"
ā
[Surna Node]
Resource: Block
Operation: Create
Lesson ID: {{$parameter.lessonId}}
Type: imageCentered
Content: {"assetId": "{{$node["Surna"].json.id}}"}
Using Surna AI Tools (AI Agent Workflows)
Surna AI Tools enable autonomous course creation with AI agents:
Example 1: AI-Powered Course Generator
[Webhook Trigger]
Receives: {"topic": "Fire Safety", "targetAudience": "office workers"}
ā
[AI Agent Node]
Tools:
- Surna AI Tools (select: search_tools, create_course,
batch_create_lessons, batch_create_blocks)
Model: Claude 3.5 Sonnet
Prompt: "Create a comprehensive fire safety training course
with 5 lessons covering prevention, detection, response,
equipment, and compliance. Include text content, headings,
and dividers."
ā
[Code Node]
Extract and format course ID from agent response
ā
[Surna Node]
Resource: Course
Operation: Export
Course ID: {{$json.courseId}}
ā
[Send Email]
Attachment: Course export JSON
Example 2: Content Repurposing Pipeline
[Google Drive Trigger]
Watches: /Training Materials folder
ā
[Extract Text Node]
Extract text from PDF/DOCX
ā
[OpenAI Node]
Model: GPT-4
Prompt: "Analyze this document and create a structured
course outline with lesson titles and key topics"
ā
[AI Agent Node]
Tools: Surna AI Tools
Context: {{$node["OpenAI"].json.outline}}
Task: "Create a Surna course based on this outline.
Use batch operations for efficiency. Add appropriate
headings, paragraphs, and dividers."
ā
[Slack Notification]
Message: "ā
New course created: {{$json.courseTitle}}"
Example 3: Multi-Language Course Creation
[HTTP Request]
Get master course content
ā
[Surna Node]
Resource: Course
Operation: Create
(Creates English version)
ā
[Loop Node]
Items: ['fr', 'es', 'de', 'ja']
ā
[Surna Node]
Resource: Language
Operation: Create Version
Language: {{$item}}
ā
[OpenAI Node]
Translate course content to {{$item}}
ā
[AI Agent Node]
Tools: Surna AI Tools (batch_update_blocks)
Task: "Update all blocks in this language version
with the translated content"
Available Operations
Course Operations
- Create: Create a new course
- Get: Retrieve course details
- Get All: List all courses
- Update: Update course properties
- Delete: Delete a course
- Duplicate: Duplicate course with all content
- Export: Export course to JSON
- Import: Import course from JSON
- Reorder Lessons: Change lesson order
Lesson Operations
- Create: Create a new lesson
- Batch Create: Create multiple lessons efficiently (3+)
- Get: Retrieve lesson details
- Get All: List all lessons in a course
- Update: Update lesson properties
- Delete: Delete a lesson
- Duplicate: Duplicate lesson
- Reorder Blocks: Change block order
Block Operations
- Create: Create a new content block
- Batch Create: Create multiple blocks efficiently (3+)
- Batch Update: Update multiple blocks efficiently (3+)
- Get: Retrieve block details
- Get All: List all blocks in a lesson
- Update: Update block content
- Delete: Delete a block
- Duplicate: Duplicate block
- Move Up: Move block up in order
- Move Down: Move block down in order
Asset Operations
- Get: Retrieve asset details
- Get All: List all assets
- Create From URL: Import image from URL
- Generate AI Image: Generate image from text prompt
- Update Metadata: Update caption and alt text
- Delete: Delete an asset
Language Operations
- Create Version: Create new language version
- Get All Versions: List all language versions
- Update Metadata: Update translated metadata
- Delete Version: Delete a language version
Block Types
Surna supports 18 content block types:
Text Blocks:
paragraph- Plain text paragraphheading- Large heading textheadingParagraph- Heading with paragraph combolist- Bulleted or numbered list
Image Blocks:
imageCentered- Centered image with max-widthimageFullWidth- Edge-to-edge imageimageSideBySide- Two images side by sideimageTextOverlay- Image with text overlay
Interactive Blocks:
videoEmbed- Embedded video playertabs- Tabbed content sectionsaccordion- Collapsible contentflipCards- Interactive flip cardscardSort- Drag-and-drop card sorting
Assessment Blocks:
singleChoice- Single-answer quizmultipleChoice- Multiple-answer quizfillInBlank- Text input question
Other Blocks:
dividerLine- Visual dividercustomButton- Call-to-action button
Batch Operations
For creating or updating 3+ items, use batch operations for better performance:
Batch Create Lessons
{
"courseId": "course_123",
"lessons": [
{"title": "Introduction"},
{"title": "Getting Started"},
{"title": "Best Practices"}
]
}
Batch Create Blocks
{
"lessonId": "lesson_456",
"blocks": [
{"type": "heading", "text": "Welcome"},
{"type": "paragraph", "text": "This is lesson 1."},
{"type": "dividerLine", "height": 2, "color": "#e5e7eb"}
]
}
Batch Update Blocks
{
"updates": [
{"blockId": "block_1", "updates": {"text": "Updated content"}},
{"blockId": "block_2", "updates": {"paddingTop": 32}}
]
}
AI Tool Discovery
The search_tools tool enables progressive tool discovery:
// In AI Agent workflows
"Use search_tools to find tools for creating lessons"
// Returns relevant tools without loading all definitions
{
"tools": [
{"name": "create_lesson", "description": "Add a lesson to a course"},
{"name": "batch_create_lessons", "description": "Create multiple lessons efficiently"}
]
}
Categories:
courses- Course management toolslessons- Lesson operationsblocks- Content block operationsbatch- Batch operationsassets- Image and media toolslanguages- Multi-language support
Best Practices
1. Use Batch Operations for Multiple Items
ā DON'T: Loop over 5 lessons and create individually (5 API calls)
ā
DO: Use batch_create_lessons once (1 API call)
2. Include search_tools in AI Agent Tools
Enable the agent to discover tools dynamically without
loading all tool definitions upfront
3. Set Proper Alt Text for Images
Always provide descriptive alt text for accessibility
4. Validate Block Types
Ensure block type matches available types (18 total)
5. Use Export/Import for Backups
Export courses before major changes
Store exports for version control
Troubleshooting
Error: "Invalid API Key"
- Verify API key is correct in n8n credentials
- Check API URL is
https://app.surna.io/api - Ensure API key hasn't been revoked
Error: "Block type not supported"
- Check block type spelling (case-sensitive)
- Verify type is one of the 18 supported types
- See Block Types section
Batch Operation Fails
- Ensure array is properly formatted JSON
- Validate all required fields are present
- Check for typos in field names
AI Agent Not Creating Content
- Verify Surna AI Tools node is connected
- Check correct tools are selected
- Review agent prompt clarity
- Enable "search_tools" for tool discovery
Development
Building from Source
# Install dependencies
npm install
# Build TypeScript
npm run build
# Run linter
npm run lint
# Fix lint issues
npm run lintfix
# Format code
npm run format
Project Structure
n8n-nodes-surna-elearning/
āāā credentials/
ā āāā SurnaApi.credentials.ts # API credentials
āāā nodes/
ā āāā Surna/
ā ā āāā Surna.node.ts # Main node
ā ā āāā descriptions/ # UI field definitions
ā ā āāā operations/ # Operation implementations
ā āāā SurnaAiTool/
ā āāā SurnaAiTool.tool.ts # AI Agent tool
ā āāā tool-definitions.ts # Tool schemas
āāā utils/
ā āāā SurnaApiClient.ts # API client
āāā package.json
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Support
- Documentation: https://surna.io/docs
- Issues: GitHub Issues
- Email: support@surna.io
- n8n Community: n8n Forum
License
MIT License - see LICENSE file for details
Credits
Built with ā¤ļø by the Surna team for the n8n community.
Ready to automate your eLearning content creation? š
Install the node, connect your API key, and start building intelligent course generation workflows today!