Friday, September 11, 2026

Domoticz sends notifications to Whatsapp

For an index to all my stories click this text

It is unfortunately for us mere mortals not possible to send messages direct for our ESP8266, ESP32 or other microcontrollers to Whatsapp. You need a Whatsapp business account for that.

Unfortunately it is also not possible to send messages from your home automation system to Whatsapp. Domoticz (my home automation system) can activate notifications for a lot of services, but not for Whatsapp.

Fortunately there is a workaround.

Whatabot.


Whatabot is an intermediate service between microcontrollers and Whatsapp.
It works like this: You send a message to Whatabot and Whatabot sends the message to Whatsapp.
So obviously the whatabot developer has a Whatsapp Business account. 

I had an email exchange with the developer and het stated that you can send 200 to 300 messages for free. After that you need to buy additional messages. The fees are (in my view) very reasonable.

You can find the Whatabot website here: https://whatabot.net/


Setting up Whatabot.

I described this already in my last weeks story about sending messages from your microcontroller to Whatsapp. You can re-read that story here: 
https://lucstechblog.blogspot.com/2026/09/send-messages-to-whatsapp-with-pico-w.html


If you are only interested in sending messages from Domoticz read on.

This first part about setting up Whatabot is a copy from my story on sending messages from your microcontroller to Whatsapp. So skip this section if you already have a Whatabot account.



First thing you need to do is to add Whatabot to your contacts in your phone. So make a new contact, name it Whatabot and add the phone number:
+54 9 1123998026



Nex step is to open Whatsapp and search for Whatabot in the contacts list. Then send a message to the Whatabot saying: I allow whatabot to send me messages.

To make life a bit easier I did this on the web version of Whatsapp that can run on your PC. You can find Whatsapp web here:
https://web.whatsapp.com/



Immediately you will get an answer that shows that the Whatabot API is activated for your mobile number and an example that shows how to use the API.



Test if this API works.

Just copy the example and paste it into your browsers address bar. That's where the red arrow points in the picture below. This is easy to do if you use the Whatsapp web version instead of working on your tiny phone screen.



Almost immediately you will get a message back with the information shown above.
This tells you that the message will be send shortly to your Whatsapp account


And indeed a few seconds later the message "Hello from Whatabot" appears as a notification on the main screen of my phone.



And there it is in Whatsapp.

Now we know for sure that Whatabot is connected to our phone and the API works. On to the next step.

 

From Domoticz to Whatsapp 

I have a lot of switches which I can control in my Domoticz system. Switches build with ESP8266, ClickOn-Clickoff switches and Philips Hue lamps.



For this example I will use the lamp from my mancave to send a message to Whatsapp. The operation is for most switches the same so you should have no problem adapting it to your own setup.



As my system is in Dutch I will translate the buttons at the bottom for you.

Log - shows the log of the use of the switch
Aanpassen - this is for adapting the settings for this switch
Timers - Automate switching ON and OFF
Notifications - Sending notifications to Telegram etc.

What we need is the second button called "Aanpassen". So click that button.



The above screen will open and you can alter the settings for this particular button.

We need to change the settings for the fields where the red arrow points to.
These fields are blank now and we need to fill them in.

The top field is "Aan actie" and here we can fill in the action that needs to be taken when the lamp is set ON. The second field is the "Uit actie" and there we need to fill in what must happen when the lamp is set off.

We only need to fill in the apprpriate HTTP code.
And that is the HTTPS code you received as the API call from Whatabot.

So let's see how the Whatsapp API call in general is:

https://api.whatabot.net/whatsapp/sendMessage?apikey=YOUR-API-KEY&text=Hello%20from%20Whatabot&phone=YOUR-PHONE-NUMBER"

We have to modify this API call for our own needs. Best way to do this is by copying this line into a text editor like notepad.
Replace YOUR-API-KEY with the API key you got from Whatabot and replace Your_Phone-Number with your mobile number.

Last step is to alter the text.
When using this API call with a microcontroller, the microcontroller can not send spaces over the web. Therefore in the sample text the spaces are replaced by %20.
In Domotics that is not necesarry. You can just put spaces in the text.

