sarus780/tg_bot_nightscout

By sarus780

Updated over 1 year ago

Telegram bot for Nightscout

Image
Message queues
0

90

sarus780/tg_bot_nightscout repository overview

The bot allows you to receive hourly blood glucose readings in Telegram chat, provided that the glucose monitoring system sends the data to Nightscout.
  • Built on the basis of the official Node js image.
  • Source code by WOLFERSER.
  • And my code changes to authorize the bot using JWS.

Requirements:

  • Telegram bot created with the help of Bot_father. After creating the bot, find it in Telegram.
  • ID of your telegram account and ID of participants who are allowed access to the bot.
  • A running docker on the system, of course.
  • Working nightscout instance version 15.0.2 with access to api v.2. This option provides an image from the repository nightscout:latest, to obtain an authorization token from NightscoutURL/api/v2/authorization/request/ page.
  • Bot token obtained from the Nightscout admin page NigtscoutURL/admin. The token must have read access.

Create a directory /opt/tg_bot_nigtscout and place the config.yaml file in it. Change the contents of the file to suit your data:

   botToken: 'YOUR_TELEGRAM_BOT_TOKEN' # Telegram bot token
   nightscoutUrl: 'YOUR_NIGHTSCOUT_URL' # URL of your Nightscout instance
   nightscoutToken: 'YOUR_NIGTSCOUT_TOKEN' # Token received on the administration page 'nigscoutUrl/admin'
   chatIds: # List of chat IDs to send messages to
     - 'CHAT_ID_1'
     - 'CHAT_ID_2'
   language: 'en' # Current language (en, ru)
   units: 'mmol/L' # Units for blood sugar measurement (mmol/L or mg/dL)

   # Available language options:
   # en - English
   # ru - Russian
  
   # Available units options:
   # mmol/L - Millimoles per liter
   # mg/dL - Milligrams per deciliter
  • Pull the image from the repository: docker pull sarus780/tg_bot_nightscout:1.0.1

  • Tag as you like: docker tag sarus780/tg_bot_nightscout:1.0.1 tg_bot

  • Run the image with the mount option: docker run -d -v /opt/nightscout-tgbot/config.yaml:/opt/nightscout-tgbot/config.yaml tg_bot

  • Make sure the container is running: docker ps

  • Now that everything is fine with our container, we can go to the telegram bot and manage it.

  • Use the commands: /start to start receiving hourly blood glucose updates, /admin to manage your mailing list, /sugar to get current blood glucose readings.

You can also use the project in docker-compose.yaml

 tgbot:
    image: sarus780/tg_bot_nightscout:1.0.1
    container_name: 'tg_bot'
    volumes:
      - '/var/data/docker/nightscout/tg_bot_nightscout/config.yaml:/opt/tg_bot_nightscout/config.yaml'
    restart: always
    depends_on:
     - nightscout
    logging: *default-logging

Tag summary

Content type

Image

Digest

sha256:857edabcc

Size

116.6 MB

Last updated

over 1 year ago

docker pull sarus780/tg_bot_nightscout:1.0.1