npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

toogoodtogo-watcher

v4.0.4

Published

Node.js cli tool for monitoring your favorite TooGoodToGo businesses.

Downloads

63

Readme

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"