---
title: Rule Engine
tags: ThingsBoard
image:
disqus: hackmd
---
# Rule Engine
:::info
ThingsBoard Rule Engine is a highly customizable and configurable system for complex event processing. With rule engine you are able to ==filter, enrich and transform incoming messages== originated by IoT devices and related assets.
You are also able to ==trigger various actions==, for example, notifications or communication with external systems.
:::
[toc]
## Rule Node Type
### Filter Nodes
Filter nodes are used for message filtering and routing
https://thingsboard.io/docs/user-guide/rule-engine-2-0/filter-nodes/
* check alarm status
* check existence fields
* check relation
* gps geofencing filter
* message type
* message type switch
* originator type
* originator type switch
* script
* switch
### Enrichment Nodes
Enrichment nodes are used to ==update== meta-data of the incoming Message.
https://thingsboard.io/docs/user-guide/rule-engine-2-0/enrichment-nodes/
* calculate delta
* customer attributes
* customer details
* originator attributes
* originator field
* originator telemetry
* related attributes
* related device attributes
* tenant attributes
* tenant details
### Transformation Nodes
Transformation nodes are used for changing incoming Message fields like Originator, Type, Payload, Metadata.
https://thingsboard.io/docs/user-guide/rule-engine-2-0/transformation-nodes/
* change originator
* duplicate to group by group name (PE only)
* duplicate to related (PE only)
* duplicate to specific group (PE only)
* script
* to email
### Action Nodes
Action nodes execute various actions based on incoming Message.
https://thingsboard.io/docs/user-guide/rule-engine-2-0/action-nodes/
* acknowledge
* assign to customer (CE only)
* add to group (PE only)
* change owner (PE only)
* checkpoint
* clear alarm
* copy to review
* create alarm
* create relation
* delay
* delete relation
* device profile
* generate report (PE only)
* generator
* gps geofencing events
* integration downlink (PE only)
* log
* message count
* push to edge
* remove from group (PE only)
* rest call reply (PE only)
* rpc call reply
* rpc call request
* save attributes
* save timeseries
* save to custom table
* synchronization end
* synchronization start
* unassign from customer (CE only)
### Analytics Nodes (PE only)
Analytics nodes perform analysis of streamed or persisted data
* aggregate latest
* aggregate stream
* alarms count
### External Nodes
External nodes are used to interact with external systems.
https://thingsboard.io/docs/user-guide/rule-engine-2-0/external-nodes/
* aws sns
* aws sqs
* azure iot hub
* gcp pubsub
* kafka
* mqtt
* rabbitmq
* rest api call
* send email
* send sms
* twilio sms (PE only)
* twilio voice (PE only)
## Use Case: LINE Notify
* Transformation Node: ==Script==
This node will be used to creating a body of the Telegram message notification.
* External Nodes: ==REST API Call==
This node will send Telegram message payload to the configured REST endpoint. In our case, it is Telegram REST API.