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

Setting the webhook does not work #146

Closed
Diddlik opened this issue Dec 2, 2020 · 19 comments
Closed

Setting the webhook does not work #146

Diddlik opened this issue Dec 2, 2020 · 19 comments

Comments

@Diddlik
Copy link
Contributor

Diddlik commented Dec 2, 2020

I'm trying to set up the bot with webhook, but after deploy i get the error message and it switches to pooling.

environment:

Can somebody help me to setup it?

grafik

@windkh
Copy link
Owner

windkh commented Dec 2, 2020

I can not see a cert! Please read the tip at the bottom and the readme.

@Diddlik
Copy link
Contributor Author

Diddlik commented Dec 2, 2020

But Home Assistant and Addons are behind reverse proxy, do I need in this case cert?

@windkh
Copy link
Owner

windkh commented Dec 2, 2020

Hier Herr Schaf ;)
https://github.com/windkh/node-red-contrib-telegrambot#webhook-mode

Ich denke am Zertifikat kommst nicht vorbei

@windkh
Copy link
Owner

windkh commented Dec 2, 2020

Vielleicht auch so
#93

@Diddlik
Copy link
Contributor Author

Diddlik commented Dec 2, 2020

Gefühlt habe ich 100 mal gelesen, ich gehe das noch ein mal durch. Irgendwo habe ich Denkfehler.

Danke ;)

@windkh
Copy link
Owner

windkh commented Dec 2, 2020

Was kommt für ein Fehler?

@Diddlik
Copy link
Contributor Author

Diddlik commented Dec 2, 2020

msg : string[75]
"Configuration data for webhook is not complete. Defaulting to polling mode."

@windkh
Copy link
Owner

windkh commented Dec 2, 2020

openssl req -newkey rsa:2048 -sha256 -nodes -keyout PRIVATE.key -x509 -days 365 -out PUBLIC.pem -subj "/C=NG/ST=Lagos/L=Lagos/O=SchafBot/CN=ha.mydomain.com/aaa7bt54_nodered"

@windkh
Copy link
Owner

windkh commented Dec 2, 2020

Einfach cert erstellen

@windkh
Copy link
Owner

windkh commented Dec 2, 2020

Ich glaube ich erstelle noch ein makecert.bat das man einfach aufrufen kann

@Diddlik
Copy link
Contributor Author

Diddlik commented Dec 2, 2020

Bin Stück weiter gekommen, aber jetzt kommt in dem Log:

Unhandled rejection Error: ETELEGRAM: 400 Bad Request: bad webhook: Failed to resolve host: No address associated with hostname at /config/node-red/node_modules/node-telegram-bot-api/src/telegram.js:284:15 at tryCatcher (/config/node-red/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/config/node-red/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/config/node-red/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromise0 (/config/node-red/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/config/node-red/node_modules/bluebird/js/release/promise.js:729:18) at _drainQueueStep (/config/node-red/node_modules/bluebird/js/release/async.js:93:12) at _drainQueue (/config/node-red/node_modules/bluebird/js/release/async.js:86:9) at Async._drainQueues (/config/node-red/node_modules/bluebird/js/release/async.js:102:5) at Immediate.Async.drainQueues [as _onImmediate] (/config/node-red/node_modules/bluebird/js/release/async.js:15:14) at processImmediate (internal/timers.js:456:21)

windkh added a commit that referenced this issue Dec 2, 2020
@windkh
Copy link
Owner

windkh commented Dec 2, 2020

https://github.com/windkh/node-red-contrib-telegrambot/blob/master/examples/makecert.bat

your bot host should be ha.mydomain.com/aaa7bt54_nodered without https://

@windkh
Copy link
Owner

windkh commented Dec 2, 2020

I updated the readme and added that makecert.bat under examples to ease creation of the cert. Good luck!

@Diddlik
Copy link
Contributor Author

Diddlik commented Dec 2, 2020

Was ich noch heraus fand. Der Port wird am Ende angehäng und nicht direkt nach dem domain.
Etwa so: https://ha.mydomain.com/aaa7bt54_nodered:443/token, somit ist es nicht erreichbar. Sollte es nicht:
https://ha.mydomain.com:443/aaa7bt54_nodered/token sein?
var botUrl = "https://" + this.botHost + ":" + this.publicBotPort + "/" + this.token;

@windkh
Copy link
Owner

windkh commented Dec 2, 2020

An sowas habe ich nicht gedacht bin immer von einer Domain ohne Anhängsel ausgegangen

@Diddlik
Copy link
Contributor Author

Diddlik commented Dec 2, 2020

Das Problem hat man min Anhängsel wenn man Node_red in Home Asisstant oder in CCU3 bei HomeMatic IP nutzt.
Es wird immer als subfolder definiert.
Ich mache morgen in nginx die Anpassung, so dass Red-Node direkt als subdomain wird. Als workaround sollte es gehen

@windkh
Copy link
Owner

windkh commented Dec 2, 2020

Was ich noch heraus fand. Der Port wird am Ende angehäng und nicht direkt nach dem domain.
Etwa so: https://ha.mydomain.com/aaa7bt54_nodered:443/token, somit ist es nicht erreichbar. Sollte es nicht:
https://ha.mydomain.com:443/aaa7bt54_nodered/token sein?
var botUrl = "https://" + this.botHost + ":" + this.publicBotPort + "/" + this.token;

ich werde das demnächst richten... wäre schön, wenn du das dann ausprobieren könntest.

@Diddlik
Copy link
Contributor Author

Diddlik commented Dec 3, 2020

Ich habe es direkt in dem Bot COde angepasst, jetzt wir der Webhook link richtig generiert:

grafik

@windkh
Copy link
Owner

windkh commented Dec 3, 2020

Kannst dazu einen pull request machen?

@windkh windkh closed this as completed Dec 5, 2020
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

2 participants