How to Set Up Real-Time SMS/WhatsApp Alerts with InfluxDB 3 Processing Engine
By
Suyash Joshi /
Developer
Mar 25, 2025
Navigate to:
In Industrial IoT for real-time monitoring, timely alerts are crucial. While Slack and email notifications are common, they can be easily missed or buried in a flood of other notifications. SMS and WhatsApp on the other hand, offer a level of immediacy and directness that’s hard to ignore. Using InfluxDB 3 Core alongside SMS and WhatsApp alerts provides the real-time answers and information needed to correct issues as they happen, enabling employees to correct in real-time and save costs incurred by downtime.
This article will guide you through setting up SMS and WhatsApp alerts using InfluxDB 3 by leveraging its embedded Python processing engine. We will also use a third-party service, Twilio, for messaging and a simple Python plugin.
Why InfluxDB 3
InfluxDB 3 is a standalone database that can be easily deployed in the cloud or run locally, such as on a Raspberry Pi 5 or a linux machine, both commonly used in Industrial IoT. For our example project the SMS/WhatsApp plugin can be used with InfluxDB 3 Core or Enterprise as both support the processing engine.
Before getting started, you’ll need to have either Core or Enterprise on your machine. You can download the database for free here.
Use case: SMS/WhatsApp alert
We will work with a typical example in Industrial IoT:real-time temperature monitoring. A sustained high temperature can indicate a failing cooling system, potentially leading to hardware damage or downtime. The system will write periodic sensor measurements into InfluxDB 3 (Core/Enterprise) and send an SMS/WhatsApp alert if the temperature exceeds a predefined threshold.

SMS Alert

WhatsApp Alert
Beyond temperature monitoring, this alerting system can be adapted for various critical scenarios, such as:
- IoT:
- Refrigeration unit failure alerts (temp, etc.)
- Industrial equipment malfunction warnings (pressure, vibration, etc.)
- Environmental monitoring (humidity, air quality)
- DevOps (including Security Ops):
- Server crash notifications.
- Service unavailable
- Application error rate spikes
- Intrusion detection alerts
- Suspicious login attempts
- Firewall breach notifications
Architecture
This code demo will work with InfluxDB 3 (Core/Enterprise) and we will leverage its powerful new processing engine to process incoming streaming temperature data and execute custom Python code (using plugin) within the database. This eliminates the need for external task runners or complex data pipelines for many common alerting and transformation tasks.
The data flow is as follows:
- Data Source: Temperature sensor (or other data source)
- InfluxDB client API or CLI: Writes data using line protocol
- Processing Engine (Triggers & Plugin): The InfluxDB 3 processing engine is an embedded Python VM for running code inside the database to process and transform data. The code it runs is called a plugin. The plugin has a Python function that has a compatible signature with a Processing engine trigger, as shown in the code snippet below.
InfluxDB 3 provides the following types of triggers:
- WAL Flush Trigger: Sends a batch of written data (for a specific table or all tables) to a plugin (by default, every second). We will use this trigger for SMS alert logic.
- Schedule Trigger: Executes a plugin at a user-configured schedule (using a crontab or a duration) useful for data collection and deadman monitoring.
- On Request Trigger: Binds a plugin to a custom HTTP API endpoint at
/api/v3/engine/<ENDPOINT>
. The plugin receives the HTTP request headers and content and can then parse, process, and send the data into the database or third-party services.
#WAL-Flush trigger
def` process_writes(influxdb3_local, table_batches, args):
success, config = get_config(args)
if not success:
# ... handle errors ...
return
process_wal_flush(influxdb3_local, table_batches, config)
1. Twilio (SMS/WhatsApp messaging): The plugin code relies on a popular third-party service called Twilio to programmatically send an SMS or WhatsApp message. You could easily substitute another messaging service if desired.
Full sample code for this project can be found on GitHub.
Create configuration file locally with following contents
#.env file
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_FROM_NUMBER=xxxxxxxxxx
TWILIO_TO_NUMBER=xxxxxxxxxx
# Optional: For WhatsApp
TWILIO_FROM_WHATSAPP_NUMBER=xxxxxxxxxx
TWILIO_TO_WHATSAPP_NUMBER=xxxxxxxxxx
2. Start InfluxDB 3 Core
For detailed guidance on how to install and set up InfluxDB 3, refer to the official guide. To follow detailed steps for this project, refer to this GitHub README. To activate the processing engine, we add the option --plugin-dir <PLUGIN_DIR>
which points to the directory in your file system where your plugin “sms-alert.py” exists.
influxdb3 serve \
--node-id host01 \
--object-store file \
--data-dir ~/.influxdb3
--plugin-dir ~/.plugins
3. Install packages we need for plugin code
influxdb3 install package twilio python-dotenv
4. Create a database
influxdb3 create database room-temp
5. Create a table
influxdb3 create table temp
6. Create trigger
influxdb3 create trigger \
--trigger-spec "all_tables:" \
--plugin-filename "sms-alert.py" \
--database room-temp \
wal_alert \
--trigger-arguments "field_name=temperature,threshold=22.5"
7. Enable trigger
influxdb3 enable trigger --database room-temp wal_alert
8. Test trigger using the wal_plugin to send SMS/Whatsapp Alert
influxdb3 test wal_plugin \
--lp "temp,location=factory temperature=90i 1678886400000000000" \
--input-arguments "field_name=temperature,threshold=80" \
--database room-temp \
sms-alert.py
In this test, the temperature of value 90 crosses our threshold value of 80, resulting in an SMS/WhatsApp alert being sent. That’s all there is to creating an SMS/Whatsapp alert with a straightforward rule using WAL Flush Trigger.
Wrapping up
The InfluxDB 3 processing engine is incredibly versatile. In future posts, we will cover collecting temperature and humidity data using Raspberry Pi, and build other plugins using different triggers such as scheduled and HTTP triggers. You are welcome to clone/fork this project or share your own processing engine plugins—we would be thrilled to highlight your projects! In the meantime, we welcome your feedback,questions, and comments on Discord in the #influxdb3_core channel, Slack in the #influxdb3_core channel, or our Community Forums.