Stand with Ukraine flag
Pricing Try it now
Community Edition
Getting Started Documentation Guides Installation Architecture API FAQ
On this page

Send email on alarm

This guide explains how to configure ThingsBoard to automatically send email notifications to users when an alarm is created.
It extends the Create and Clear Alarms use case by using the Notification Center to deliver alarm-based email notifications.


Use case

Assume your refrigeration equipment periodically reports temperature telemetry to ThingsBoard.

  • Normal operating temperature range: 2 °C to 5 °C
  • Any value outside this range is considered an abnormal condition.

When such a condition occurs:

  • An alarm is created by the alarm rules.
  • An email notification is sent to the responsible users.

This setup ensures timely awareness and faster response to critical equipment issues.


Prerequisites

Before proceeding, make sure that you have completed the following steps:

  1. Completed the Create and Clear Alarms tutorial and already configured alarm creation and clearing rules.
  2. Added at least one Customer User who will receive alarm notifications.
  3. Configured a mail server, which is required for delivering email notifications.

It is also recommended to review the following ThingsBoard documentation:

These concepts are essential for understanding and correctly configuring the solution described below.


Configure Notification Center

The Notification Center is responsible for delivering notifications to users.

It consists of three core components:

  • Recipients – define who will receive notifications.
  • Templates – define the notification content and delivery method.
  • Rules – define the conditions under which notifications are sent.

All three components must be configured to enable alarm-based notifications.


Step 1: Configure notification recipients

The Recipients section defines the target users who will receive notifications.

  1. Navigate to Notification Center ⇾ Recipients.
  2. Click + Add recipient.
  3. Configure the recipient group:
     • Name: Refrigeration operators
     • Type: Platform users
     • User filter: Customer users
     • Customer: Customer A (specify your customer)
  4. Click Add.

Customer A represents all customer users responsible for monitoring the refrigeration equipment.


Step 2: Create notification template

Templates define the notification content and delivery method.

  1. Navigate to Notification Center ⇾ Templates.
  2. Click + Add template.
  3. Configure general settings:
     • Name: Device temperature notification
     • Type: Alarm
     • Delivery methods: Email
  4. Click Next.
  5. Define the email content:
     • Subject
    1
    
    ${alarmType} on ${alarmOriginatorName} device
    

     • Message

    1
    
    A ${alarmType} has been detected on the ${alarmOriginatorName} device: ${details.data} °C.
    

    Template variables:
     • ${alarmOriginatorName} – name of the device that triggered the alarm.
     • ${details.data} – alarm details populated by the alarm rule.

  6. Click Add to save the template.

Step 3: Create notification rule

Notification rules define when notifications are sent and which components are used.

  1. Navigate to Notification Center ⇾ Rules.
  2. Click + Add rule.
  3. Configure rule parameters:
     • Rule name: Unacceptable device temperature
     • Trigger: Alarm
     • Template: Device temperature notification
     • Recipients: Refrigeration operators
  4. Click Next.
  5. Configure trigger conditions:
     • Alarm type list: Any type
     • Alarm severity list: Any severity
     • Notify on: Alarm created
  6. Click Add.

This rule ensures that an email is sent only when a new alarm is created.


Verification

To verify the configuration, publish telemetry that exceeds the defined temperature threshold.

Publish test telemetry
Example: publish a temperature value of 7 °C, which should trigger a high temperature alarm.

1
curl -v -X POST http://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/telemetry --header Content-Type:application/json --data "{temperature:7}"

⚠️ Replace
 • $THINGSBOARD_HOST_NAME with your ThingsBoard hostname or IP address.
 • $ACCESS_TOKEN with the device access token.

Expected result

  • A new alarm is created for the device.
  • The email notification is sent to all users of Customer A.
  • The email contains the device name and reported temperature value.

If no email is received, check the Spam folder and verify mail server settings.

Email notifications are sent only when an alarm is created, not when an existing alarm is updated.


See Also

Next steps