mirror of
https://github.com/healthchecks/healthchecks.git
synced 2026-04-25 23:15:49 +03:00
[GH-ISSUE #115] Integration with Telegram #78
Labels
No labels
bug
bug
bug
feature
good-first-issue
new integration
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/healthchecks#78
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dvorobiev on GitHub (Mar 1, 2017).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/115
It would be cool to add integration with a Telegram, as was done with Slack
@cuu508 commented on GitHub (Mar 2, 2017):
I agree, it would be great to have a Telegram integration.
I've been poking around the Telegram Bot API. Here's the UI flow I think I would be able to implement:
/startcommand (or/start@HealthchecksBotif multiple bots present) in the group. Bot responds with a confirmation link.Sounds good? Are there maybe examples of Telegram bots where the initial setup is more streamlined?
This would work for 1-to-1 chats and for groups. I could not find a good solution for channels – bot accounts can only be added as administrators not as regular users, so there are privacy problems.
@snakewa commented on GitHub (Mar 4, 2017):
So far I have a work around for this is to use HornBot(@bullhorn_bot) to bridge the webhook integration.
Add HornBot to a group and you will get a webhook url
fill it to webhook integration up and down's field and here is a example for the body field:

{"text":"$NAME status is changed to $STATUS"}And it should work:
Of course it will be nice to have an official bot or integration
@bellini666 commented on GitHub (Apr 3, 2017):
+1, this would be great!
@cuu508 commented on GitHub (May 11, 2017):
A preliminary version of Telegram integration is ready for testing on healthchecks.io.
@brain-1 @snakewa @hackedbellini when/if you get a chance, would be great to test it out!
@iphoting commented on GitHub (May 11, 2017):
Consider allowing the bot name to be customised, next to telegram token.
@cuu508 commented on GitHub (May 11, 2017):
Good point. Also I should update README with the manual steps involved in setting up the bot -- talking to the Botfather, generating access token, setting webhook address.
@Braintelligence commented on GitHub (Dec 27, 2017):
@cuu508 I'm sorry to dig this up, but for some reason I can't get Telegram to work on a self-hosted installation. I provided the TELEGRAM_BOT_NAME and TELEGRAM_TOKEN in the settings.py and the integration appears online but
/starting the bot doesn't do anything.How can I debug this? =/
@cuu508 commented on GitHub (Dec 27, 2017):
From README:
Did you complete this step? If yes, can you see Telegram's requests to
https://yourdomain.com/integrations/telegram/bot/in your webserver's access logs?@Braintelligence commented on GitHub (Dec 27, 2017):
The step
Using the setWebhook API call set the bot's webhook to https://yourdomain.com/integrations/telegram/bot/.is actually new to me. I didn't need to do this for other self-hosted apps that integrate Telegram.How do I go about doing this manually? Do I need to create some JSCode and run it? Or is there a bot command for accessing the API?
@cuu508 commented on GitHub (Dec 27, 2017):
There are some examples in Telegram's documentation here: https://core.telegram.org/bots/webhooks
For example, using curl:
curl -F “url=https://<YOURDOMAIN.EXAMPLE>/<WEBHOOKLOCATION>" https://api.telegram.org/bot<YOURTOKEN>/setWebhookTo make this easier, I wrote a small Django management command which will take care of this step. With
SITE_NAMEandTELEGRAM_TOKENset to correct values, run:If all goes well, the command will print out:
(I was testing this locally and was using ngrok proxy so Telegram can talk to my local healthchecks instance)
After this step you can try sending
/startto the bot again.If the
settelegramwebhookcommand works for you, I will update README with similar instructions.@Braintelligence commented on GitHub (Dec 27, 2017):
This worked, thanks a lot!
@Jacq commented on GitHub (Feb 13, 2019):
Is it possible to use the polling approach instead of the webhook by using the getUpdates method? https://core.telegram.org/bots/api#getting-updates
Thanks for the great work!
Cheers
@cuu508 commented on GitHub (Feb 14, 2019):
It's only webhooks at the moment.
Are you running it in an environment where inbound http requests from Telegram are not possible?
@Jacq commented on GitHub (Feb 14, 2019):
Yes mainly for security reasons no external ports/services are exposed, I was testing healthchechks to monitor some cron jobs.
@cuu508 commented on GitHub (Feb 14, 2019):
For a one-off, you could add the integration manually in Django admin.
In the new channel form, use these values:
You should then see the integration the Healthchecks dashboard, and can then assign checks to it.
@esturniolo commented on GitHub (Feb 21, 2021):
Hi. Sorry for bring this old post, but I can't make it work.
I add manually all that you say, but I get always
Received status code 404 with a message: "Not Found"But if I send a manual request
curl -X POST "https://api.telegram.org/botXXX:YYYYYY/sendMessage" -d "chat_id=-478151423&text=my sample text", it works and I receive the message in the group where is the Bot.Do you have any idea about this?
I tried with differents bots and projects with the same luck.
Thanks.
@cuu508 commented on GitHub (Mar 2, 2021):
@esturniolo have you set
settings.TELEGRAM_TOKEN?@cuu508 commented on GitHub (Mar 5, 2021):
It depends on the Dockerfile you are using.
If you are using the Dockerfile from this repository with Docker Compose, you would put it in the .env file
@zkmusa commented on GitHub (Apr 19, 2021):
Thank you. This worked for me.
@cgarnier commented on GitHub (Mar 7, 2022):
I use the docker image, i never been able to make works the telegram integration. I think, the doc is just not complete.
I made work telegram notification through the webhook integration.
@cuu508 commented on GitHub (Mar 7, 2022):
Hi @cgarnier, in case you remember – what problem did you run into when setting up the Telegram integration?
@cgarnier commented on GitHub (Mar 7, 2022):
I start by reading this
/integrations/add_telegram/doc. I follow the bot link but it bring nowhere ( https://t.me/Backup%20Bot ).I dont understand how to find that bot.
@cuu508 commented on GitHub (Mar 7, 2022):
Have you seen the instructions in README? https://github.com/healthchecks/healthchecks#telegram
@retifrav commented on GitHub (Mar 11, 2022):
Indeed, sending a message via Telegram bot is merely sending a POST HTTP request to Telegram's API, there is no need to register a webhook and rely on the Telegram bot backend service, which Healthchecks is apparently implementing behind the scenes. The latter can be convenient though, if you'd like several users to be able to add this bot to their chats.
So if you need to get Telegram notifications for only one recipient (personal chat, group chat or a channel), then you can use a Webhook integration instead. Also nothing stops you from adding several Webhook integrations with the same bot but different
chat_id's.You can take a look at how I did it here: #618.
...oops, didn't read the thread carefully, this has been already suggested above.