Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Der-Henning
GitHub Repository: Der-Henning/tgtg
Path: blob/main/wiki/Configuration.md
725 views

Basic configuration

The only required option is the Email aka Username to your TGTG account.

A minimalistic configuration could look like this:

[TGTG] Username = my_mail@example.com

This config will start the scanner and lead you through the login process. After the successful login, you will see changes in the available amounts of your favorite magic bags in the console window.

Variables

Some of the following options allow the inclusion of special variables that contain item (magic bag) information.

Example to include the display name of the item: ${{display_name}}

Variables with the locale property are affected by the locale option and returned in the given language.

variabledescriptionexamplelocale
item_idunique identifier of the item774625
items_availablenumber of available items2
display_namename of the item as in the APPChutney Indian Food - Hamburg – Europapassage 2.OG
descriptionitem descriptionRette eine Magic Bag mit leckerem indischen Essen.
priceitem price3.20
valueitem value9.60
currencyprice/value currencyEUR
pickupdateformatted stringtomorrow, 18:00 - 21:50YES
favoriteis favoriteYES or NO
ratingoverall rating3.3
buffetis buffetYES or NO
item_categoryMEAL
item_name
packaging_optionBAG_ALLOWED
pickup_locationBallindamm 40, 20095 Hamburg, Deutschland
store_nameChutney Indian Food
item_logoitem logo urlhttps://tgtg-mkt-cms-prod.s3.eu-west-1.amazonaws.com/13512/TGTG_Icon_White_Cirle_1988x1988px_RGB.png
item_coveritem cover urlhttps://images.tgtg.ninja/standard_images/GENERAL/other1.jpg
scanned_ontimestamp when the item was scanned2023-02-14 20:43:21
item_logo_bytesitem logo as data blob
item_cover_bytesitem cover as data blob
linkurl of the itemhttps://share.toogoodtogo.com/item/774625
distance_walkingwalking distance from home5.9 kmYES
distance_drivingdriving distance from home8 kmYES
distance_transittransit distance from home8 kmYES
distance_bikingbiking distance from home6.1 kmYES
duration_walkingwalking duration from home1 hourYES
duration_drivingdriving duration from home20 minutesYES
duration_transittransit duration from home45 minutesYES
duration_bikingbiking duration from home30 minutesYES

Cron Scheduler

For formatting support see: https://crontab.guru/#*_12-14_*_*_1-5

You can combine multiple crons as semicolon separated list.

Available options

[MAIN] / general settings

config.inienvironmentdescriptiondefault
DebugDEBUGenable debugging modefalse
SleepTimeSLEEP_TIMEtime between two consecutive scans in seconds60
ScheduleCronSCHEDULE_CRONrun only on schedule* * * * *
ItemIDsITEM_IDSDepreciated! comma-separated list of additional (none favorite) items to scan
MetricsMETRICSenable Prometheus metrics HTTP serverfalse
MetricsPortMETRICS_PORTport for metrics server8000
DisableTestsDISABLE_TESTSdisable test notifications on startupfalse
QuietQUIETminimal console outputfalse
LocaleLOCALElocalizationen_US
ActivityACTIVITYshow running indicator (always disabled in docker)true
TZtimezone for docker based setups, e.g. Berlin/Europe
UIDset user id for docker container1000
GIDset group id for docker container1000

[TGTG] / TGTG account

config.inienvironmentdescriptiondefaultrequired
UsernameTGTG_USERNAMEemail connected to your TGTG AccountYES
AccessTokenTGTG_ACCESS_TOKENTGTG API access token
RefreshTokenTGTG_REFRESH_TOKENTGTG API refresh token
DatadomeTGTG_DATADOMETGTG API datadome protection cookie
TimeoutTGTG_TIMEOUTtimeout for API requests60
AccessTokenLifetimeTGTG_ACCESS_TOKEN_LIFETIMEaccess token lifetime in seconds14400
MaxPollingTriesTGTG_MAX_POLLING_TRIESmax polling retries during login24
PollingWaitTimeTGTG_POLLING_WAIT_TIMEtime between polling retries in seconds5

[LOCATION] / Location settings

config.inienvironmentdescriptiondefaultrequired if enabledvariables
EnabledLOCATIONenable location servicefalse
GoogleMapsAPIKeyLOCATION_GOOGLE_MAPS_API_KEYAPI key for google maps serviceYES
OriginAddressLOCATION_ORIGIN_ADDRESSorigin for distance calculation, e.g. your home addressYES

[CONSOLE] / Console Notifier

config.inienvironmentdescriptiondefaultrequired if enabledvariables
EnabledCONSOLEenable console notificationsfalse
BodyCONSOLE_BODYmessage body${{scanned_on}} ${{display_name}} - new amount: ${{items_available}}YES
CronCONSOLE_CRONenable notification only on schedule* * * * *

[SMTP] / SMTP Notifier

config.inienvironmentdescriptiondefaultrequired if enabledvariables
EnabledSMTPenable SMTP notificationsfalse
HostSMTP_HOSTSMTP server hostsmtp.gmail.com
PortSMTP_PORTSMTP server port587
TLSSMTP_TLSenable TLStrue
SSLSMTP_SSLenable SSLfalse
TimeoutSMTP_TIMEOUTset timeout in seconds60
UsernameSMTP_USERNAMElogin username
PasswordSMTP_PASSWORDlogin password
SenderSMTP_SENDERemail sender
RecipientsSMTP_RECIPIENTSemail recipientsYES
RecipientsPerItemSMTP_RECIPIENTS_PER_ITEMemail recipients per item as JSON {"ItemId_1": ["[email protected]", ...], ...}
SubjectSMTP_SUBJECTemail subjectNew Magic BagsYES
BodySMTP_BODYemail html body<b>${{display_name}}</b> </br> New Amount: ${{items_available}}YES
CronSMTP_CRONenable notification only on schedule* * * * *

