local-notifier is a simple library which can be hosted in docker to notify you via telegram when something appears/disappears from the page (local in your network or world wide web).
- Clone the repository
git clone [email protected]:armata007/local-notifier.git
- cd into the repository
cd local-notifier
- Copy
.env.example
file to.env
cp .env.example .env
- Change values in
.env
TELEGRAM_TOKEN
- Create a bot at @botfather in Telegram with/newbot
command and put generated token hereTELEGRAM_USER_ID
- This is your user id in telegramTIMEZONE
- set to your timezoneALL_GOOD_CRON_TIME
- crontab string which sends telegram messageAll good - local notifier is working in background
. If you want it disabled set it to empty string, for exampleALL_GOOD_CRON_TIME=""
.
- Copy
config.ts.example
toconfig.ts
cp config.ts.example config.ts
- Change values in
config.ts
. Config is an array of items. Each item consists of:name
- name which will be used in notificationurl
- url which should be checkedcronTime
- crontab string (how often you want this check to run)type
- eitherregexp
orjson
regexps
- iftype
isregexp
- array of items to check against page. Each item consists of:regexp
- regexp which will trigger Telegram message. If regexp find something it is considered an error.message
- user friendly message which will be sent to Telegram
jsonProperties
- iftype
isjson
- array of tests for json propertiesproperty
- name of json propertymessage
- message which will be sent when check failsvalue
- value for which the value of json property should be tested- String type - it will compare strings
type: "string"
value: "test"
- string which should be compared to property
- Boolean type - it will compare property to boolean value
type: "boolean"
value: true
- it will check if property is true
- Number type - it will compare property to number
type: "number"
value: 5
modifier: "greaterthan"
- it can albo belesserthan
orequals
. It will check if property is greater than 5.
- Regexp type - it will compare property to regexp
type: "regexp"
value: new RegExp(/error/)
- regexp which will be run on property.
- String type - it will compare strings
To start this run:
docker-compose up --build