We need to compose two API calls. One which is send when the lamp is set ON and the other which will be send when the led is set OFF. Like this:

https://api.whatabot.net/whatsapp/sendMessage?apikey=YOUR-API-KEY&text=The mancave lamp goes ON&phone=YOUR-PHONE-NUMBER"

https://api.whatabot.net/whatsapp/sendMessage?apikey=YOUR-API-KEY&text=The mancave lamp goes OFF&phone=YOUR-PHONE-NUMBER"


Really dull texts but I am sure you can come up with something more sparkling.
And (again) of course do not forget to fill in your api-key and phone number in both lines.

Copy the lines and paste them in the empty fields in Domoticz.



That is all !!!!

Do not forget to save the settings (Opslaan) !!



The result:

Press the lamp on and then press it off.



This resulted in my phone waking up and showing these notifications.



And this is how the messages look in Whatsapp.


Concluding.

When you got hold of the API key sending messages with Domoticz to Whatsapp is really easy.

You can adapt this to all your Domoticz switches and sensors.

In a previous story I used an ESP to Ping my and my girlfriends phone. Using the Ping switch in Domoticz you can check if someone of your family enters or leaves your home (beware of privacy issues).

If you have a PIR setup in Domoticz you can get notifications in Whatsapp when someone enters a room in your house.

There are a million possibilities with this and I am sure you can come up with some pretty neat ideas.

Till next time
have fun


Luc Volders













Friday, September 4, 2026

Send messages to Whatsapp with Pico W and ESP8266 or ESP32

For an index to all my stories click this text

Long time ago (May 2021) I wrote a story about sending messages from the ESP8266 or ESP32 to WhatsApp.

The obvious reason for this is that I can instruct my microcontroller to send a message to Whatsapp when an event occurs. That way I get a message on my phone when a door opens, a temperature reaches a critical value, movement is detected etc. etc. And these messages are shown as a notification on the main screen of my phone so they immediately draw attention.

From the technical aspect view nothing has changed. You still can not send messages from your controller direct to WhatsApp. If you are a hobbyist like me you still need an intermediate service to do that. I used Callmebot for achieving this.



And now there is a second service that does the job. It is called Whatabot.

For a variety of reasons I prefer Whatabot over Callmebot. 
One of the reaons is that Whatabot offers two way comunication. Meaning that Your microcontroller can send a message to whatsapp and whatsapp can send a essage to the microcontroller.

So at the moment I am switching over to Whatabot. You can find the website here: https://whatabot.net/

Setting up Whatabot.



First thing you need to do is to add Whatabot to your contacts in your phone. So make a new contact, name it Whatabot and add the phone number: 
+54 9 1132704925 



 

Next step is to open Whatsapp and search for Whatabot in the contacts list. Then send a message to the Whatabot saying: I allow whatabot to send me messages.

To make life a bit easier I did this on the web version of Whatsapp that can run on your PC. You can find Whatsapp web here:  https://web.whatsapp.com/



Immediately you will get an answer that shows that the Whatabot API is activated for your mobile number and an example that shows how to use the API.

Test if this API works.

For your convenience I herebye copy the API call so you can use it yourself. You just have to fill in your own API key and phonenumber:

https://api.whatabot.net/whatsapp/sendMessage?apikey=YOUR-KEY-HERE&text=Hello%20from%20Whatabot&phone=YOUR-PHONE-NUMBER

Just copy the example and paste it into your browsers address bar. That's where the red arrow points in the picture below. This is easy to do if you use the Whatsapp web version instead of working on your tiny phone screen.  

Almost immediately you will get a message back with the information shown above.
This tells you that the message will be send shortly to your Whatsapp account



And indeed a few seconds later the message "Hello from Whatabot" appears as a notification on the main screen of my phone.



And there it is in Whatsapp.

Now we know for sure that Whatabot is connected to our phone and the API works. On to the next step.

Send messages with Micropython

MicroPython is a subset of Python and is easy to use. Next to that MicroPython runs on all my favorite microcontrollers: ESP8266, ESP32 and Raspberry Pico and Pico W.



