import type {
ITriggerFunctions,
INodeType,
INodeTypeDescription,
ITriggerResponse,
} from 'n8n-workflow';
import { NodeConnectionType } from 'n8n-workflow';
export class ManualTrigger implements INodeType {
description: INodeTypeDescription = {
displayName: 'Manual Trigger',
name: 'manualTrigger',
icon: 'fa:mouse-pointer',
group: ['trigger'],
version: 1,
description: 'Runs the flow on clicking a button in n8n',
eventTriggerDescription: '',
maxNodes: 1,
defaults: {
name: 'When clicking ‘Test workflow’',
color: '#909298',
},
inputs: [],
outputs: [NodeConnectionType.Main],
properties: [
{
displayName:
'This node is where the workflow execution starts (when you click the ‘test’ button on the canvas).
Explore other ways to trigger your workflow (e.g on a schedule, or a webhook)',
name: 'notice',
type: 'notice',
default: '',
},
],
};
async trigger(this: ITriggerFunctions): Promise {
const manualTriggerFunction = async () => {
this.emit([this.helpers.returnJsonArray([{}])]);
};
return {
manualTriggerFunction,
};
}
}