Home » Blog » Send PERSONAL WHATSAPP Messages in HOME ASSISTANT Now!

Send PERSONAL WHATSAPP Messages in HOME ASSISTANT Now!

Hi!
Sending WhatsApp messages from Home Assistant is already possible for some years using Callmebot. And now it’s also possible to send WhatsApp messages in Home Assistant from your own personal WhatsApp account so that it looks like you’ve sent the message yourself. There are some caveats to both methods and I will explain them in this video. Let’s do this!


⭐⭐⭐ NOTE: ⭐⭐⭐

This article accompanies a YouTube video. I wrote it for people who would rather read than watch a video. In order to keep doing this, I would like to ask you to also check out the video, leave a comment under the video, give the video a thumbs up and subscribe to my YouTube channel. This means that the video is offered more often to new visitors so that they also stay informed of the latest Home Assistant tutorials.

Thank you for your support!

Ed

Click here to watch the video

Introduction

There are multiple ways to send notifications to your phone. You can use the standard notification option of Home Assistant that will send a push message to your phone if you have the Home Assistant Companion App installed. You can also send messages using Telegram or Twitter for example. But at the moment, WhatsApp still seems to be the most popular app to send messages to your contacts.

It was already possible to send messages in Home Assistant to WhatsApp using Call Me Bot, but now it’s also possible to send messages in Home Assistant to WhatsApp by using your own WhatsApp account. This way, your contacts will receive a WhatsApp message from you directly instead of from an external WhatsApp account. This service is called WhatsPie. We will use the following use case in this tutorial: Send a message to my partner as soon as I leave my work. I created a simple automation to make this use case work. If you want to know more about geofencing and presence detection, check out this tutorial.

I will explain the following things in this tutorial:

  • Introduction to Call Me Bot
  • How to Install Call me Bot
  • How to send a WhatsApp message through Call Me Bot
  • Introduction to WhatsPie
  • How to Install WhatsPie
  • How to send a WhatsApp message through WhatsPie
  • Showing the pros and cons of both systems.

But, before we start, please subscribe to my channel and hit the thumbs-up button for this video. This way, you make sure that I can keep creating these videos for you!

Call Me Bot Introduction

Call Me Bot is an external service that is free of charge and can send WhatsApp messages to specific phone numbers using a REST API. Setting up Call Me Bot is easy and creating an automation to send a message is not complicated at all. When you receive a WhatsApp message from Call Me Bot, you will see that the sender is Call Me Bot, so you cannot start a conversation about that message after that.

How to Install Call me Bot

To install Call Me Bot, you have to create a contact for Call me Bot on your Phone.
Use the phone number +34621073245 for Call Me Bot. It might be that this phone number changes in the future. I will update the phone number in the description of this video if this is the case.
Then, go to Whatsapp and send the following message to the Call Me Bot account: I allow callmebot to send me messages

You will receive an API key in a response to this message. Write down this API key, because you’ll need this in Home Assistant later.
Now, Go to Home Assistant. We have to add some information to the configuration.yaml of Home Assistant.

It’s easiest to do this with an add-on called Studio Code Server. Go to Settings, Add-ons, Click on Add-On Store and search for Studio Code Server. Click install to install Studio Code Server. After installing Studio Code Server, turn all the toggles on and click on Start.

If you open Studio Code Server, you’ll see all the files on your Home Assistant server. Open the configuration.yaml file and add the following lines:

notify:
  - name: WhatsApp
    platform: rest
    resource: https://api.callmebot.com/whatsapp.php
    data:
      source: HA
      phone: +31123456789
      apikey: 123456

Enter the phone number from the phone that you’ve just used to create the API key and enter the API key that was just sent to you. Save the configuration.yaml file and reboot Home Assistant by going to developer Tools, checking the configuration, and clicking restart

By the way, you can also download the code that I created for this video through the download link in the description below. It’s the easiest way to get this to work. You do not have to type the code from the screen and will save you time and frustration. You might as well download it first so that you can follow along in this tutorial. Next to that, you sponsor me so that I can keep creating these videos for you.