For programming I use the Thonny IDE. For more information about programming in MicroPython on the Pico W please read my book: Raspberry Pico W Simplified.
You can order it from Lulu https://www.lulu.com/shop/luc-volders/raspberry-pico-w-simplified/paperback/product-ke8vz9.html?q=luc+volders&page=1&pageSize=4

or from Amazon: https://www.amazon.com/Raspberry-Pico-Simplified-Luc-Volders/dp/1471032361/ref=sr_1_1?crid=1Y9V6SYFG1ORV&keywords=luc+volders&qid=1684942707&sprefix=%2Caps%2C239&sr=8-1

For demonstration purposes we will use a simple setup. Just a Raspberry Pi Pico W with a pushbutton.

The pushbutton is connected with a pull up resistor to GP15. You can however use any GPIO pin that suits you or your project.

The Micropython program

As usual I first present the complete program and then comment on some passages.

'''
This program sends data from the Pico W to Whatsapp
using the intermediate service from Whatabot.net
Code by Luc Volders
'''

import machine
import network
import urequests
import time
import gc

button = machine.Pin(15, machine.Pin.IN, machine.Pin.PULL_UP)

gc.enable()
gc.collect()
print("Start memory free: "+str(gc.mem_free()))

ssid = "YOUR-ROUTERS-NAME" 
pw = "PASSWORD" 

print("Connecting to wifi...")

# wifi connection
wifi = network.WLAN(network.STA_IF) 
wifi.active(True)
wifi.connect(ssid, pw)
print('Waiting for connection.',end="")
while wifi.isconnected() == False:
    time.sleep(1)
    print('', end='.')
print("") 

ip = wifi.ifconfig()[0]
print("Connected with IP adress : "+ip)

url = "https://api.whatabot.net/whatsapp/"
url = url + "sendMessage?apikey=YOUR-KEY-HERE&"
url = url + "text=You%20pressed%20the%20button&"
url = url + "phone=YOUR-MOBILE-NUMBER"

print("Pico W Send messages to Whatsapp")

while True:
    if not button.value():
        response = urequests.get(url)
        print(response.text)
        gc.collect()
        print("Memory " + str(gc.mem_free())) 
        time.sleep(5)


Let's look at the program in detail.

import machine
import network
import urequests
import time
import gc

The required libraries are loaded. The machine library takes care of working with the IO pins, in particular the button in this case. The network library makes it possible to work over Wifi. The urequests library is for sending requests to remote servers. The time library allows to put a pause in our program. And the GC library takes care of garbage collection aka freeing up unused memory.

button = machine.Pin(15, machine.Pin.IN)

The button is connected to GP15 which of course is an INPUT pin.

gc.enable()
gc.collect()
print("Start memory free: "+str(gc.mem_free()))

The garbage collection is enabled and activated. Then the amount of free RAM is printed.

ssid = "YOUR-ROUTERS-NAME"
pw = "YOUR-PASSWORD" 

Fill in your credentials: the routers name and your password.

# wifi connection
wifi = network.WLAN(network.STA_IF)
wifi.active(True)
wifi.connect(ssid, pw)
print('Waiting for connection.',end="")
while wifi.isconnected() == False:
    time.sleep(1)
    print('', end='.')
print("") 

The Wifi is activated and dots are printed in THonny's Shell. This way you know the Pico is trying to establish the connection with your router.

ip = wifi.ifconfig()[0]
print("Connected with IP adress : "+ip)

When the connection to the router is made the Pico's IP address is printed.

Now we get to the section where the API call is build.

Here is the full API call:

https://api.whatabot.net/whatsapp/sendMessage?apikey=YOUR-API-KEY-HERE&text=Hello%20from%20Whatabot&phone=YOUR-PHONE-NUMBER

For readability I have splitted it up in multiple lines. That makes editing the program and alterning the message a lot easier. Do not forget to substitute your own API key and mobile phone number.

url = "https://api.whatabot.net/whatsapp/"


