Whatsapp integrations

I developed two custom integrations using two different software that can send WhatsApp notifications straight from Home-assistant without the need to register to 3rd party systems or official WhatsApp cloud API accounts.

  1. The first one: https://github.com/t0mer/matterbridge-custom-notifier is using Matterbridge (Written in GO).

  2. The second one https://github.com/t0mer/wapi-custom-notifier is using https://github.com/chrishubert/whatsapp-api/.

Wapi is better than the matterbridge because it can also send messages to contacts while matterbridge can send only to groups.

5 Likes

Hello friend, congratulations on the project, I’ve been looking for something like this for free for some time, regarding wapi, I’ve been receiving a log with the phrase in my docker console,

whatsapp_web_api | Initialization error: Timed out after 30000 ms when trying to connect to the browser! Chrome only in revision r982053 it is guaranteed to work.

the QR Code was not even generated.

Thank you for this project, it helped solve a particular issue I was having.

Hi, @Tomer_Klein Before I found this topic I also was working to find a Whatsapp self-served solution in the HA Docker environment. I found my solution in the rest_command (and using https://github.com/chrishubert/whatsapp-api):

rest_command:
  send_whatsapp_web_api_string:
    url: "http://localhost:3000/client/sendMessage/HASS"
    method: post
    headers:
      content-type: application/json
    payload: >
      {
      "chatId": "<see_contacts>@g.us",
      "contentType": "string", 
      "content": "Keldervloer - *{{ states('binary_sensor.waterleak_water_leak') }}*"
      }

f.y.i Conditional send inside an automation

To be honest I had/have some problems to find the right syntax because examples are scares but luckily one issue mentioned the required URL sendMessage-string :grin: . And with some inspiration of this topic you can see that above example also sends the value of the sensor (perhaps a helpful addition).

I am still looking for the example how to retrieve an incoming message it would be most welcome. Think the method will be likely “get” but what is the URL??? If you (or someone else) already knows how to do this please share.

Hello,

@Tomer_Klein

I am trying to do the docker wapi installation, I guess this need to be done on a ma maching that has docker installed.

I created the yaml file and did the docker compose pull and up and getting some errors.

I am currently running Docker version 24.0.7, build afdd53b

when I initially copied the yaml configuration it complained about the version and asked me to use either 2.2 or 3.2

I changed it the 3.8 to 3.2, then after that change I am getting the following error:


Couldn't connect to Docker daemon at http+docker://localhost - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

Tried to add DOCER_HOST=FQDN of the docker server, didn’t make a difference, also remove the localhost on the basewebhook variable to the FQDN of the server didn’t make any difference.

I am not an expert in docker, and I would appreciate any help.

This is nice - got plain text messages working fine with the wapi components.

@Tomer_Klein Have you had any success sending images or video or othe rmedia, for exampe camera output etc? If so, are you able to share how? Thanks

@Tomer_Klein This looks very interesting, but I just cannot get it to work. I’m following your instructions to the point, the session will never link/connevt. At 5) in your instructions I just get the message:
{“success”:false,“error”:“session_not_connected”}

Since port 3000 is already in use on my docker host I had to map that to something else, and I used 3010. I did change the callback URL in the docker compose file as I figured it will still be valid internally in the container. Well I did try to change this to the actual host and the new/mapped port too but that made no difference. I still get the session_not_connected message above.

Any ideas?

Hi @chjohans
I’m also having the same issue with the whatsapp container and i opened an issue for that. Hopefully the developer wil soon find the solution.

In the meantime, you can use my new integration that work better:

In the next version i will add the ability to attach media.

Hello.
I try to use your green api and its working good. but i want to send a snapshot which i have on a url “http://192.168.1.22/snap.jpeg” how can i send it?