[PUSHSAFER] / Pushsafer Notifier

config.inienvironmentdescriptiondefaultrequired if enabledvariables
EnabledPUSHSAFERenable Pushsafer notificationsfalse
KeyPUSHSAFER_KEYPushsafer API keyYES
DeviceIDsPUSHSAFER_DEVICE_IDSPushsafer device IDs, comma seperated list for multiple IDsYES
CronPUSHSAFER_CRONenable notification only on schedule* * * * *

[IFTTT] / IFTTT Notifier

config.inienvironmentdescriptiondefaultrequired if enabledvariables
EnabledIFTTTenable IFTTT notificationsfalse
EventIFTTT_EVENTIFTTT webhook eventYES
KeyIFTTT_KEYIFTTT webhook keyYES
BodyIFTTT_BODYJSON message body{"value1": "${{display_name}}", "value2": ${{items_available}}, "value3": "${{link}}"}YES
TimeoutIFTTT_TIMEOUTtimeout for API requests60
CronIFTTT_CRONenable notification only on schedule* * * * *

[TELEGRAM] / Telegram Notifier

config.inienvironmentdescriptiondefaultrequired if enabledvariables
EnabledTELEGRAMenable Telegram notificationsfalse
TokenTELEGRAM_TOKENTelegram Bot tokenYES
ChatIDsTELEGRAM_CHAT_IDScomma-separated list of chat ids
BodyTELEGRAM_BODYmessage body*${{display_name}}* \n*Available*: ${{items_available}}\n*Price*: ${{price}} ${{currency}}\n*Pickup*: ${{pickupdate}}YES
DisableCommandsTELEGRAM_DISABLE_COMMANDSdisable bot commandsfalse
OnlyReservationsTELEGRAM_ONLY_RESERVATIONSonly send notifications for reservationsfalse
TimeoutTELEGRAM_TIMEOUTtimeout for telegram API requests60
CronTELEGRAM_CRONenable notification only on schedule* * * * *

Note on Markdown V2

As of Version 1.17.0 the Telegram Notifier uses the Markdown V2 parser of the Telegram API. This requires all special markdown characters, that should not be parsed as markdown commands, to be escaped with a preceding \. The special characters are _, *, [, ], (, ), ~, `, >, #, +, -, =, |, {, }, . and !.

[APPRISE] / Apprise Notifier

For details on the service URL configuration see https://github.com/caronc/apprise.

config.inienvironmentdescriptiondefaultrequired if enabledvariables
EnabledAPPRISEenable Apprise notificationsfalse
URLAPPRISE_URLService URLYES
TitleAPPRISE_TITLENotification titleNew Magic BagsYES
BodyAPPRISE_BODYNotification body${{display_name}} - new amount: ${{items_available}} - ${{link}}YES
CronAPPRISE_CRONenable notification only on schedule* * * * *

[NTFY] / Ntfy Notifier

config.inienvironmentdescriptiondefaultrequired if enabledvariables
EnabledNTFYenable Ntfy notificationsfalse
ServerNTFY_SERVERNtfy server URLhttps://ntfy.shYES
TopicNTFY_TOPICNtfy topicYES
TitleNTFY_TITLENotification titleNew TGTG itemsYES
MessageNTFY_MESSAGENotification message${{display_name}} - New Amount: ${{items_available}} - ${{itelinkm_id}}YES
PriorityNTFY_PRIORITYdefault
TagsNTFY_TAGScomma-separated list of tagsshopping,tgtgYES
ClickNTFY_CLICKURL to open on click${{link}}YES
UsernameNTFY_USERNAMEauth username
PasswordNTFY_PASSWORDauth password
TokenNTFY_TOKENauth token, only used if username and password are empty
TimeoutNTFY_TIMEOUTtimeout for Ntfy requests60
CronNTFY_CRONenable notification only on schedule* * * * *

[WEBHOOK] / Webhook Notifier

config.inienvironmentdescriptiondefaultrequired if enabledvariables
EnabledWEBHOOKenable Webhook notificationsfalse
URLWEBHOOK_URLwebhook endpointYES
MethodWEBHOOK_METHODrequest methodPOST
BodyWEBHOOK_BODYrequest body''YES
TypeWEBHOOK_TYPErequest content typetext/plain
HeadersWEBHOOK_HEADERSadditional request headers as JSON{}
UsernameWEBHOOK_USERNAMEbasic authentication username
PasswordWEBHOOK_PASSWORDbasic authentication password
TimeoutWEBHOOK_TIMEOUTrequest timeout60
CronWEBHOOK_CRONenable notification only on schedule* * * * *

[DISCORD] / Discord Notifier

config.inienvironmentdescriptiondefaultrequired if enabledvariables
EnabledDISCORDenable Discord notificationsfalse
PrefixDISCORD_PREFIXPrefix, that bot should react to!
TokenDISCORD_TOKENauth tokenYES
ChannelDISCORD_CHANNELenable Discord notifications
BodyDISCORD_BODYNotification body*${{display_name}}*\n*Available*: ${{items_available}}\n*Price*: ${{price}} ${{currency}}\n*Pickup*: ${{pickupdate}}YES
DisableCommandsDISCORD_DISABLE_COMMANDSdisable bot commandsfalse
CronDISCORD_CRONenable notification only on schedule* * * * *

Setting up a Discord Bot

Register an application and associated bot user for use with TGTG scanner at https://discord.com/developers/applications. For details on how to set up see https://realpython.com/how-to-make-a-discord-bot-python/#how-to-make-a-discord-bot-in-the-developer-portal. The bot will send notifications to a specific channel. To obtain the channel ID, see https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID.