grafana / oncall

Developer-friendly incident response with brilliant Slack integration
GNU Affero General Public License v3.0
3.47k stars 285 forks source link

No confirmation message from Telegram Connection #1235

Open scubbo opened 1 year ago

scubbo commented 1 year ago

What I Did

What I Expected

A reply in Telegram with a confirmation message

What Actually Happened

Nothing

More Information

Logs in engine pod after filling out Telegram env variables:

2023-01-27 07:17:44 source=engine:app google_trace_id=none logger=root inbound latency=0.016206 status=404 method=POST path=/telegram/ content-length=330 slow=0
2023-01-27 07:17:44 source=engine:app google_trace_id=none logger=django.request Not Found: /telegram/
2023-01-27 07:17:44 source=engine:uwsgi status=404 method=POST path=/telegram/ latency=0.022790 google_trace_id=- protocol=HTTP/1.1 resp_size=394 req_body_size=330
2023-01-27 07:17:46 source=engine:app google_trace_id=none logger=root inbound latency=0.003381 status=404 method=POST path=/telegram/ content-length=330 slow=0
2023-01-27 07:17:46 source=engine:app google_trace_id=none logger=django.request Not Found: /telegram/
2023-01-27 07:17:46 source=engine:uwsgi status=404 method=POST path=/telegram/ latency=0.009319 google_trace_id=- protocol=HTTP/1.1 resp_size=394 req_body_size=330
2023-01-27 07:17:50 source=engine:app google_trace_id=none logger=root inbound latency=0.012351 status=404 method=POST path=/telegram/ content-length=330 slow=0
2023-01-27 07:17:50 source=engine:app google_trace_id=none logger=django.request Not Found: /telegram/
2023-01-27 07:17:50 source=engine:uwsgi status=404 method=POST path=/telegram/ latency=0.019882 google_trace_id=- protocol=HTTP/1.1 resp_size=394 req_body_size=330

These 404s look like a likely culprit, but I don't know how I to go about addressing this.

No errors in Celery logs. I also tried restarting the Engine pod, with no effect.

Acetolyne commented 1 year ago

I am having this exact same problem with 404's on the /telegram/ endpoint as well. As an additional note to this issue the /telegram endpoint is not available in the browser either but i have found no steps to tell me how to enable this endpoint. I will follow this and provide any information i can to help resolve this issue for users that are experiencing it

Acetolyne commented 1 year ago

@scubbo did you disable group privacy on the bot prior to adding it to your channel and discussion group? it didnt help in my case as the path is not available but it may help you. If you did not yet then you need to do this step and remove the bot and re-add to the channel and discussion group. here is the doc. https://grafana.com/docs/oncall/latest/open-source/#telegram-setup

scubbo commented 1 year ago

I haven't even got so far as adding the bot to a channel/discussion group yet - I'm still on Step 4 of the section you linked. I'm having issues with linking Grafana to the bot, not with the bot's ability to send messages to channels.

scubbo commented 1 year ago

There are Helm values that can be set to define these Environment variables - I'm checking whether these fix the issue. If it does, though, both documentation and the Telegram account connection flow should be updated to indicate that this is necessary (or, I assume, that Oncall needs to be initialized with these environment variables set in order to enable Telegram - that is, that the Oncall engine needs to be restarted after adding the env variables from the UI)

Matvey-Kuk commented 1 year ago

Hi! Not sure if it's helpful, here is a video where I go through full TG installation process: https://www.youtube.com/watch?v=YMDFZP7Dxns&t=1s

Acetolyne commented 1 year ago

@scubbo I was able to get it working on my side the issue I had was telegram was enabled in Grafana but not in oncall. I was able to fix this by changing my environment variable in my helm deployment to True. I did this on the oncall engine template. - name: FEATURE_TELEGRAM_INTEGRATION_ENABLED value: 'True'

After this the bot started responding a new bot right after clicking or running the start command in a private chat with the bot typing Hi! resulted in the bot responding with Hi! This is Grafana OnCall notification bot. You can connect your Grafana OnCall account to Telegram on user settings page.

and after sending the code to link my account the bot responded with Done! This Telegram account is now linked to MY EMAIL ADDRESS 🎉

I did need to make sure the bot had privacy mode turned off as mentioned before I hope this step can help you resolve your issues as well as I feel the issue is the same, Let us know if this resolved your issue or if you are still struggling.

scubbo commented 1 year ago

@Matvey-Kuk , doesn't documentation need to be updated? Nothing here refers to the environment variable FEATURE_TELEGRAM_INTEGRATION_ENABLED

tommy04062019 commented 1 year ago

Similar problem but the solution above didn't fixed in my case. FEATURE_TELEGRAM_INTEGRATION_ENABLED was set to True in the engine but at the step 4, the bot responses nothing when typing command /start

tommy04062019 commented 1 year ago

Hi @Matvey-Kuk : It seems the telegram bot not running in the engine. I set two settings as bellow, something wrong with this?

Screen Shot 2023-03-14 at 14 12 57

[Privacy mode](https://core.telegram.org/bots#privacy-mode) is disabled for grafana oncall @grafana_my_bot.

I find that connecting to Telegram is really difficult for users even though it looks as simple as in the documentation. I have to spend too much time on this