I’m working on a custom n8n node for my service. I want to build it like the AWS S3 node where you have one main node with different operations you can pick from a dropdown.
Right now when I search for my service in the node panel, I see two separate action nodes (login and file transfer). But I want them to be operations under one single node.
I’ve tried making separate node files (login.node.ts and transfer.node.ts) and adding both to package.json, but this just creates two independent nodes which isn’t what I’m looking for.
My current package.json setup:
"nodes": {
"main": [
"dist/nodes/main/login.node.js",
"dist/nodes/main/transfer.node.js"
]
}
Here’s my node implementation:
export class MyService implements INodeType {
description: INodeTypeDescription = {
displayName: 'MyService',
name: 'MyService',
icon: 'file:MyService.png',
group: ['input'],
version: 1,
description: 'Connect and manage files with MyService',
defaults: {
name: 'MyService',
color: '#FF6B6B',
},
inputs: ['main'],
outputs: ['main'],
properties: [
{
displayName: 'Action',
name: 'action',
type: 'options',
options: [
{
displayName: 'Login',
name: 'login',
value: 'login',
description: 'Connect to your account',
},
{
displayName: 'Transfer File',
name: 'transfer',
value: 'transfer',
description: 'Send a document to MyService',
},
],
default: 'login',
description: 'Choose what to do',
},
{
displayName: 'Email',
name: 'email',
type: 'string',
default: '',
displayOptions: {
show: {
action: ['login'],
},
},
description: 'Your account email',
required: true,
},
{
displayName: 'API Key',
name: 'apiKey',
type: 'string',
typeOptions: {
password: true,
},
displayOptions: {
show: {
action: ['login'],
},
},
default: '',
description: 'Your API key for access',
required: true,
},
{
displayName: 'Document Path',
name: 'docPath',
type: 'string',
displayOptions: {
show: {
action: ['transfer'],
},
},
default: '',
description: 'Path to the document file',
}
],
};
}
How do I structure this properly so I get one node with selectable actions rather than multiple separate nodes?