https://github.com/qiwi/watch_bot
a bot that watches the API method and sends messages to the Telegram if the data has changed
https://github.com/qiwi/watch_bot
Last synced: 5 days ago
JSON representation
a bot that watches the API method and sends messages to the Telegram if the data has changed
- Host: GitHub
- URL: https://github.com/qiwi/watch_bot
- Owner: qiwi
- License: mit
- Created: 2017-07-10T18:11:10.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-02-14T15:49:32.000Z (about 6 years ago)
- Last Synced: 2025-04-05T01:51:14.155Z (27 days ago)
- Language: TypeScript
- Size: 238 KB
- Stars: 5
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# watch_bot
Telegram bot that can eventually fetch data from user endpoint and send info about fetched data.## Bot commands

### /auth \
Gives access to non-public commands (such as ``/start``).### /start \
Starts eventually sending GET requests to , processing response and printing info to subscribed user.
Requests will include Authorization header (see config structure for credentials).Response structure should be like:
```
{
"result": {
"message": "Your message",
"entities": [
{
"meta": {
"key": "value",
"anotherKey": 123
}
},
...
]
}
```### /check \
Sends 1 GET request to provided , processing response and printing info to subscribed user.
Request will include Authorization header.
### /stop
Stops sending requests.## Usage
1. Clone this repo.
```
git clone [email protected]:qiwi/watch_bot.git
```
2. Make your own config in ``config/default.json`` or ``config/default.js`````
{
"general": {
"defaultCronTime": "*/10 * * * * *", // polling cron time
"botTGToken": "*", // bot telegram token - talk to @BotFather at telegram to get it
"numVerboseErrors": 20 // bot will stop printing error message after numVerboseErrors errors in fetching data
"defaultWatchUrl": "https://test" // default watch url for /start and /check commands
},
"auth": {
"method": "JWT", // Authorization header value:
"token": "*" // Authorization header value:
},
"logger": {
"logLevel": "debug"
},
"botAuth": {
"token": "SomeTest" // see /auth command,
"allowedChats": [1111, 2222] // whitelisted chats list (optional)
},
"backupFolder": "./" // folder for backuping active chats data
}
```3. ``npm install``
4. ``npm run build``
5. ``node app``
## Docker
TODO