Skip to main content

Node Structure

Understanding the structure of an n8n node is essential for building robust integrations. This guide covers the INodeType interface and all its components in detail.

INodeType Interface

Every node implements the INodeType interface. Here’s the complete structure:

Node Description

The description property defines all node metadata and UI configuration:

Description Properties

Execute Function

For programmatic nodes, the execute() function contains your custom logic:

Key Execute Context Methods

Poll Function (Polling Triggers)

Polling triggers implement the poll() function:
State Management: Use this.getWorkflowStaticData('node') to persist state between poll intervals. This ensures you only fetch new items.

Methods Object

The methods object provides dynamic functionality:

Webhook Functions

Webhook triggers handle incoming HTTP requests:

Real-World Example: Gmail Trigger

Here’s how the Gmail Trigger node implements polling:

Error Handling Best Practices

Always handle errors appropriately in your nodes.

Next Steps

Credentials

Learn how to implement authentication

Testing

Write comprehensive tests for your nodes