• Stars
    star
    363
  • Rank 117,374 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 5 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Node.js cli tool for monitoring your favorite TooGoodToGo businesses. Docker image available.

node-toogoodtogo-watcher GitHub license npm Docker Pulls

Node.js cli tool for monitoring your favorite TooGoodToGo businesses. Notifications are shown when the stock of any of the businesses changes. The following notification types are supported:

  • Interactive Telegram bot
  • All the notification services that Apprise supports (WIP, see #215).
  • Desktop notification
  • Console output

See below for Docker usage.

Installation

  1. Install Node.js 18.x or higher (Windows | Linux | OSx).
  2. npm install -g toogoodtogo-watcher
  3. toogoodtogo-watcher config. Optionally enable / disable certain notifications. See Configuring Telegram notifications for instructions on setting up the Telegram notifications.
  4. toogoodtogo-watcher login --email [email protected]. Click the link in the login email (on PC, not on phone).
  5. toogoodtogo-watcher watch

CLI documentation

Usage: toogoodtogo-watcher <command>

Commands:
  config        Edit the config file.
  config-reset  Reset the config to the default values.
  config-path   Show the path of the config file.
  login         Interactively login via a login email.
  watch         Watch your favourite busininesses for changes.

Options:
  --help     Show help                                                 [boolean]
  --version  Show version number                                       [boolean]

Configuring Apprise notifications

Apprise is software for sending notifications. It supports many services.

Running

The easiest way to run the watcher together with Apprise is to use the Docker Compose setup, specified below.

Configuration

  1. Find your notification service and read the Apprise documentation for that service.
  2. Follow any prerequisite steps as specified in the documentation.
  3. Create an 'url' in the format specified in the documentation.
  4. Add the url to the "apprise.services" section and specify the 'format'.

Configuring the interactive Telegram bot

  1. Open a Telegram chat with BotFather.
  2. Follow the instructions to create your own bot.
  3. Copy the token and enter it in the configuration via toogoodtogo-watcher config, and set enabled to true.
  4. Start the application toogoodtogo-watcher watch
  5. Click the t.me/BOTNAME link from the BotFather chat message.
  6. Press BEGIN.
  7. Your bot should greet you, and show a notification about your favorites. Note: the bot will show the favorites which you configured. Multiple people can connect to the bot to get updates about these favorites.

Displaying the notifications in the Windows notification center

By default Windows doesn't display the notifications in the notification center. You can enable this by doing the following steps.

  1. Go to 'notifications & actions settings' (Windows key, type 'notifications', enter)
  2. Click on the 'toast' app at the bottom of the screen.
  3. Enable the 'show in action center' checkbox.

Docker

Note: the Docker image is a multiarch image. So it will also work on Raspberry Pi's.

Docker run

  1. Create a directory to store the config file and copy the config.defaults.json into YOUR_FOLDER/config.json. See above for instructions on how to configure the application. Make sure that the folder has the correct permissions, e.g. run chmod -R o+rwx config/ or you might get access denied errors on the file system. The app needs read/write access on the configuration file, e.g. to store token received in it.
  2. Run the following command to login, using the configured email address. Example: a user john who stored the config in ~/toogoodtogo-watcher/config.json:
docker run \
 -i \
 --name toogoodtogo-watcher \
 --rm \
 -v ~/toogoodtogo-watcher:/home/node/.config/toogoodtogo-watcher-nodejs \
 marklagendijk/toogoodtogo-watcher login --email [email protected]
  1. Run the following command to start watching.
docker run \
 --name toogoodtogo-watcher \
 --rm \
 -e TZ=Europe/Amsterdam \
 -v ~/toogoodtogo-watcher:/home/node/.config/toogoodtogo-watcher-nodejs \
 marklagendijk/toogoodtogo-watcher watch

Docker Compose

  1. Create the following directory structure.
    my-docker-compose-stuff
    │   docker-compose.yaml
    │
    └───toogoodtogo-watcher
        │   config.json
    
  2. Copy the config.defaults.json to toogoodtogo-watcher/config.json. See above for instructions on how to configure the application.
  3. Use the command as explained under 'Docker run' above to login using the configured email address.
  4. Create a file docker-compose.yaml
    version: "3"
    services:
      toogoodtogo-watcher:
        image: marklagendijk/toogoodtogo-watcher
        restart: unless-stopped
        environment:
          - TZ=Europe/Amsterdam
        volumes:
          - ./toogoodtogo-watcher:/home/node/.config/toogoodtogo-watcher-nodejs
      
      # This will make Apprise reachable on apprise:8080 for the other Docker Compose containers
      apprise:
        image: caronc/apprise:latest
      # Enable these to make Apprise reachable from outside Docker
      # ports: 
      #   - "8080:8080"

More Repositories

1

ui-router.stateHelper

A helper module for AngularUI Router, which allows you to define your states as an object tree.
JavaScript
235
star
2

lodash-deep

Lodash mixins for (deep) object accessing / manipulation.
JavaScript
222
star
3

node-pm2-windows-startup

Utility to make PM2 automatically resurrect on Windows startup
JavaScript
218
star
4

angular-recursion

A service which makes it easy possible to have recursive Angular directives.
JavaScript
176
star
5

WinLess

An awesome Windows GUI for less.js
C#
132
star
6

gulp-ng-html2js

Gulp plugin for compiling the HTML files of your Angular app to Javascript.
JavaScript
112
star
7

node-start-on-windows-boot

Simple utility to enable / disable starting a program on Windows boot, by modifiying the right registry values.
JavaScript
60
star
8

jquery.tabbable

Simple utility for selecting the next / previous ':tabbable' element.
JavaScript
47
star
9

obs-scene-execute-command-script

OBS script for executing any CLI command whenever whenever a scene is activated
Lua
28
star
10

node-transip-dns-cli

Node.js cli tool for updating TransIP DNS entries, including DDNS. Docker image available.
JavaScript
21
star
11

node-onvif-ptz-cli

Node.js cli tool for controlling PTZ cameras via the ONVIF protocol. Docker image available.
JavaScript
19
star
12

angular-class

An angular service for creating classes
JavaScript
16
star
13

docker-compose-homeassistant

Docker Compose example repository based on my home server setup, which runs on a Raspberry Pi.
Shell
9
star
14

mediawiki-dia

A MediaWiki extension which renders .dia files as .svg.
PHP
2
star
15

node-ibood-watcher

Node script to check ibood.com for new products during a 'hunt'.
JavaScript
1
star
16

angular-material-multi-level-sidenav-examle

Created with StackBlitz ⚡️
TypeScript
1
star
17

meat-fan

BBQ Fan Controller design with ESPHome firmware
1
star
18

webdriverio-wait-and

JavaScript
1
star
19

marklagendijk.nl

My personal website
TypeScript
1
star
20

node-istock-balance-scraper

Scrapes your current balance from you iStock account
JavaScript
1
star