n8n node
n8n is a workflow automation platform that lets you connect ThingsBoard to hundreds of other services.
The ThingsBoard n8n Node gives you direct access to your IoT entities, telemetry, and alarms from n8n workflows:
- Manage IoT devices, assets, and customers directly from n8n workflows.
- Access and manipulate telemetry data in real-time with attribute and time-series operations.
- Monitor alarms and create automated responses based on alarm severity and type.
- Navigate entity relationships to understand your IoT infrastructure topology.
- Build AI-powered IoT automation using n8n AI Agents with natural language commands.
Quick start
Section titled “Quick start”Here’s what you can build in 5 minutes — a real-world data pipeline that exports IoT telemetry to cloud storage.
Scenario: Every day at midnight, automatically export the last 24 hours of device telemetry to AWS S3 as JSON files for data warehousing, analytics, or compliance archival.
This is a production-ready pattern for IoT data archival, analytics pipelines, and compliance logging. See Example 2 for the full step-by-step walkthrough.
When to use n8n with ThingsBoard
Section titled “When to use n8n with ThingsBoard”ThingsBoard’s Rule Engine handles IoT-specific automation. When you need to connect to external systems that ThingsBoard doesn’t integrate with natively, n8n fills the gap.
| Pattern | Examples |
|---|---|
| Cloud archival | AWS S3, Google Cloud Storage, Azure Blob |
| Database export | PostgreSQL, Snowflake, ClickHouse |
| Ticketing | Jira, ServiceNow |
| CRM/ERP sync | Salesforce, HubSpot |
| AI chat | Non-technical users querying data via AI agents |
Requirements
Section titled “Requirements”- ThingsBoard instance — self-hosted or ThingsBoard Cloud.
- Authentication credentials — API key or username and password (deprecated) with appropriate permissions. See API Keys for details on generating API keys.
- n8n instance — local installation, Docker-based, or n8n Cloud (the ThingsBoard node is verified and available).
Installation
Section titled “Installation”Make sure n8n is already running. See the official n8n docs if you need to install it first.
Install the ThingsBoard node
Section titled “Install the ThingsBoard node”- Open n8n in your browser.
- Click the three dots (bottom-left) → Settings → Community Nodes.
- Click Install a community node.
- Enter:
@thingsboard/n8n-nodes-thingsboardand click Install. - Refresh your browser.
Configure AI agent support (optional)
Section titled “Configure AI agent support (optional)”Skip this if you are only using the node in regular workflows (not with AI agents).
To let AI agents use ThingsBoard as a tool, add this environment variable before starting n8n:
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true- Docker: Add to your
docker-compose.ymlenvironment section. - npm/local:
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true n8n start
Configure credentials
Section titled “Configure credentials”Connect n8n to your ThingsBoard instance. There are two authentication options:
Option A: API Key
Section titled “Option A: API Key”- Click + (top-left) → Credentials.
- Search for ThingsBoard API Key → Continue.
- Fill in the required fields:
- Base URL: Your instance URL (e.g.,
https://thingsboard.cloud). - Connect using: API Key.
- API Key: Generated from your ThingsBoard instance. See API Keys for details.
- Base URL: Your instance URL (e.g.,
- Click Save.
Option B: Username/Password (Deprecated)
Section titled “Option B: Username/Password (Deprecated)”- Click + (top-left) → Credentials.
- Search for ThingsBoard Username/Password → Continue.
- Fill in the required fields:
- Base URL: Your instance URL (e.g.,
https://thingsboard.cloud). - Connect using: Username/Password.
- Username: Your email.
- Password: Your password.
- Base URL: Your instance URL (e.g.,
- Click Save.
The credentials are encrypted and stored securely by n8n. You can reuse the same credentials across multiple ThingsBoard nodes in different workflows.
Verify installation
Section titled “Verify installation”- Open n8n in your browser.
- Click Create Workflow (top-right).
- Click the + button on the workflow canvas.
- Type “ThingsBoard” in the search field.
- Verify the ThingsBoard node appears with available actions.
If you don’t see the node: verify N8N_COMMUNITY_PACKAGES_ENABLED=true is set, check that npm installation completed without errors, restart n8n, and check logs.
How to use the node
Section titled “How to use the node”Regular workflow node
Section titled “Regular workflow node”Drag the ThingsBoard node onto your canvas and configure the operation (get devices, save telemetry, create alarms, etc.).
Best for: scheduled tasks (daily reports), webhooks (external triggers), multi-step workflows (get device → fetch telemetry → send to Slack).
AI agent tool
Section titled “AI agent tool”Give an AI agent access to ThingsBoard operations. Users ask questions in plain English instead of building workflows.
Best for: non-technical users querying entities/data, support teams troubleshooting.
Requires AI agent configuration.
Common workflow patterns
Section titled “Common workflow patterns”| Pattern | Flow |
|---|---|
| Archive telemetry | Schedule (daily) → Code (calc time range) → Get timeseries → Convert to file → S3/GCS upload |
| Create tickets from alarms | Webhook (alarm) → Check severity → Create Jira/ServiceNow ticket |
| Customer onboarding | CRM webhook (new customer) → Create devices and dashboard → Assign to customer |
| AI-powered queries | Chat → AI Agent → ThingsBoard operations → Natural language response |
Usage examples
Section titled “Usage examples”Example 1: AI agent
Section titled “Example 1: AI agent”Scenario: Ask questions in plain text to check entities, query data, or update configurations.
- Create a new workflow with an AI Agent node. Choose your AI model (Gemini, Anthropic, ChatGPT, etc.) and configure memory settings.
- Select ThingsBoard from the Tools list. Add Get devices and Get timeseries operations.
- For tools with required fields, the AI model determines parameter values from conversation context automatically.
- Open the chat interface and write your natural language query.
How it works:
- User asks: “Which freezers in the warehouse are showing temperatures above -10°C?”
- AI Agent automatically calls
Get devicesto find freezer devices, thenGet timeseriesfor temperature readings, filters results, and responds in plain language. - No code or API knowledge needed.
Example queries:
- “Show me all devices that haven’t sent data in the last 24 hours”
- “What’s the current temperature of Freezer 3?”
- “Which sensors are in Building A?”
- “Get me the last week of humidity data for all warehouse sensors”
Example 2: Daily telemetry export to AWS S3
Section titled “Example 2: Daily telemetry export to AWS S3”Scenario: Every night, export device telemetry to S3 for data warehousing, enriched with metadata and ready for analytics tools.
Why use n8n instead of ThingsBoard’s native export:
- Multi-destination — same data to S3 + Snowflake + email report in one workflow.
- Data transformation — enrich telemetry with business context (customer names, locations from CRM).
- Custom formats — convert to Parquet, Avro, or CSV with specific schemas.
- Integration chains — after S3 upload, trigger AWS Lambda, update tracking database, send Slack notification.
Building the workflow
Section titled “Building the workflow”Step 1: Add Schedule Trigger
Click Add first step → Schedule Trigger. Set trigger to run every day at 00:00 (midnight UTC).
Step 2: Add Code node for time range
ThingsBoard’s API requires timestamps in milliseconds. Add a Code node:
const DAY_MS = 24 * 60 * 60 * 1000;const endTsMs = new Date($input.first().json.timestamp).getTime();const startTsMs = endTsMs - DAY_MS;return [{ startTsMs, endTsMs }];Step 3: Get device by name
Click + → ThingsBoard → Get a device by name. Enter your device name (e.g., “Temperature Sensor 1”).
Step 4: Get timeseries data
Click + → ThingsBoard → Get timeseries. Drag values from the INPUT panel:
- Entity ID and Entity Type: From “Get a device by name” output.
- Start/End timestamps: From the Code node output.
- Keys: Telemetry keys you want (e.g., “temperature,humidity”).
Step 5: Upload to AWS S3
Click + → AWS S3. Configure: Operation = Upload, Bucket Name, File Name with datestamp expression (e.g., telemetry-{{ $now.format('yyyy-MM-dd') }}.json), and AWS credentials.
Result: A complete automated pipeline that runs every night, fetches 24 hours of telemetry, and uploads to S3 with predictable naming (telemetry-2024-12-23.json).
Example 3: Webhook-triggered device query
Section titled “Example 3: Webhook-triggered device query”Scenario: A customer portal has a “Get Device Status” button. When clicked, it fetches real-time telemetry for any device — no hardcoded IDs.
This pattern enables: customer portals (each user sees their own devices), chatbots (“check temperature in Room 405”), mobile apps (query any device by name).
Building the workflow
Section titled “Building the workflow”Step 1: Set up the trigger
Use a manual trigger to simulate a webhook. Click Add first step → Trigger manually, then configure with test JSON:
{ "deviceName": "Refrigerator"}Step 2: Find the device
Click + → ThingsBoard → Get device by name. Drag deviceName from the INPUT panel into the Name field — this creates a dynamic link.
Step 3: Discover telemetry keys
Click + → ThingsBoard → Get timeseries keys. Drag Entity ID and Entity Type from the INPUT panel.
Step 4: Fetch telemetry data
Click + → ThingsBoard → Get timeseries. Configure:
- Entity ID and Entity Type from Step 2.
- Keys from Step 3 — join as comma-separated:
{{ $json.timeseriesKeys.join(',') }}.
Result: A completely reusable workflow. Change the input from “Refrigerator” to “Freezer 3” and it works automatically — no hardcoded IDs, no changes needed.
Next steps: Replace the manual trigger with a Webhook to connect your customer portal, add Slack or Email output, use a Schedule trigger for monitoring, or connect to an AI Agent for chat-based queries.
- npm package: @thingsboard/n8n-nodes-thingsboard
- GitHub: thingsboard/thingsboard-n8n-node
- n8n docs: docs.n8n.io
- ThingsBoard REST API: REST API Reference