anhbh310 / gotify2telegram

MIT License
22 stars 4 forks source link

No messages on Telegram BOT #1

Closed protontrigg3r closed 3 months ago

protontrigg3r commented 4 months ago

I tried to send a notification from Proxmox, both to the Gotify APPS "Proxmox" and directly to the auto generated application "Gotify 2 Telegram". The message arrives on Gotify but the messages are not forwarded to Telegram.

Logs do not show errors. How can I debug?

This is the configuration:

0-apps

1-client

2-inst

3-service

4-service_status

5-env_var

6-log

anhbh310 commented 3 months ago

Hello @protontrigg3r,

I apologize for the delayed response. I've built a deployment environment like yours, and everything works fine.

Could you please check the following:

Let me know if you need any more help!

tchekoto commented 3 months ago

I observed the same issue. However, the testing works, is there a limit on the message size?

anhbh310 commented 3 months ago

I observed the same issue. However, the testing works, is there a limit on the message size?

Hello @tchekoto, I've created a long message and sent it to the Gotify server. Everything ran perfectly.

On Gotify dashboard: image

On telegram: image

tchekoto commented 3 months ago

A backup report from Proxmox is like 25k chars on 322 lines.

Can you try with this size ? Lorem ipsum generator might help: https://www.lipsum.com/

anhbh310 commented 3 months ago

Hi @tchekoto,

Currently, the Telegram Bot API only supports 4096 characters per message (Ref: Telegram Bot API).

If you still want to send your Proxmox report, I'll add support for longer messages in the next release.

tchekoto commented 3 months ago

Hi Thank you for the investigation and the explanation.

Would it be possible to truncate long message ? Maybe with a parameter (4096 char seam to be touch much anyway in a log and the top of the report contains the details).

anhbh310 commented 3 months ago

To tackle this problem, I'm thinking of two solutions:

Which option do you prefer? Just let me know. Thank you!

tchekoto commented 3 months ago

Can you pick option 1 and leave an option to send the first message only ?

protontrigg3r commented 3 months ago

Hello @anhbh310 and thanks for your help

Is your GOTIFY_CLIENT_TOKEN value correct?

Yes, I copy-and-paste the value from Gotify interface to gotify.service

Please check the port value in YOUR_GOTIFY_IP. If you are running Docker,

I'm not using Docker, so I set the port where the service is running (3000).

ss -lnp | grep gotify

tcp LISTEN 0 4096 *:3000 *:* users:(("gotify",pid=624,fd=9))

protontrigg3r commented 3 months ago

I will break the report into many sub-messages, then send them consecutively to your Telegram.

For me this would be fine

protontrigg3r commented 3 months ago

I updated the Gotify server to version 2.5.0 and gotify2telegram to version 1.1.0 but still haven't been able to get things working.

The logs do not report errors and the test message sent by Proxmox is delivered on Gotify but not on the Telegram channel (where I turn off the Group Privacy setting).

There appears to be no communication between the Gotify server and the gotify2telegram client. I checked the values ​​of GOTIFY_CLIENT_TOKEN/TELEGRAM_CHAT_ID/TELEGRAM_BOT_TOKEN several times, so I guess the problem might be the value of GOTIFY_HOST.

I'm not using SSL so the Gotify server runs in plain HTTP on port 3000 (to use port 80 I would have to run gotify as root...): It is possible that the problem remains on "GOTIFY_HOST=ws:/ /localhost:3000" setting?

protontrigg3r commented 3 months ago

In case it may be useful to others: from console I run:

curl https://api.telegram.org/bot<bot-api-token>/getUpdates

The output give me a new Chat-ID value and after updating the environment variable TELEGRAM_CHAT_ID with this value, everything was fine.

anhbh310 commented 3 months ago

In case it may be useful to others: from console I run:

curl https://api.telegram.org/bot<bot-api-token>/getUpdates

The output give me a new Chat-ID value and after updating the environment variable TELEGRAM_CHAT_ID with this value, everything was fine.

Glad to know that, thanks for sharing. If you want to contribute to the project, please add your contributions to the README.md and create a pull request.

Can you pick option 1 and leave an option to send the first message only ?

I will break the report into many sub-messages, then send them consecutively to your Telegram.

For me this would be fine

Regarding handling long messages, I've added a new feature inspired by your suggestions. You can get it from the latest release v1.1.1. However, these pre-built .so files only support Gotify v2.5.0. If you want to use other versions, please recompile it from source.