How to send WhatsApp messages in Home Assistant through Call Me Bot

We’ve just created a new notify service in Home Assistant called notify.whatsapp. We can use this service now in scripts and automations. Let’s set up the automation that sends a message when I leave work now.

  • Go to Settings
  • Go to Automations and Scenes
  • Click Create Automation
  • Start with an empty automation
  • At Triggers, add a state trigger
  • The entity is your work zone. In my case, it’s called Work. In case you do not have a work zone, you can create zones in Settings->Areas & Zones.
  • Enter 0 in the “to” field. This way, the automation will trigger as soon as everybody left the zone Work.
  • Go to Actions and add a Call Service action
  • At service, select notify.whatsapp
  • Enter a Message that you want to send to the WhatsApp account that you configured before.
  • Now Save the automation and give it a meaningful name
  • You can test the automation by selecting the three dots in the action and selecting “Run”.

You will now receive a WhatsApp message from Call Me Bot on your phone. If you want to send messages to multiple phones, you can define multiple phones in the configuration.yaml like how we did that for this phone.

Introduction to WhatsPie

So, now you can send WhatsApp messages to various WhatsApp accounts which is nice, but the downside is that it’s being sent from a Call Me Bot account and not from your own account. Wouldn’t it be nice if you can send a WhatsApp message from Home Assistant as if it was sent from your own WhatsApp account? This way, it will look like you’ve sent the message yourself and the receiver of this message can respond to it and you will get that response in your own WhatsApp timeline.

This is possible if you use WhatsPie. You can try it for free, but eventually, have to pay a small monthly fee to keep using it. The fee is about $3,80 a month, so it’s not a huge amount of money. Let’s set it up to see how it works.

How to Install WhatsPie

  • Go to the WhatsPie website
  • Click Try For Free
  • Enter your Full Name
  • Enter your Phone Number including the country code
  • Enter your e-mail address
  • and enter a password
  • Click Register

A verification code is now sent to your WhatsApp number. Write that number down and enter it in the OTP field.

  • Click Verify
  • Now you have to verify your e-mail address
  • Click Send Activation Link
  • Open your e-mail and click on the activation link in the e-mail that has been sent to you.
  • The dashboard of WhatsPie will now open and you’ll see that no devices are registered yet.
  • We are going to register a phone now that will send the WhatsApp messages. In my case, it’s my phone, because I want my phone to send a WhatsApp message to my partner as soon as I leave work. You can also send messages to yourself by the way.
  • Click on Devices in the left menu
  • Click on Add
  • Click on Subscribe in the Beta Tester column.
  • Enter your phone number
  • Click Next
  • A new verification code is sent to your phone again
  • Open WhatsApp on your phone and write that number down
  • Now enter that number in the OTP field
  • Click Verify
  • You will see that your phone is now added to the device list, but it’s still UNPAIRED
  • Now click on the green arrows icon next to your device
  • You’ll see a QR code that is needed to pair your phone.
  • Open WhatsApp on your phone
  • Go to Settings and select Linked Devices. (This is the iPhone interface, it might look different on an Android phone)
  • Click on Link a Device and scan the QR code that is shown on your screen.
  • You will get a message that your device is connected.
  • Open the devices list and you will see that your device is now paired.
Profile Picture Ed

If my videos help you and if you want to stay up to date with my tutorials and not miss anything to increase your knowledge of Home Assistant and Smart Home, subscribe to my channel and tick the bell. It also helps if you post a comment. This way more people get notified about these videos. I need your support so that I can keep creating these videos for you.

Oh, and don’t forget to hit the thumbs up for this video. This allows me to make more tutorials for you.

By supporting me, you also support my work as a music therapist to help people with mental issues.

Thank you!

Configure WhatsPie in Home Assistant

We’ve created the free WhatsPie account and can continue to set it up in Home Assistant now. Please beware that the free account only works for a couple of days for testing purposes only.

