I am trying to creating a custom node for n8n
. I've successfully built the node, but when I check the n8n
local instance on my website, I don't see my custom node listed. Could anyone please help me troubleshoot this issue.
import { INodeType, INodeTypeDescription } from 'n8n-workflow';
export class Assistant implements INodeType {
description: INodeTypeDescription = {
// Basic node details will go here
displayName: 'Assistant test',
name: 'assistantTest',
icon: 'file:test.svg',
group: ['transform'],
version: 1,
description: 'Send a message to Assistant',
defaults: {
name: 'Assistant test',
},
inputs: ['main'],
outputs: ['main'],
credentials: [
{
name: 'assistantApi',
required: true,
}
],
requestDefaults: {
baseURL: 'API',
headers: {
// headers
}
},
properties: [
{
displayName: 'Message',
name: 'message',
type: 'string',
placeholder: 'Enter a message',
required: true,
description: 'Enter a message',
routing: {
request: {
method: 'GET',
url: 'API'
// qs: {
// q: '{{$value}}'
// },
},
},
default: 'get',
},
]
};
}
this is my assistant.node.ts file.
{
"node": "n8n-nodes-test.Assistant",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Miscellaneous"],
"resources": {
"credentialDocumentation": [],
"primaryDocumentation": []
}
}
this is assistant.node.json file
import {
IAuthenticateGeneric,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class AssistantApi implements ICredentialType {
name = 'AssistantApi';
displayName = 'Assistant API';
// Uses the link to this tutorial as an example
// Replace with your own docs links when building your own nodes
documentationUrl = '/';
properties: INodeProperties[] = [
{
displayName: 'API Key',
name: 'apiKey',
type: 'string',
default: '',
},
];
authenticate = {
type: 'generic',
properties: {
qs: {
'x-access-token': '={{$credentials.apiKey}}'
}
},
} as IAuthenticateGeneric;
}
this is assistant.credentials.ts file
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742296887a4417304.html
评论列表(0条)