Creating Your First Node: Complete Beginner's Guide
1. Node Interface
1.1 Inputs
Configure here:
- Data the node accepts
- Input parameter types
1.2 Design
Settings for:
- Node name (title)
- Version
- Inputs
- Outputs
Example:
version: 1
title: en=Translate text
//...
inputs:
source:
order: 1
title: en=Source language
type: string
required: true
default: auto
outputs:
text:
title: en=Text
type: string
alternatives:
title: en=Alternatives
type: string[]
detectedLanguage:
title: en=Detected language
type: json
schema: detected-languages
1.3 Script
Write JavaScript code that:
- Processes input data
- Interacts with external APIs
- Returns results
Example:
script: |
const CHECK_TASK_INTERVAL = 3000;
const MAX_ATTEMPTS = 10;
export async function run({ inputs, state }) {
const { FatalError, TimeoutError, RepeatNode, NextNode } = DEFINITIONS;
const { ArtWorks, FatalError: ArtWorksError } = require('artworks');
1.4 Environment
Configure:
- API keys
- External service URLs
- Configuration parameters
Example:
environment:
API_KEY:
title: "Access Key"
type: string
scope: global
1.5 YAML
Full access to all node parameters in YAML format.
2. Complete YAML Structure
# Block 1: Metadata (Design)
version: 1
title: en="My Node";ru="Моя нода"
category:
_id: custom
title: "Custom Nodes"
# Block 2: Inputs
inputs:
image_input:
type: image
title: "Image"
required: true
order: 1
# Block 3: Outputs
outputs:
result_image:
type: image
title: "Result"
# Block 4: Environment
environment:
API_ENDPOINT:
title: "API Server"
type: string
scope: global
# Block 5: Execution (Design)
execution: regular # rapid/regular/deferred/protracted
# Block 6: Script
script: |
export async function run({ inputs }) {
// Processing logic
return {
result_image: processedImage
}
}
4. Frequently Asked Questions
Q: How to add a dropdown?
inputs:
gender:
type: string
enum: ["male", "female", "other"]
default: "male"
Q: How to make multiline text?
inputs:
bio:
type: string
multiline: true
placeholder: "Tell about yourself"
Q: Where to set execution time?
In Design → Execution Timeout select:
- Rapid (fast operations)
- Protracted (long requests)
5. Developer Tips
- Always test nodes before deployment
- Use
console.log()
for debugging - Start with simple nodes, gradually increase complexity
- Break complex logic into multiple nodes
More examples available in [Template Library]
IN WORK