Sending notifications to a whatsapp group

Hi HA community,

this video shows how to send notifications to a whatsapp group from within Home Assistant. It’s just a basic set-up guide which can be extended to any blueprint you’re using. Willing to see what you’re able to implement with it. Basic use case would be: family and friends on a whatsapp group will be able to get HA input (if they’re not already using the HA companion app :smiley:)

3 Likes

Nice, It Works!!! Thanks you. It would be great if were an integration based on Notifications, but works as service.

Indeed.
I believe you could achieve that it works as a Notification also. I had a look at this: restful notifications and you could achieve set the notification by adding these lines to configuration.yaml:

notify:
  - name: whatsapp_me
    platform: rest
    resource: https://whin2.p.rapidapi.com/send
    method: POST
    verify_ssl: true
    headers: 
      X-RapidAPI-Host: whin2.p.rapidapi.com
      X-RapidAPI-Key: YOUR_API_KEY
    message_param_name: text

I am no an expert on HA, the key here is you are able to POST a JSON with this property:

{“text”: “whatever is the message you need on the notification”}

If someone is able to test this, I would be more than happy to help on the backend side.

Regards!

I think the error tells you whats wrong:

Status code 429. Payload: b'{"text": "hello whin group, from HA!"}'

the b right before the '{ shouldn’t be there… I believe that’s the problem.

It is more a RTFM from my side… I did no setup the group and after a few actions my 10/d was done…trying again tomorrow …but thanks for the reply :slight_smile:

Oh, I see… if you follow the video you should receive the whatsapps on the groups without a problem… it doesn’t matter how you have configured HA to run. I am no expert and it worked for me :slight_smile:

Hi!

This is my info for text when using rest_command mode.

 payload:  '{"text": "{{ var_text }}" }'

The nofity versión is not working for me.

So I think you need to debug a little more…

This is what you sent:

{
  "{"text": "{{ var_text }}" }": "Hello World"
}

And this is what is expected to come in:

{
  "{"text": "Whatsapp from HomeAssistant"}": true
}

the Notification payload must be a valid JSON string, as the POST data is set to: application/json, and the valid schema is: “text”: “the test you want to send”.

You can see more examples here.

I got it to work… use this notification on the configuration.yaml:

notify:
  - name: whatsapp_me
    platform: rest
    resource: https://whin2.p.rapidapi.com/send
    method: POST
    verify_ssl: true
    headers: 
      X-RapidAPI-Key: Your_API-KEY_Goes_Here
    message_param_name: text

on Services tab, look for the notification, complete the message you want to send and click “call service”:

and you will get the whatsapp:

image

I hope it helps someone :slight_smile:

1 Like

Thanks…I will look at it when I get my 10/d back tomorrow
I do understand that any dev effort does not come for free but 10/d is a bit low to install/test :slight_smile:
Not sure if you @lu4t can influence this but I would allow a 100/d for 1-2 days.
To be very clear. I have no worries in paying but I need to see its value first.

Yes!!! now working great. Thanks!

I give up, not possible (for me) to create a group setup without continuously running into API max.
I even started a new account just now, I did 1 (one) sign-up call and then when creating ‘group’ it again started to throw a max-API calls reached.
I am not willing to pay a dime without proven working, it might also be a scam to suck money? How is it guaranteed to be working if you pay?
Nice idea and possibly working but not for me under these conditions…

Great!.. thanks for sharing.

already answered here:

take a break, maybe a cup of tea, and give it a try… :wink:

Possibly the break helped as miraculously … now it did not complain…very odd :roll_eyes:
Anyhow…testing continues later on :slight_smile:

And the same applies to sending to a group, I got it working now …

sometimes taking a break helps… :wink:

So this is the whole config for both rest_command and notify services:

rest_command:
  send_whatsapp_to_me:
    url: "https://whin2.p.rapidapi.com/send"
    method: POST
    headers: 
      content-type: application/json
      X-RapidAPI-Host: whin2.p.rapidapi.com
      X-RapidAPI-Key: Your_API_KEY
    payload: '{"text": "hello whin, from HA!"}'
  send_whatsapp_to_family_group:
    url: "https://whin2.p.rapidapi.com/send2group?gid=THE_GROUP_ID"
    method: POST
    headers: 
      content-type: application/json
      X-RapidAPI-Host: whin2.p.rapidapi.com
      X-RapidAPI-Key: Your_API_KEY
    payload: '{"text": "hello whin group, from HA!"}'
notify:
  - name: whatsapp_me
    platform: rest
    resource: https://whin2.p.rapidapi.com/send
    method: POST
    verify_ssl: true
    headers: 
      X-RapidAPI-Key: Your_API_KEY
    message_param_name: text

  - name: whatsapp_group
    platform: rest
    resource: https://whin2.p.rapidapi.com/send2group?gid=THE_GROUP_ID
    method: POST
    verify_ssl: true
    headers: 
      X-RapidAPI-Key: Your_API_KEY
    message_param_name: text
  

I hope it helps someone.

1 Like

Yeah! it works for me.

BTW, just a fun comment. According to your web, this is developed by inUtil labs. Even, in the Whastapp bot the name has the word inUtil. In Spanish sound really really bad :grinning_face_with_smiling_eyes: means Useless but as insult.

1 Like

Ok… I’m super excited to use this, but I’m starting to get annoyed. Can someone help me understand what’s happening? Why can’t I generate a group-id?

I subscribed and got individual messages working. I created a group and became Admin (I removed any privacy restrictions). I try to request the group-id and I get nothing. In all my testing, I hit my daily quota. I assume any interaction with the API counts against the quota. Is it possible I’m requesting the group-id too close to the previous request and it just doesn’t notify me? Is there a way I can see a running log for all activity?

Thanks in advance!