klatka/nc-talk-bot-component

Unable to send messages from HA to Nextcloud Talk Server

Closed this issue · 8 comments

Hi,

I am getting the following error message on the HA side:
ERROR (MainThread) [custom_components.nctalkbot.notify] Nextcloud Talk Bot rejected the message. Secret or room name may be wrong. Status code when posting message: 404

On the nextcloud server I am getting ("g2jn2wtu" is the room token):
"GET /ocs/v2.php/apps/spreed/api/v3/signaling/g2jn2wtu HTTP/1.0" 200 1165 "-" "Mozilla/5.0 (Linux) Nextcloud-Talk v0.19.0"
"GET /ocs/v2.php/apps/spreed/api/v4/room/g2jn2wtu/participants?includeStatus=true HTTP/1.0" 200 1281 "-" "Mozilla/5.0 (Linux) Nextcloud-Talk v0.19.0"
"GET /ocs/v2.php/apps/spreed/api/v1/chat/g2jn2wtu setReadMarker=0&lookIntoFuture=1&lastKnownMessageId=13130&limit=100&includeLastKnown=0&markNotificationsAsRead=0 HTTP/1.0" 304 683 "-" "Mozilla/5.0 (Linux) Nextcloud-Talk v0.19.0"

But no messages in the NC Talk client.

The room is available and shows me as a member of that room.

In the configuration.yaml:
notify:

Any further ideas to get it function?

Regards

Gerhard

What I forgot:

----------------------------System report----------------------------
Nextcloud Talk Desktop version 0.19.0

  • Built with Nextcloud Talk version 18.0.0

Connected to:

OS: Linux 6.2.0-39-generic (#40~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 16 10:53:04 UTC 2)
----------------------------System report----------------------------

And that there is a nginx proxy between the HA and the nextcloud server...

Regards

Please check all installation steps of the README. The bot has to be installed with the same secret and assigned to the room.
You also have to specify the room token when you don't provide it in the yaml.

I double checked twice!
And I bypassed the nginx proxy!

But the error message is still the same.

It's guessing of course, but with the error code 404 I believe I have differences in my server structure or whatever.

I don't think that the secrets are wrong.

The checks with:
hass --config /config --script check_config --files
hass --config /config --script check_config --secrets

went well.

Do you have more ideas me to check my stuff?

Regards

Gerhard

From the Nextcloud docs:

404 Not Found When the conversation could not be found

Do you provide a target room when calling the service?

Hi,

I set the target to the "Room token", to the room which I named "homeassistant" and several room names more.

But I also switch on the debugging of the integration and got the message:
2023-12-19 10:50:52.526 DEBUG (MainThread) [custom_components.nctalkbot.talk_bot] Sending {'message': 'Message', 'referenceId': '09dd70c3cf6edfb7afc939c8b37961a4f742f4b23e0d63e99b36a4b04f275122'} with header {'X-Nextcloud-Talk-Bot-Random': 'f00bd6ae94df30192b2c0fde8f9c648038c7f556eadcd04ed5df42d04aa356aa', 'X-Nextcloud-Talk-Bot-Signature': 'e541f3b4499fd236db3073fa57d9c471d441b16c1b1eda869f1d8929b60cecec', 'OCS-APIRequest': 'true'} to http://192.168.1.250:8123/api/webhook/76ff72300f8352d47bb216672b10a66a69065d50eecf0b773fe39c364b386774/ocs/v2.php/apps/spreed/api/v1/bot/ynhi3kxu/message
2023-12-19 10:50:52.565 ERROR (MainThread) [custom_components.nctalkbot.notify] Nextcloud Talk Bot rejected the message. Secret or room name may be wrong. Status code when posting message: 404

The portion "http://192.168.1.250:8123/api/webhook/76ff72300f8352d47bb216672b10a66a69065d50eecf0b773fe39c364b386774" is the Webhook Url, fine.

But by trying this "http://192.168.1.250:8123/api/webhook/76ff72300f8352d47bb216672b10a66a69065d50eecf0b773fe39c364b386774/ocs/v2.php/apps/spreed/api/v1/bot/ynhi3kxu/message" in a web browser I am getting the error 404.

So it looks like that something arround my Webhook URL is not ok?

Regards

Gerhard

Your nextcloud_url should look like this: http://your-ip/

Hi klatka,

it was that simple that I missunderstood the nextcloud_url...

With the right URL it's functioning perfectly!

Very good integration !!!
Thanks a lot!

Regards,

Gerhard
P.S. some coffee will be arriving soon...

I will add a sample url to the README.

Thanks for your support!