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 useful to someone else.


Note

The DataDome anti-bot cookie handling in this project is based on the work done in Der-Henning/tgtg.

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 accessToken and refreshToken if you already have it).
{
  "accounts": [
    {
      "email": "Too Good To Go email",
      "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
  • notifySelf? : boolean = false
    • Optional setting it to false will prevent your devices from generating a notification when you send a message yourself.

Tested with signal-cli-rest-api but python-signal-cli-rest-api will work too.

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)
NOTICA
  • type : string = notica
  • apiUrl : string = https://notica.us
  • room : string = ?abc123

Global configuration details

Configuration can be provided via:

  1. Environment variables (highest priority)
  2. config.json
Name Env Variable Default Description
timezone TGTG_TIMEZONE UTC The time zone to use as UTC offsets
locale TGTG_LOCALE en-US Used to format dates and numbers in a form that's conventional for a specific language and region
language.available TGTG_STOCK Available Translation for 'Available'
language.price TGTG_PRICE Price Translation for 'Price'
cronSchedule TGTG_CRON_SCHEDULE * * * * * Pattern used to specify monitoring execution
sendStartNotification TGTG_SEND_START_NOTIFICATION true Send a start notification when app starts monitoring an account
testNotifiers TGTG_TEST_NOTIFIERS false Send a test notification with a fake item for all configured accounts then exit process
logLevel TGTG_LOG_LEVEL info Log only if level is less than or equal to this level
port TGTG_PORT 3000 Port used by the HTTP server to prompt the PIN code
host TGTG_HOST localhost Hostname displayed in logs for the HTTP server URL

Run

First you need to install Node.js 22.14.0 or higher

npm install
npm run build
npm run start

First login — PIN code

If you don't set accessToken and refreshToken, Too Good To Go will send you an email containing a PIN code.

Important

Do not click the login link in the email — use the PIN code instead.
The magic link in the email only works on mobile.

Enter the PIN code when prompted, a small HTTP server starts automatically. Check the logs for a line like:

Enter your PIN here → http://localhost:3000

Open that URL in your browser, paste the PIN, and click OK. The container will then complete the login and start monitoring.

Once logged in, the accessToken and refreshToken are saved automatically. You can copy them into config.json to skip the login step on future restarts.

After that, tgtg-notifier starts monitoring your favorite stores and sends you a notification whenever stock becomes available.

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 .
docker run --name tgtg-notifier -d \
  -p 3000:3000 \
  -v ./config.json:/usr/app/config.json \
  -v ./logs/:/usr/app/logs \
  tgtg-notifier

Make sure port 3000 is exposed.

You can also customize the port via the PORT environment variable or config.json.

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

docker-compose up -d

Running with Podman Quadlet

You will need to create two configuration files in your Systemd user directory : ~/.config/containers/systemd/

1. Container File: tgtg-notifier.container

[Unit]
Description=TGTG Notifier

Requires=tgtg-notifier.build
After=tgtg-notifier.build

[Container]
ContainerName=tgtg-notifier
Image=tgtg-notifier.build

PublishPort=3000:3000

Volume=%h/tgtg-notifier/config.json:/usr/app/config.json:ro

[Service]
Restart=always
RestartSec=30

[Install]
WantedBy=default.target

2. Image Build File: tgtg-notifier.build

[Build]
ImageTag=localhost/tgtg-notifier:latest
SetWorkingDirectory=https://github.com/Nyrrell/tgtg-notifier.git

Finally, reload Systemd and start the container:

systemctl --user daemon-reload
systemctl --user start tgtg-notifier.service

Notification examples

DISCORD

notif

GOTIFY

notif

NTFY

notif

SIGNAL-CLI-REST-API

notif

TELEGRAM

notif

NOTICA

notif

About

Too Good To Go - Notifier: Sends available item notifications to Discord, Signal, Telegram, Ntfy, Gotify or Notica.

Topics

Resources

Stars

Watchers

Forks

Contributors