Flows & HTTP Connectors
Automatically forward messages to external systems via webhooks when entities send data.
How It Works
- Entity sends message with tags
- System finds connectors with matching tags
- HTTP requests are sent to your webhooks
- You receive the data in your external system
Note: Each connector is triggered only once per message, even if it matches multiple tags (e.g., both original message tags and validation failure tags).
Quick Start
Creating a connector in the UI.
You can also define connectors using JSON, as shown below:
1. Create a Connector
{
"name": "n8n_webhook",
"type": "http",
"tags": ["automation"],
"config": {
"url": "https://your-n8n.com/webhook/abc123",
"method": "POST",
"headers": {
"Content-Type": "application/json"
}
}
}
2. Send a Message
When an entity sends a message with the alerts tag, your webhook will receive:
{
"data": {
"temperature": 25.5,
"location": "building-a"
},
"context": {
"tags": ["alerts"]
},
"msgType": "publish",
"source": "123:us-1:entity:sensor_01",
"timestamp": "2024-01-15T10:30:00Z"
}
Service Validation Failures
When an entity has a service assigned and sends data that fails validation, the system automatically adds validation failure tags to the message. This triggers any connectors with matching tags.
Example: Temperature Sensor Validation
Service Configuration:
{
"name": "temperature_sensor_service",
"dynamicActions": [
{
"name": "temp-publish",
"tags": ["validation_failure", "data_quality"],
"rules": [
{
"field": "temperature",
"operator": "between",
"value": [-50, 150],
"message": "Temperature out of range"
}
]
}
]
}
Entity with Service:
{
"name": "sensor_01",
"service": "temperature_sensor_service"
}
Failed Message:
When the sensor sends {"temperature": 200} (exceeds 150°C limit), the validation fails but the message continues processing with validation failure tags.
Connector Triggered:
{
"name": "validation_alert",
"type": "http",
"tags": ["validation_failure"],
"config": {
"url": "https://alerts.example.com/webhook",
"method": "POST",
"headers": {
"Content-Type": "application/json"
}
}
}
What Your Webhook Receives:
{
"data": {
"temperature": 200
},
"context": {
"tags": ["validation_failure", "data_quality"]
},
"msgType": "publish",
"source": "123:us-1:entity:sensor_01",
"timestamp": "2024-01-15T10:30:00Z",
"actionResult": {
"name": "temp-publish",
"valid": false,
"message": "Temperature out of range",
"tags": ["validation_failure", "data_quality"],
"field": "temperature",
"actual": 200,
"expected": { "between": [-50, 150] }
}
}
Validation Failure Output Format
When a validation rule fails, the actionResult includes:
field: The field that failedactual: The value that was providedexpected: A JSON object describing the rule, e.g.{ "between": [0, 100] }
Example:
{
"field": "temperature",
"actual": 150,
"expected": { "between": [0, 100] }
}