Transform your ESP32 into a smart notifier that sends real-time WhatsApp messages based on sensor data — no GSM modem, no SIM card, and no paid WhatsApp Business API required. In this project, we’ll walk through how to Esp32 whatsapp notification using the free CircuitDigest Cloud WhatsApp API, perfect for IoT notifications like temperature warnings, motion events, or system status updates.

📌 What This Project Does

This build connects an ESP32 microcontroller to Wi-Fi and a cloud API that delivers WhatsApp messages to verified phone numbers. Whenever a sensor reading meets a specified condition (e.g., temperature above a threshold), the ESP32 sends a secure HTTPS request to the CircuitDigest Cloud platform. The cloud service formats your alert using pre-approved WhatsApp templates and sends the notification instantly to your phone.

The best part? You can send messages to up to 5 verified numbers with a monthly allowance of 100 messages, entirely free.

🧰 What You’ll Need

  • ESP32 development board (any common variant)

  • DHT11 temperature sensor (or any other sensor you want to use)

  • Breadboard & jumper wires

  • USB cable to program and power the ESP32

(You can swap the DHT11 for another sensor — the software logic stays the same.)

🔌 Hardware Setup

Wire your components like this:

DHT11 PinESP32 Pin
VCC5V
GNDGND
DATAGPIO 23

This minimal wiring makes it easy to prototype.

🔑 Generate Your API Key

  1. Visit CircuitDigest Cloud and log in (or register if new).

  2. Go to Account → API Key and create a new key. Copy this — you’ll use it in code.

  3. Under WhatsApp Notification API, link up to 5 phone numbers. Each must be verified with a code sent via WhatsApp.

🧾 WhatsApp Message Templates

CircuitDigest Cloud uses predefined templates to ensure WhatsApp delivery compliance. Rather than writing free-form text in firmware, you choose a template ID and fill in variable fields like sensor values or location details.

Example templates include alerts for:

  • Threshold violations

  • Critical event alerts

  • Status updates

  • Maintenance reminders

🧠 How It Works (Software)

  1. ESP32 connects to your Wi-Fi network.

  2. In a loop, it reads sensor data (e.g., temperature).

  3. If a measurement crosses your defined threshold, and a cooldown period has passed, it builds a JSON payload with:

    • Phone number

    • Template ID

    • Dynamic values for template variables

  4. The ESP32 sends this over HTTPS to the CircuitDigest Cloud server.

  5. The cloud formats and delivers the WhatsApp message.

🔥 Sample Payload Format

Here’s the JSON structure the ESP32 sends (fill in your details):

{  "phone_number": "919876543210",  "template_id": "threshold_violation_alert",  "variables": {    "device_name": "Living Room Temp Node",    "parameter": "Temperature",    "measured_value": "32°C",    "limit": "30°C",    "location": "Living Room"  }
}

Replace the placeholders with your own values and IDs.

📤 Firmware Highlights

  • Uses WiFi.h for internet connection and WiFiClientSecure.h for HTTPS.

  • Sensor readings trigger API calls only when needed, reducing spam.

  • A cooldown timer prevents repeated alerts in quick succession.

You’ll configure your SSID, password, API key, and phone number before uploading via the Arduino IDE.

⚙️ Uploading and Testing

  1. Install the ESP32 board package and DHT sensor library in Arduino IDE.

  2. Connect your ESP32 and update the sketch with your credentials.

  3. Select the correct board and port, then Upload.

  4. Open Serial Monitor at 115200 baud to watch Wi-Fi and sensor activity.

  5. Trigger a condition (e.g., increase temperature) and check that WhatsApp alerts arrive.

📈 Results & What You Can Build

Once uploaded, your ESP32:

  • Connects to Wi-Fi automatically.

  • Reads sensor values in real time.

  • Sends WhatsApp alerts via the cloud API when triggers occur.

Use this pattern for many IoT projects: motion detection,...

Read more »