2023-03-09 09:13:15 -08:00
|
|
|
import {
|
|
|
|
IDataObject,
|
|
|
|
IWebhookFunctions,
|
|
|
|
INodeTypeDescription,
|
|
|
|
INodeType,
|
|
|
|
IWebhookResponseData,
|
|
|
|
} from 'n8n-workflow';
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
export class ClassNameReplace implements INodeType {
|
|
|
|
description: INodeTypeDescription = {
|
|
|
|
displayName: 'DisplayNameReplace',
|
|
|
|
name: 'N8nNameReplace',
|
|
|
|
group: ['trigger'],
|
|
|
|
version: 1,
|
|
|
|
description: 'NodeDescriptionReplace',
|
|
|
|
defaults: {
|
|
|
|
name: 'DisplayNameReplace',
|
|
|
|
color: '#885577',
|
|
|
|
},
|
|
|
|
inputs: [],
|
|
|
|
outputs: ['main'],
|
|
|
|
webhooks: [
|
|
|
|
{
|
|
|
|
name: 'default',
|
|
|
|
httpMethod: 'POST',
|
2020-06-30 08:59:58 -07:00
|
|
|
responseMode: 'onReceived',
|
2019-06-23 03:35:23 -07:00
|
|
|
// Each webhook property can either be hardcoded
|
|
|
|
// like the above ones or referenced from a parameter
|
|
|
|
// like the "path" property bellow
|
|
|
|
path: '={{$parameter["path"]}}',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
properties: [
|
|
|
|
{
|
|
|
|
displayName: 'Path',
|
|
|
|
name: 'path',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
placeholder: '',
|
|
|
|
required: true,
|
|
|
|
description: 'The path to listen to',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
2019-10-11 04:02:44 -07:00
|
|
|
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
|
2019-06-23 03:35:23 -07:00
|
|
|
// The data to return and so start the workflow with
|
|
|
|
const returnData: IDataObject[] = [];
|
2021-08-29 11:58:11 -07:00
|
|
|
returnData.push({
|
|
|
|
headers: this.getHeaderData(),
|
|
|
|
params: this.getParamsData(),
|
|
|
|
query: this.getQueryData(),
|
|
|
|
body: this.getBodyData(),
|
|
|
|
});
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
return {
|
2021-08-29 11:58:11 -07:00
|
|
|
workflowData: [this.helpers.returnJsonArray(returnData)],
|
2019-06-23 03:35:23 -07:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|