Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

installed on HA 2022.11.4 but not working #1

Open
GitHubxtsnl opened this issue Nov 21, 2022 · 15 comments
Open

installed on HA 2022.11.4 but not working #1

GitHubxtsnl opened this issue Nov 21, 2022 · 15 comments

Comments

@GitHubxtsnl
Copy link

Hi, I've installed your integration but when I test it using the Developer tools Service Notify nothing happens.

image

I've registered for an account on the website. I got the API token code. I configured the .yaml file as instructed.
I also received 2 whatsapp messages on my mobile number; one with the security code and one with the verified registration number.

I do not see anything in the logging of HomeAssistant. How to troubleshoot?

@arifwn
Copy link
Owner

arifwn commented Nov 22, 2022

Might be a configuration issue. Can you post the content of your home assistant's config (with api keys and private info redacted)?

Also, try using curl to manually verify your phone can actually send message using the api like this (do not use "+" in the phone number, just country code, e.g. "316xxxxxxxx"):

curl --location --request POST 'https://app.whatspie.com/api/messages' \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer <api key>' \
--data-urlencode 'receiver=31xxxxx' \
--data-urlencode 'device=316xxxxx' \
--data-urlencode 'message=test message' \
--data-urlencode 'type=chat'

@arifwn
Copy link
Owner

arifwn commented Nov 22, 2022

I also noticed occasional delivery issue, and upon further inspection, the API seems to hosted behind cloudflare. I had issues with APIs hosted behind cloudflare in the past, and impersonating popular browsers usually helps. I have pushed an update to make requests to the API uses chrome user agent. If this doesn't help, then your issue might be something else (e.g. bad config, etc).

@GitHubxtsnl
Copy link
Author

please see my config snippet below.

- platform: whatspie
    name: whatsapp
    api_token: ! secret whatspie_token
    from_number: !secret whatspie_fromnumber
    country_code: 62

I do not see any error messages in my HA log.

The documentation is not very straight forward at the moment.
I assume I have to configure the from_number & country_code with the number I received in the whatsapp chat, like +62 859-10xx-27xxx.

@arifwn
Copy link
Owner

arifwn commented Nov 22, 2022

replace country_code with your own country calling code: https://en.wikipedia.org/wiki/List_of_country_calling_codes#Ordered_by_code

then make sure the number has no special characters. The "+" at the front will be automatically stripped by this integration.

There is no log because this integration is not logging anything yet. I'll see if I can add some.

@arifwn
Copy link
Owner

arifwn commented Nov 22, 2022

The integration will now log API errors. However, if the issue is due to bad phone number formatting / wrong country code, WhatsPie doesn't seem to throw any error and will silently fails instead. You might want to use curl to confirm you can send messages to your destination via this api.

curl --location --request POST 'https://app.whatspie.com/api/messages' \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer <api key>' \
--data-urlencode 'receiver=31xxxxx' \
--data-urlencode 'device=316xxxxx' \
--data-urlencode 'message=test message' \
--data-urlencode 'type=chat'

@GitHubxtsnl
Copy link
Author

I've updated to the latest version, and I've changed the config.yaml file to:

- platform: whatspie
    name: whatsapp
    api_token: ! secret whatspie_token
    from_number: ! secret whatspie_fromnumber
    country_code: 31

The from_number is my own mobile number, right? without the country code or any additional characters in front, right?
And the country_code is my country code, right?

For example:
I live in the Netherlands, the country code is +31 so this will be 31 as the country_code
My mobile number is 0612345678, so this will be 612345678 as the from_number

But now I get an error.
image

@alco28
Copy link

alco28 commented Nov 22, 2022

same issues here, also from the Netherlands..

sample config:

- name: whatsapp platform: whatspie api_token: "KjXKw**********************YFIEGKlTSNE4KYpLPO" from_number: "612345678 " country_code: "31"
I also tried with +31 but no luck there.. always this error in the log:
(SyncWorker_3) [custom_components.whatspie.notify] WhatsPie HTTP API Response: 400 - {"status":400,"message":"Invalid Device Number"}

my sample call:

service: notify.whatsapp data: message: The garage door has been open for 10 minutes. title: Your Garage Door Friend target: 31612345678

@arifwn
Copy link
Owner

arifwn commented Nov 23, 2022

HTTP 403 means your api key might be incorrect. If the issue persist, you might want to double check your api config, verify it using curl (or other api tester app like postman), and if the issue still persist, talk to whatspie support.

HTTP 400 "Invalid Device Number" means your device probably isn't paired to whatspie yet. Check their documentation on how to pair them.

@GitHubxtsnl
Copy link
Author

GitHubxtsnl commented Nov 24, 2022

I'm now getting a new error, see below.

WhatsPie HTTP API Response: 400 - {"status":400,"message":"operator does not exist: character varying = bigint"}

image

I tried sending a message from HA to:
+316xxxxxxxx
316xxxxxxxx
06xxxxxxxx
All with the same result

@pathia
Copy link

pathia commented Nov 24, 2022

Doesn't work for me either. (fresh install)
Neither does it work if I send a message through the whatspie website.
The message stays in a pending state. I think their servers are down or something like that.
Not sure if they are trustworthy also. couldn't find much info about the company behind it.

@arifwn
Copy link
Owner

arifwn commented Nov 24, 2022

You might want to contact their customer service. I'm not affiliated with them, so I can only take a guess, but there is a chance that they might not support your country yet.

@pathia
Copy link

pathia commented Nov 24, 2022

This could indeed be the case as I'm from The Netherlands and I see @GitHubxtsnl username ends with nl and he uses country code 31 so he's also from The Netherlands.

@GitHubxtsnl
Copy link
Author

This could indeed be the case as I'm from The Netherlands and I see @GitHubxtsnl username ends with nl and he uses country code 31 so he's also from The Netherlands.

I'm indeed also from the Netherlands :-). I asked whatspie.com support if +31 is supported, let's see what they say.

@PlayFaster
Copy link

Hi There. I just wanted to confirm that I have got this working for me, once I went to the WhatsPie website, added my device (number), verified a second time and then paired the device (phone) to the WhatsPie webapp. For anyone having issues I'd suggest making sure you are fully set-up and paired on the WhatsPie website, just in case the issue is there.

@arifwn
Copy link
Owner

arifwn commented Dec 2, 2022

Just a reminder to not link your primary whatsapp number to Whatspie. Like other unofficial whatsapp api services, there is a risk of your number getting banned by whatsapp if whatsapp think your number is being used for automated spam. Get a secondary disposable prepaid number and use that instead of your own primary phone number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants