diff --git a/archive/create-n8n-nodes-module.md b/archive/create-n8n-nodes-module.md index e666182dc..59fd29a40 100644 --- a/archive/create-n8n-nodes-module.md +++ b/archive/create-n8n-nodes-module.md @@ -57,20 +57,17 @@ After the repo gets cloned, open the package.json file, and update the value of Open the cloned repository in your code editor, and create a new folder called `Weather`, inside the ***nodes*** folder. Create `Weather.node.ts` file inside the Weather folder and paste the following code: ```ts -import { - IExecuteFunctions, -} from 'n8n-core'; import { IDataObject, + IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription, + IRequestOptions, NodeApiError, NodeOperationError, } from 'n8n-workflow'; -import { OptionsWithUri } from 'request'; - export class Weather implements INodeType { description: INodeTypeDescription = { displayName: 'Weather', @@ -328,7 +325,7 @@ export class Weather implements INodeType { throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); } - const options: OptionsWithUri = { + const options: IRequestOptions = { method: 'GET', qs, uri: `https://api.openweathermap.org/data/2.5/${endpoint}`, @@ -487,11 +484,11 @@ If you're running n8n via Docker, you will have to create a Docker image with th 4. Build your Docker image: ```Dockerfile - # Replace with the n8n release version number. + # Replace with the n8n release version number. # For example, N8N_VERSION=0.177.0 docker build --build-arg N8N_VERSION= --tag=customizedn8n . ``` You can now use your n8n-nodes-module in Docker. -If you're running either by installing it globally or using PM2, make sure that you install your n8n-nodes-module inside n8n. n8n will find the module and load it automatically. \ No newline at end of file +If you're running either by installing it globally or using PM2, make sure that you install your n8n-nodes-module inside n8n. n8n will find the module and load it automatically. diff --git a/archive/create-trigger-node.md b/archive/create-trigger-node.md index 6bd39482c..34010d005 100644 --- a/archive/create-trigger-node.md +++ b/archive/create-trigger-node.md @@ -46,15 +46,12 @@ Since n8n's repository already has a Autopilot Trigger node, we will name this n 5. Paste the following code in the `AutofriendTrigger.node.ts` file. ```typescript -import { - IHookFunctions, - IWebhookFunctions, -} from 'n8n-core'; - import { IDataObject, + IHookFunctions, INodeType, INodeTypeDescription, + IWebhookFunctions, IWebhookResponseData, } from 'n8n-workflow'; @@ -335,18 +332,12 @@ Let's see how this would look for our current use-case: 1. Go to `packages/nodes-base/nodes/Autofriend`, create a file named `GenericFunctions.ts`, and paste the following code. ```typescript -import { - OptionsWithUri, -} from 'request'; - -import { - IExecuteFunctions, - ILoadOptionsFunctions, -} from 'n8n-core'; - import { IDataObject, + IExecuteFunctions, IHookFunctions, + ILoadOptionsFunctions, + IRequestOptions, IWebhookFunctions, } from 'n8n-workflow'; @@ -358,7 +349,7 @@ export async function autofriendApiRequest(this: IExecuteFunctions | IWebhookFun const endpoint = 'https://api2.autopilothq.com/v1'; - const options: OptionsWithUri = { + const options: IRequestOptions = { headers: { 'Content-Type': 'application/json', autopilotapikey: apiKey, diff --git a/docs/integrations/creating-nodes/plan/choose-node-method.md b/docs/integrations/creating-nodes/plan/choose-node-method.md index f03700355..ae416fbe9 100644 --- a/docs/integrations/creating-nodes/plan/choose-node-method.md +++ b/docs/integrations/creating-nodes/plan/choose-node-method.md @@ -5,7 +5,7 @@ contentType: explanation # Choose your node building approach -n8n has two node-building styles, declarative and programmatic. +n8n has two node-building styles, declarative and programmatic. You should use the declarative style for most nodes. This style: @@ -31,8 +31,13 @@ To understand the difference between the declarative and programmatic styles, co In programmatic style: ```js -import { IExecuteFunctions } from 'n8n-core'; -import { INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow'; +import { + IExecuteFunctions, + INodeExecutionData, + INodeType, + INodeTypeDescription, + IRequestOptions, +} from 'n8n-workflow'; // Create the FriendGrid class export class FriendGrid implements INodeType { @@ -98,7 +103,7 @@ export class FriendGrid implements INodeType { Object.assign(data, additionalFields); // Make HTTP request as defined in https://sendgrid.com/docs/api-reference/ - const options: OptionsWithUri = { + const options: IRequestOptions = { headers: { 'Accept': 'application/json', 'Authorization': `Bearer ${credentials.apiKey}`, @@ -158,7 +163,7 @@ export class FriendGrid implements INodeType { value: 'create', description: 'Create a contact', // Add the routing object - routing: { + routing: { request: { method: 'POST', url: '=/contacts',