You can now send WhatsApp notifications from HA

Hi,
You can now send WhatsApp messages using a free API:
https://www.callmebot.com/blog/whatsapp-text-messages-from-homeassistant/

The service is still in beta version but it is working well with a small delay (10 seconds aprox.)

It is super easy to use.

12 Likes

How long does it takes to get the apikey?

EDIT: Nevermind, I have just got it. It was my mistake. I test it and it is working fine :slight_smile:

Hi @borjamartinez ,
can you also send pictures/videos?
How would you do that?

Thanks!

No. Only text messages for now.

I did a test.

It works with API test, but doesn’t work with HA.

What am I doing wrong?

This is my code:

notify:
  - name: WhatsApp
    platform: command_line
    command: 'wget $(cat) -O /dev/null'
automation:
  - id: '1591454222374'
    alias: Rega Ligada Notif
    description: ''
    trigger:
    - entity_id: switch.rega
      from: 'off'
      platform: state
      to: 'on'
    condition: []
    action:
    - data:
        message: http://api.callmebot.com/whatsapp.php?source=HA&user=myphonenumber&text=Rega+Ligada&apikey=mykey
      service: notify.WhatsApp

Hi @Joca , there was a mistake in the instructions. use &phone instead of &user in the url.

message: http://api.callmebot.com/whatsapp.php?source=HA&phone=myphonenumber&text=Rega+Ligada&apikey=mykey

Instructions updated :slightly_smiling_face:

Now is working.
I’ll be waiting for the the delay correction :slight_smile:
Sending photos and videos would be also an excellent improvement.
Nice job!
Thanks.

1 Like

It is a matter of resources… I try to minimize the costs but it is not easy… The hobbie is turning expensive. :grimacing:

1 Like

I don’t mean this the wrong way, but what are the security implications of this? Is there any way that this system could be abused?

Genuine question as it would be quite handy to have notifications in Whatsapp, but I’m not tech savvy with respect to how secure it is etc.

Anyone using this in Nodered? Just wondered how this would be done.

Each user (phone number) is having their own private apikey to allow sending messages only to that phone number (who requested the apikey). So basically you can only spam to yourself.

2 Likes

Awesome - cheers for that clarification.

Okay - managed to get this going and testing things out. I can (nodered) send a test message using the ‘http request’ node.

Now I ned to get a little more complicated. I’m trying to work out how to add data from a sensor into the message.

Currently I have this in a template node where {{service}} contains the battery percent:

{ "domain": "notify",
  "service": "mobile_app_pixel4",
  "data": {
    "title": "Plug Tess in",
    "message": "You forgot to plug in Tess.  The battery is at {{service}}%"
   }
}

Any idea how I would make that work with with Whatsapp?

Just worked this out - so the ‘http request’ node allows you to use mustache-style tags in it. This way, the relevant data can be pulled from sensors etc.
An example of the url in the node would be:

https://api.callmebot.com/whatsapp.php?phone=MyTelephoneNumber&text=This+is+a+test+{{state}}&apikey=MyAPIkey

using nodered on HA - i have a function which returns msg to the WhatsApp node.
in the WhatsApp notify node i have this. but i only get This. i dont get info within msg that was sent from function {
“message”: “https://api.callmebot.com/whatsapp.php?phone=+mobilenumber&text=This+{{msg}}&apikey=apikey”
}

i have alexa node from same function node and it is picking up the msg info.
any help to display msg info in WhatsApp?

New boy here - just set this up. had a bit of trouble with formating but figured it out - THANKS for such a great service. really useful, pretty easy to setup. Look forward to enhancements :slight_smile:

The service now is not free! :frowning_face:

No surprise there. It’s the direction all weather service providers are taking. I wouldn’t build my system around the expectation of any service remaining free these days.

If you can’t afford to pay $4 per year, you can contact the owner and he will find a solution for you. That’s what he said in the webpage.

1 Like

I can’t see anywhere that says it’s not free. In fact I just set this up last night and it’s still working fine right now… where are people seeing that it’s not free?