https://github.com/devfle/in-stock-check
Helps you to search for specific DOM elements on web pages and then send a notification to your own Discord server
https://github.com/devfle/in-stock-check
discord discord-bot docker nodejs notification-service shopping typescript
Last synced: 6 months ago
JSON representation
Helps you to search for specific DOM elements on web pages and then send a notification to your own Discord server
- Host: GitHub
- URL: https://github.com/devfle/in-stock-check
- Owner: devfle
- License: mit
- Created: 2022-06-30T16:59:08.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-27T21:49:22.000Z (about 1 year ago)
- Last Synced: 2025-04-09T23:13:07.785Z (6 months ago)
- Topics: discord, discord-bot, docker, nodejs, notification-service, shopping, typescript
- Language: TypeScript
- Homepage:
- Size: 271 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# In Stock Check
Welcome to the Stock Check tool. This tool allows you to search for specific DOM elements on web pages and then send a notification to your own Discord server.
The tool was originally built to send a notification when a certain product is back in stock in a store.
## How to setup
1. Clone the repo
2. `run npm ci` with node 18.X (if you have installed nvm, run "nvm use")
3. create a `.env` file in project root
4. create a `shop-list.json` file in /src folder
5. build the project with `npm run build`command### .env file
To protect sensitive information like API keys the project uses env files.
```text
DISCORD_API_KEY="YOUR DISCORD BOT API KEY"
CHANNEL_ID="THE ID OF THE DISCORD CHANNEL WHERE YOU WANT TO BECOME THE NOTIFICATION"
LOGIN_MSG="OPTIONAL: A CUSTOM LOGIN MESSAGE"
```### shop-list.json
All metadata for the web pages that are to be analyzed are listed here.
```json
[
{
"shopName": "NAME OF THE WEBSITE",
"productEndpoint": "URL TO THE WEBSITE",
"searchQuery": "THE SELECTOR YOU WANT TO SEARCH",
"showProductLink": false
}
]
```Multiple web pages can also be configured:
```json
[
{
"shopName": "NAME OF THE WEBSITE",
"productEndpoint": "URL TO THE WEBSITE",
"searchQuery": "THE SELECTOR YOU WANT TO SEARCH",
"showProductLink": false
},
{
"shopName": "NAME OF THE WEBSITE",
"productEndpoint": "URL TO THE WEBSITE",
"searchQuery": "THE SELECTOR YOU WANT TO SEARCH",
"showProductLink": false
}
]
```## Docker
The NodeJs script can also run in a Docker environment:
1. Navigate into project dir
```bash
cd in-stock-check
```2. Compile the script:
```bash
npm run build
```3. Create .env file with necessary data and pass it as a secret:
```bash
docker build -t "in-stock-check" --secret id=in-stock-env,src=.env .
```## Contributing
Please follow the Prettier, ESLint and TypeScript rules included in this project.
You can check your code with the following commands:Run ESLint:
```bash
npm run lint
```Run Prettier:
```bash
npm run prettier
```Compile TypeScript:
```bash
npm run build
```While commiting, please use one of the following types:
```javascript
['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test']
```Example:
```bash
git commit -m "chore: update packages"
```