[GH-ISSUE #1161] Telegram integration: use your own bot #801

Closed
opened 2026-02-25 23:43:37 +03:00 by kerem · 7 comments
Owner

Originally created by @0x412e4e on GitHub (May 20, 2025).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/1161

Hi,

I'm on a self-hosted instance of healthchecks.io, is it possible to use my own Telegram bot for the integration?

In the documentation only the official Healthchecks.io bot is mentioned: https://healthchecks.io/integrations/telegram/

Originally created by @0x412e4e on GitHub (May 20, 2025). Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/1161 Hi, I'm on a self-hosted instance of healthchecks.io, is it possible to use my own Telegram bot for the integration? In the documentation only the official Healthchecks.io bot is mentioned: https://healthchecks.io/integrations/telegram/
kerem closed this issue 2026-02-25 23:43:37 +03:00
Author
Owner

@cuu508 commented on GitHub (May 20, 2025):

Yes, see https://github.com/healthchecks/healthchecks?tab=readme-ov-file#telegram

<!-- gh-comment-id:2894691037 --> @cuu508 commented on GitHub (May 20, 2025): Yes, see https://github.com/healthchecks/healthchecks?tab=readme-ov-file#telegram
Author
Owner

@0x412e4e commented on GitHub (Jun 3, 2025):

Yes, see https://github.com/healthchecks/healthchecks?tab=readme-ov-file#telegram

Tried doing that and I get the following error when running the command ./manage.py settelegramwebhook:

[root@health ~]# /opt/healhchecks/manage.py settelegramwebhook
Admin Command Error: /opt/healhchecks/manage.py settelegramwebhook
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 255, in fetch_command
    app_name = commands[subcommand]
KeyError: 'settelegramwebhook'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/healhchecks/manage.py", line 13, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 262, in fetch_command
    settings.INSTALLED_APPS
  File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 102, in __getattr__
    self._setup(name)
  File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 89, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 217, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib64/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'hc'
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 255, in fetch_command
    app_name = commands[subcommand]
KeyError: 'settelegramwebhook'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/healhchecks/manage.py", line 17, in <module>
    raise e
  File "/opt/healhchecks/manage.py", line 13, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 262, in fetch_command
    settings.INSTALLED_APPS
  File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 102, in __getattr__
    self._setup(name)
  File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 89, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 217, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib64/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'hc'```
<!-- gh-comment-id:2936908989 --> @0x412e4e commented on GitHub (Jun 3, 2025): > Yes, see https://github.com/healthchecks/healthchecks?tab=readme-ov-file#telegram Tried doing that and I get the following error when running the command `./manage.py settelegramwebhook`: ``` [root@health ~]# /opt/healhchecks/manage.py settelegramwebhook Admin Command Error: /opt/healhchecks/manage.py settelegramwebhook Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 255, in fetch_command app_name = commands[subcommand] KeyError: 'settelegramwebhook' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/healhchecks/manage.py", line 13, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 262, in fetch_command settings.INSTALLED_APPS File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 102, in __getattr__ self._setup(name) File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 89, in _setup self._wrapped = Settings(settings_module) File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 217, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/lib64/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked ModuleNotFoundError: No module named 'hc' Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 255, in fetch_command app_name = commands[subcommand] KeyError: 'settelegramwebhook' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/healhchecks/manage.py", line 17, in <module> raise e File "/opt/healhchecks/manage.py", line 13, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 262, in fetch_command settings.INSTALLED_APPS File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 102, in __getattr__ self._setup(name) File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 89, in _setup self._wrapped = Settings(settings_module) File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 217, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/lib64/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked ModuleNotFoundError: No module named 'hc'```
Author
Owner

@cuu508 commented on GitHub (Jun 4, 2025):

What Docker image are you using?

The error message contains "python3.9" so I'm guessing it's an old image.

<!-- gh-comment-id:2939170510 --> @cuu508 commented on GitHub (Jun 4, 2025): What Docker image are you using? The error message contains "python3.9" so I'm guessing it's an old image.
Author
Owner

@0x412e4e commented on GitHub (Jun 5, 2025):

[root@health ~]# docker image ls
REPOSITORY   TAG       IMAGE ID       CREATED        SIZE
docker-web   latest    74df95390783   4 months ago   308MB
postgres     16        3a8ac53a09c3   6 months ago   432MB

How does one perform an upgrade? Couldn't find info in the docs. Can I just do the following?

docker compose pull
docker compose up -d

Edit: did those steps and still facing the same error. Is there a guide on pulling the newest version from Git and doing an in place upgrade? Wouldn't want to start from a clean slate and lose all the history data. Would it work if I add the .env file to .gitignore and just do a git pull?

<!-- gh-comment-id:2945203037 --> @0x412e4e commented on GitHub (Jun 5, 2025): ``` [root@health ~]# docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE docker-web latest 74df95390783 4 months ago 308MB postgres 16 3a8ac53a09c3 6 months ago 432MB ``` How does one perform an upgrade? Couldn't find info in the [docs](https://healthchecks.io/docs/self_hosted_docker/). Can I just do the following? ``` docker compose pull docker compose up -d ``` Edit: did those steps and still facing the same error. Is there a guide on pulling the newest version from Git and doing an in place upgrade? Wouldn't want to start from a clean slate and lose all the history data. Would it work if I add the `.env` file to `.gitignore` and just do a `git pull`?
Author
Owner

@0x412e4e commented on GitHub (Jun 18, 2025):

I'm now running version 3.10 of healthchecks.io, using the pre-built image and I still get an error when trying to set the Telegram webhook:

REPOSITORY                  TAG       IMAGE ID       CREATED       SIZE
postgres                    16        2ff0239b7235   11 days ago   436MB
healthchecks/healthchecks   v3.10     88a93a66b2c5   5 weeks ago   311MB
[root@health healthchecks]# ./manage.py settelegramwebhook
Admin Command Error: ./manage.py settelegramwebhook
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 255, in fetch_command
    app_name = commands[subcommand]
KeyError: 'settelegramwebhook'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/lib/containers/healthchecks/./manage.py", line 13, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 262, in fetch_command
    settings.INSTALLED_APPS
  File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 102, in __getattr__
    self._setup(name)
  File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 89, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 217, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib64/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/var/lib/containers/healthchecks/hc/settings.py", line 17, in <module>
    import django_stubs_ext
ModuleNotFoundError: No module named 'django_stubs_ext'
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 255, in fetch_command
    app_name = commands[subcommand]
KeyError: 'settelegramwebhook'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/lib/containers/healthchecks/./manage.py", line 17, in <module>
    raise e
  File "/var/lib/containers/healthchecks/./manage.py", line 13, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 262, in fetch_command
    settings.INSTALLED_APPS
  File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 102, in __getattr__
    self._setup(name)
  File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 89, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 217, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib64/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/var/lib/containers/healthchecks/hc/settings.py", line 17, in <module>
    import django_stubs_ext
ModuleNotFoundError: No module named 'django_stubs_ext'
<!-- gh-comment-id:2984329389 --> @0x412e4e commented on GitHub (Jun 18, 2025): I'm now running version 3.10 of healthchecks.io, using the pre-built image and I still get an error when trying to set the Telegram webhook: ``` REPOSITORY TAG IMAGE ID CREATED SIZE postgres 16 2ff0239b7235 11 days ago 436MB healthchecks/healthchecks v3.10 88a93a66b2c5 5 weeks ago 311MB ``` ``` [root@health healthchecks]# ./manage.py settelegramwebhook Admin Command Error: ./manage.py settelegramwebhook Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 255, in fetch_command app_name = commands[subcommand] KeyError: 'settelegramwebhook' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/var/lib/containers/healthchecks/./manage.py", line 13, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 262, in fetch_command settings.INSTALLED_APPS File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 102, in __getattr__ self._setup(name) File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 89, in _setup self._wrapped = Settings(settings_module) File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 217, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/lib64/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 680, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 850, in exec_module File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "/var/lib/containers/healthchecks/hc/settings.py", line 17, in <module> import django_stubs_ext ModuleNotFoundError: No module named 'django_stubs_ext' Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 255, in fetch_command app_name = commands[subcommand] KeyError: 'settelegramwebhook' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/var/lib/containers/healthchecks/./manage.py", line 17, in <module> raise e File "/var/lib/containers/healthchecks/./manage.py", line 13, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 262, in fetch_command settings.INSTALLED_APPS File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 102, in __getattr__ self._setup(name) File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 89, in _setup self._wrapped = Settings(settings_module) File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 217, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/lib64/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 680, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 850, in exec_module File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "/var/lib/containers/healthchecks/hc/settings.py", line 17, in <module> import django_stubs_ext ModuleNotFoundError: No module named 'django_stubs_ext' ```
Author
Owner

@cuu508 commented on GitHub (Jun 18, 2025):

Are you running the manage.py command outside the container? It should be run from inside the container.

Try

docker compose run web /opt/healthchecks/manage.py settelegramwebhook
<!-- gh-comment-id:2984391283 --> @cuu508 commented on GitHub (Jun 18, 2025): Are you running the `manage.py` command outside the container? It should be run *from inside* the container. Try ``` docker compose run web /opt/healthchecks/manage.py settelegramwebhook ```
Author
Owner

@0x412e4e commented on GitHub (Jun 18, 2025):

Oh my mistake, I thought I had to run the manage.py that's in the git directory.

That worked:

[root@health docker]# docker exec -ti f2ad00bcd288 /bin/bash
hc@f2ad00bcd288:/opt/healthchecks$ /opt/healthchecks/manage.py settelegramwebhook
Done, Telegram's webhook set to: https://server.domain.corp/integrations/telegram/bot/

I was then able to tell the bot to /start and configure the integration as per documentation.

Thanks very much for your help!

Image

<!-- gh-comment-id:2984459276 --> @0x412e4e commented on GitHub (Jun 18, 2025): Oh my mistake, I thought I had to run the `manage.py` that's in the git directory. That worked: ``` [root@health docker]# docker exec -ti f2ad00bcd288 /bin/bash hc@f2ad00bcd288:/opt/healthchecks$ /opt/healthchecks/manage.py settelegramwebhook Done, Telegram's webhook set to: https://server.domain.corp/integrations/telegram/bot/ ``` I was then able to tell the bot to `/start` and configure the integration as per documentation. Thanks very much for your help! ![Image](https://github.com/user-attachments/assets/82e75e90-b012-4f9c-a751-12c03145d8c5)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/healthchecks#801
No description provided.