Skip to content

Nyrrell/tgtg-notifier

Repository files navigation

icon Too Good To Go - Notifier

Too Good To Go - Notifier monitors your favorite TGTG Store for newly available items.
Supports multiple accounts and notifiers type (new type of notifiers will be added later).
I made it for my personal use only, but it may also be usefully to someone else.

Install

git clone https://github.com/Nyrrell/tgtg-notifier.git
cd tgtg-notifier

Configure

To run this project, you will need to create a config.json file, see below or use example.config.json to set your configuration.

  • Set global parameters if needed timezone (default: UTC), locale (default: en-US)
  • To improve i18n, you can set available & price for translate in your language, it's totally optional.
  • For each account, be sure to fill these fields notifiers and email (optionally userId, accessToken and refreshToken if you already have it).
{
  "accounts": [
    {
      "email": "Too Good To Go email",
      "userId": "Too Good To Go User ID goes here if you have it",
      "accessToken": "Too Good To Go Access Token goes here if you have it",
      "refreshToken": "Too Good To Go Refresh Token goes here if you have it",
      "notifiers": [
        {
          "type": "discord",
          "webhookUrl": "https://discord.com/api/webhooks/123456789/ABCDEFG123456789"
        },
        {
          "type": "gotify",
          "apiUrl": "https://gotify.net",
          "token": "RFRNGDQmCgboyVF"
        }
      ]
    }
  ],
  "timezone": "Europe/Paris",
  "locale": "fr-FR",
  "language": {
    "available": "Disponible",
    "price": "Prix"
  },
  "cronSchedule": "*/5 6-22 * * *",
  "sendStartNotification": true,
  "testNotifiers": false,
  "logLevel": "info"
}

Available notifiers configuration

Tip

In global configuration you can set testNotifiers to true, the process will send test notifications with a fake item for all configured accounts then exit process.

DISCORD
  • type : string = discord
  • webhookUrl : string = https://discord.com/api/webhooks/123456789/ABCDEFG123456789
GOTIFY
  • type : string = gotify
  • apiUrl : string = https://gotify.net
  • token : string = RFRNGDQmCgboyVF
    • On the Gotify web UI, Apps > Create Application > reveal the token
  • priority? : number = 10
    • The priority level sent with the message (Default 5)
NTFY
  • type : string = ntfy
  • apiUrl : string = https://ntfy.sh
  • topic : string = tgtg
  • token? : string = tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2
  • priority? : number = 5
    • The priority level sent with the message, range 1 - 5 (Default 3)
SIGNAL-CLI-REST-API
  • type : string = signal
  • apiUrl : string = http://127.0.0.1:8080
  • number : string = +431212131491291
    • Registered Phone Number
  • recipients : array<string> = ["group.ckRzaEd4VmRzNnJaASAEsasa", "+4912812812121"]
    • Accept group-id and phone number

Tested with signal-cli-rest-api but python-signal-cli-rest-api will work too, project documentation say :
It is quite similar to bbernhard/signal-cli-rest-api, [...] i’m tempted to mimic bbernhard’s API routes as close as possible.

TELEGRAM
  • type : string = telegram
  • apiUrl? : string = https://api.telegram.org
    • Just in case url api is moved (optional)
  • token : string = 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw
  • chatId : string | number = -100123456789
    • Unique identifier for the target chat or username of the target channel
  • messageThreadId? : number = 6
    • Unique identifier for the target message thread (topic) of the forum (optional)

Global configuration details

Name Default Description
timezone UTC The time zone to use as UTC offsets
locale en-US Used to format dates and numbers in a form that's conventional for a specific language and region
language.available Available Translate 'Available' in your language
language.price Price Translate 'Price' in your language
cronSchedule * * * * * Pattern used to specify monitoring execution
sendStartNotification true Send a start notification when app start to monitor an account
testNotifiers false Send a test notification with a fake item for all configured accounts then exit process
logLevel info Log only if level is less than or equal to this level

Run

First you need to install Node.js 18.17 or higher

npm install
npm run build
npm run start

If you don't set userId, accessToken and refreshToken You should receive an email from Too Good To Go.
You must validate the login by clicking the link inside this email within 2 minute (Do not use your phone if Too Good To Go app is installed).

After that tgtg-notifier start to monitor your favorite stores (once per minute) and send you a notification when a store's stock is add.

Run with docker

A Dockerfile is available in the repository to build a ready-to-run Docker image.
You need to map the volumes to use your config.json file and a folder for the application's logs.

docker build -t tgtg-notifier-app .
docker run --name tgtg-notifier-app -d -v ./config.json:/usr/app/config.json -v ./logs/:/usr/app/logs tgtg-notifier-app

If you prefer to use Docker Compose, a docker-compose.yml configuration file is also available.

docker-compose up -d

Notification example

DISCORD

notif

GOTIFY

notif

NTFY

notif

SIGNAL-CLI-REST-API

notif

TELEGRAM

notif