The first part is the address of Whatabot and the indication for the bot to tell that we are going to send to Whatsapp.

url = url + "sendMessage?apikey=YOUR-API-KEY&"

We are going to send a message using our API key. So don't forget to fill in your API key here. And do not forget the & at the end.

url = url + "text=You%20pressed%20the%20button&"

This is the actual message we are going to send. It is impossible to send spaces as a letter. So all spaces need to be replaced by %20

url = url + "phone=YOUR-PHONE-NUMBER"

And the last part is where you have to fill in your phone number.

The phone number together with the API key are unique so the messages you are going to send always are received by your Whatsapp account.

while True:
    if not button.value():
        response = urequests.get(url)
        print(response.text)
        gc.collect()
        print("Memory " + str(gc.mem_free()))
        time.sleep(5)


In the endless loop the program constant tests if the button is pressed. When you press the button the request is send using the build API call. As a confirmation we receive a text from the bot showing that the message has been send. Unused memory is freed and the program waits 5 seconds.

In real life. 

When you press the button the API call is send to Whatabot.



This is what you will see in Thonyy's shell.



And as you can see the message got through on Whatsapp

More important: I first got a notification on my phone. Just like the one I showed at the beginning of this story. That is important for getting alarms, as they draw your attention.

The price tag.

During a mail exchange with the developer he told me that the first 200 messages are free. Depending on the server load.

That sounds fine. 200 messages should be more than enough for most testing purposes.
When these are consumed you can buy more messages.

You can buy messages by sending a message to the bot with the text: I want to buy a pack.



And this is the response.
Think about it. 3000 messages is almost 10 messages per day during a year. and that would set you back just USD 5. That is a very reasonable price.

Multiple microcontrollers and sensors. 

Please note that the API key is unique for your phone. It is not unique for your microcontroller.

This means that you can have multiple Pico W's, ESP8266's and ESP32's all using the same API call sending alarms and notifications to your phone. Just make sure you alter the text for each microcontroller and each sensor so you know which one is sending what.

The same applies if you connect several different sensors to your microcontroller(s). Make sure you alter the text for each sensor so you know which sensor is sending what information.

The only setback is that you might run out of your message stock earlier, and  have to buy more messages more often.


Multiple phones 

I can imagine that you want to have certain messages not only send to yourself but for example also to your partner. No problem.

Just make sure they open an account with Whatabot like described above. They do have to give you their phonenumber and their API key.

url = "https://api.whatabot.net/whatsapp/"
url = url + "sendMessage?apikey=YOUR-API-KEY&"
url = url + "text=You%20pressed%20the%20button&"
url = url + "phone=YOUR-PHONE-NUMBER"

You will need to copy the above lines for each phone you need to send the messages to. Do not forget to alter the variable's name url in a different name for each phone.

response = urequests.get(url)
print(response.text)
gc.collect()
print("Memory " + str(gc.mem_free()))
time.sleep(5)

And you will need to adapt in this part of the program the variable name url for the names for the various phones. If you want to send the same message to multiple phones, basically you just copy this part for each phone and put in the right variable's name.


Ideas for using this service.

In the example I connected a button to the Pico W.
You can exchange that for a motion sensor (PIR) to get an alarm on your phone when someone enters a room or your garage etc.

In previous stories on this weblog I discussed PING as a means to test if a device is online. But you can also use PING to test if a mobile phone is in reach of your router. This way you can test whether your partner or kids are at home. Mind the individual privacy options though.

You could use this API with a home automation system like Domoticz or Home Assistant. The home automation system can send a notification to Whatsapp when doors are opened etc. etc.

How about a Pico with a rain sensor sending a notification when it is raining so you should bring in the laundry.

And then there is of course the mailbox notification.

I bet you can come up with a hundred different ideas for this.


Next time

In a follow up story I am going to show you how you can send messages from whatsapp to your microcontroller using Whatabot. So stay tuned.

Concluding

This is a great service for sending messages and alarms to your phone. The first few hundred messages are free and after that the price for this service is in every way reasonable. As discussed above the possibilities are endless.


Till next time
Have fun


Luc Volders