To connect WhatsPie to Home Assistant, we have to retrieve an API key from WhatsPie.

  • For that, click on your account name in WhatsPie
  • Click Profile Settings
  • Select the API Key and copy it to your clipboard
  • Go back to Home Assistant
  • Go to HACS.
  • If you haven’t installed HACS yet, please watch this easy-to-follow video on how to do that.
  • Go to Integrations
  • Click on the three dots in the right upper corner
  • Select Custom repositories
  • Enter the following url in the Repository field: https://github.com/arifwn/homeassistant-whatspie-integration
  • Select Integration in the category field
  • Click Add
  • Close the window
  • Select Explore & Download Repositories
  • Search for WhatsPie
  • Click Whatspie
  • Click Download
  • Click Download again
  • Reboot Home Assistant by going to developer Tools, checking the configuration, and clicking restart
  • Now, open the configuration.yaml in Studio Code Server

I’ve removed the code for Call me bot to configure WhatsPie, but you can use both systems simultaneously.

Add the following lines to the configuration.yaml:

notify:
  - name: send_wa
    platform: whatspie
    api_token: "yourtoken"
    from_number: "316123456789"
    country_code: "31"
  • Give your notify service a name. In this case, I’ve called it send_wa.
  • Paste the api_token between quotes
  • Enter your phone number including the country code between quotes in the from_number field
  • And enter your country code between quotes in the country_code field.

Save the configuration.yaml file and reboot Home Assistant by going to Developer Tools, checking the configuration, and clicking restart

How to send WhatsApp messages in Home Assistant through WhatsPie

We’ve just created a new notify service in Home Assistant called notify.send_wa. We can use this service now in scripts and automations. Let’s set up the automation for WhatsPie now.

  • Go to Settings
  • Go to Automations and Scenes
  • Click Create Automation
  • Start with an empty automation
  • At Triggers, add a state trigger
  • The entity is your work zone again.
  • Enter again 0 in the “to” field.
  • Go to Actions and add a Call Service action
  • At service, select notify.send_wa
  • Enter a Message that you want to send to the WhatsApp account of the receiver.
  • Enter the phone number including the country code of the receiver in the Target field. Don’t forget to place it between quotes.
  • Now Save the automation and give it a meaningful name
  • You can test the automation by selecting the three dots in the action and selecting “Run”.

The pros and cons of both systems to send WhatsApp messages from Home Assistant.

I’ve tested both ways of using WhatsApp and they both have pro’s and cons.

CallMeBot is free and WhatsPie can be used for free for a short period of time. After that, you have to pay a small fee for it. The big plus for WhatsPie is that it sends messages from your personal account. Next to that, you only have to configure one account in the configuration.yaml to send WhatsApp messages to multiple other WhatsApp accounts.

If you want to do that with CallMeBot, you have to configure every phone separately in your configuration.yaml. And, in the case of CallMeBot, each phone that wants to receive WhatsApp messages, needs to grant CallMeBot explicit permission to send messages to it. This last obligation is a deal breaker for me. So, my final verdict is that WhatsPie is the winner of the two systems.

Oh, just to be clear, I am not getting paid for this video and I was not contacted by CallMeBot or WhatsPie.

Conclusion

The use case to send a message to your partner when you leave home is just one simple example. You can use this for many more use cases of course.

I am curious about what system you prefer and if you know more ways of using WhatsApp in Home Assistant. Let me know your opinion in the comments!

If you don’t want to type the code from the screen, you can download the code that I’ve created for this video via the ko-fi link in the description below. With this, you sponsor me, and make it possible for me to keep creating these videos for you.

I want to thank everyone who has supported me in making these videos and tutorials so far. I could never have done this without you. Thank you! You can support me through Patreon, Ko-Fi, or by joining my channel. If you also want to support me, look in the description of this video for the links. With that, you make it possible that I can continue to make these videos for you.

Oh, don’t forget to give this video a thumbs up, subscribe to my channel, and hit the notification bell.

I will see you soon!

Bye bye!


,

Back to all articles