Skip to content

Commit 8826150

Browse files
committed
Merge branch 'sms' into main
2 parents 3202e40 + 7dbf21f commit 8826150

File tree

13 files changed

+2343
-98
lines changed

13 files changed

+2343
-98
lines changed

README.md

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

2-
### New in v2.0: :email: E-mail notification support and an user interface :iphone: !! (see [screenshots](#Screenshots))
2+
### New in v3.0: SMS / Text notification support :iphone: !! (see [SMS](#SMS))
3+
4+
#### New in v2.0: :email: E-mail notification support and an user interface :computer: (see [screenshots](#Screenshots))
35

46
# StockAlertBot
57
Faced with the scenario of scalpers using bots to hog up all the inventory of popular holiday toys and sell them at ridiculously high markup prices, I decided to put up a fight so we can get our hands on things we ~~want~~ need to survive the #Coronavirus quarantine(s).
@@ -16,7 +18,7 @@ Donate, buy me a <a href="https://buymeacoff.ee/PrinceSingh" target="_blank">Piz
1618

1719
### How does it work?
1820

19-
Enter links of the products you want tracked and how often you want the program to check if those products are in stock. When an item becomes available, you may configure it to notify you through variety of alerts including sound, email, discord and slack notifications, text on console, automatically opening the URL in your browser, and more to come.
21+
Enter links of the products you want tracked and how often you want the program to check if those products are in stock. When an item becomes available, you may configure it to notify you through variety of alerts including sound, email, discord and slack notifications, SMS / Text, console, automatically opening the URL in your browser, and more to come.
2022
<br><br>
2123

2224
### What stores/websites are supported?
@@ -63,7 +65,8 @@ There are only two steps to use this program: 1) enter information and 2) launch
6365
- If you have Target link(s), you will see additional options to put zip code and API Key. Only change the key if you get API key errors. Refer to the instructions in the following [section](#Via-Text-Editor).
6466
4. Configure notification options in Optional tab.
6567
- If you want notifications sent to Discord or Slack, expand WEBHOOKS and enter the URL(s) there.
66-
- If you want notifications sent to Email, turn on email and enter your service provider information. Some providers (Yahoo, AOL, AT&T) cause problems. Refer to following [section](#Via-Text-Editor).
68+
- If you want notification sent via SMS/Text, expand SMS and choose a method: Amazon Web Services, Email, or Twilio. See [SMS](#SMS).
69+
- If you want notifications sent to Email, turn on email and enter your service provider information. Some providers (Yahoo, AOL, AT&T) cause problems. Refer to this [section](#Email).
6770
5. Once you're happy with the settings, click `Save Settings`.\
6871
`config.json` and `.env` files should now reflect your settings.\
6972
You can use `CTRL + C` or `CMD + C` to stop the program.<br><br>
@@ -87,22 +90,62 @@ There are only two steps to use this program: 1) enter information and 2) launch
8790
4. Paste it to `TARGET_KEY`
8891
3. **If** you want to send alerts to webhook URL(s) like [Discord](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) or [Slack](https://api.slack.com/messaging/webhooks), add them to `WEBHOOK_URLS` array.
8992
4. **If** you want to use Proxies, change `PROXIES` to `true` and create a file called `proxies.txt` in the root directory and fill it with one proxy per line. See [proxies](#Proxies).
90-
5. **If** you want to send alerts to email, change `EMAIL` in `config.json` to `true`. Make a copy of `example.env` and rename it to `.env`. Inside `.env`, type out one of the following service providers (`EMAIL_SERVICE`), your email (`EMAIL_FROM`) and password (`EMAIL_PASS`) and the email you want alerts sent to (`EMAIL_TO`). All without quotes.
91-
```
92-
Gmail, Yahoo, iCloud, Hotmail, Outlook365, QQ, 126, 163, 1und1, AOL, DebugMail, DynectEmail,
93-
FastMail, GandiMail, Godaddy, GodaddyAsia, GodaddyEurope, hot.ee, mail.ee, Mail.ru, Maildev, Mailgun, Mailjet,
94-
Mailosaur, Mandrill, Naver, OpenMailBox, Postmark, QQex, SendCloud, SendGrid, SendinBlue, SendPulse, SES,
95-
SES-US-EAST-1, SES-US-WEST-2, SES-EU-WEST-1, Sparkpost, Yandex, Zoho, qiye.aliyun
96-
```
97-
**NOTE:** If you receive the error: `535 5.7.0 (#AUTH005) Too many bad auth attempts`, most likely you are using Yahoo for the email server or an email server managed by Yahoo, such as AOL or AT&T. Yahoo has implemented an option that by default, does not let 3rd party products access the email servers. To resolve, go to https://login.yahoo.com/account/security and then enable the option to allow apps that use less secure sign in. Use the password generated by "Generate app password". If you are using AOL, do the same thing, from https://login.aol.com/account/security.
98-
93+
5. **If** you want to send alerts to SMS, change `SMS_METHOD` to either "Email", "Amazon Web Services", or "Twilio". Then change the associated values in `.env`. See [SMS](#SMS).
94+
6. **If** you want to send alerts to email, change `EMAIL` in `config.json` to `true`. Make a copy of `example.env` and rename it to `.env`. Inside `.env`, type out one of the service providers (`EMAIL_SERVICE`) listed in [Email](#Email), your email (`EMAIL_FROM`) and password (`EMAIL_PASS`) and the email you want alerts sent to (`EMAIL_TO`). All without quotes.
95+
9996
2. Execute and continue about your day:
10097
`npm start` OR `node --experimental-modules main.js`\
10198
You can use `CTRL + C` or `CMD + C` to stop the program.
10299

103100
3. Consider [donating](https://www.paypal.com/donate?business=3Y9NEYR4TURT8&item_name=Making+software+and+hacking+the+world%21+%E2%99%A5&currency_code=USD) or buying me a [Pizza](https://buymeacoff.ee/PrinceSingh) or [PayPal](https://paypal.me/PrinceSingh25) me :smile:
101+
<br><br>
102+
103+
104+
### Email
105+
Supported email providers:
106+
```
107+
Gmail, Yahoo, iCloud, Hotmail, Outlook365, QQ, 126, 163, 1und1, AOL, DebugMail, DynectEmail,
108+
FastMail, GandiMail, Godaddy, GodaddyAsia, GodaddyEurope, hot.ee, mail.ee, Mail.ru, Maildev, Mailgun, Mailjet,
109+
Mailosaur, Mandrill, Naver, OpenMailBox, Postmark, QQex, SendCloud, SendGrid, SendinBlue, SendPulse, SES,
110+
SES-US-EAST-1, SES-US-WEST-2, SES-EU-WEST-1, Sparkpost, Yandex, Zoho, qiye.aliyun
111+
```
112+
113+
**NOTE:** If you receive the error: `535 5.7.0 (#AUTH005) Too many bad auth attempts`, most likely you are using Yahoo for the email server or an email server managed by Yahoo, such as AOL or AT&T. Yahoo has implemented an option that by default, does not let 3rd party products access the email servers. To resolve, go to https://login.yahoo.com/account/security and then enable the option to allow apps that use less secure sign in. Use the password generated by "Generate app password". If you are using AOL, do the same thing, from https://login.aol.com/account/security.
114+
<br><br>
115+
116+
117+
### SMS
118+
SMS / Text support is now available via Amazon Web Services, Email, or Twilio. This, however, requires some setup on your part. Read below regarding setup for each method:
119+
120+
- **[Amazon Web Services](https://aws.amazon.com/sns)**\
121+
First, read pricing information [here](https://aws.amazon.com/sns/faqs/#SMS_pricing). First 100 SMS are free for each month as long as you send them to a United States destination. For this method, you will need:
122+
- Region
123+
- Access Key
124+
- Secret Access Key
125+
- Phone Number
126+
127+
Region is Amazon server you want to send from. It's probably best to choose one closest to you. More information [here](https://docs.aws.amazon.com/sns/latest/dg/sns-supported-regions-countries.html).\
128+
Access Key and Secret Access Key can be obtained following instructions in this [tutorial](https://medium.com/codephilics/how-to-send-a-sms-using-amazon-simple-notification-service-sns-46208d82abcc).\
129+
Phone number is the number to send SMS to. You will need to include country code and area code. Country code information can be found [here](https://countrycode.org/).
130+
131+
- **Email**\
132+
**FREE** but limited. Uses email to send text via phone carrier's [SMS gateway](https://en.wikipedia.org/wiki/SMS_gateway). Mostly the same setup as [Email](#Email).\
133+
Currently supported carriers: Alltel, AT&T, Boost Mobil, Cricket Wireless, FirstNet, Google Project Fi, MetroPCS, Republic Wireless, Sprint, Straight Talk, T-Mobile, Ting, U.S. Cellular, Verizon Wireless, Virgin Mobile.\
134+
If you'd like to request a carrier, please refer to [Feedback and Support](#Feedback-and-Support) and provide your carrier's SMS gateway if possible.
135+
136+
- **[Twilio](https://www.twilio.com/sms)**\
137+
First, read pricing information [here](https://www.twilio.com/sms/pricing). You get some free starting balance with which you can buy a Twilio phone number. For this method, you will need:
138+
- Twilio Account SID
139+
- Twilio Auth Token
140+
- Twilio Phone Number
141+
- Phone Number
142+
143+
The first three can easily be obtained from the [Twilio console](https://www.twilio.com/console) after you make a Twilio account.\
144+
Phone number is the number to send SMS to. You will need to include country code and area code. Country code information can be found [here](https://countrycode.org/).
145+
<br><br>
146+
104147

105-
#### Proxies
148+
### Proxies
106149
If you plan to use low interval rates OR track several items from one store, it is highly recommended that you use proxies such as ones from [Webshare](https://www.webshare.io/) in the format `ip:port` for IP-based authentication or `username:password@ip:port`.<br>\
107150
**NOTE:** The following stores do not currently with proxies due to them blocking some connections/headers which results in inconsistent connection: Argos, Best Buy, Costco, and Tesco. Thus we thought it'd be best if we take off proxy support for now until we can do some further research or find an alternative way.
108151

@@ -135,10 +178,11 @@ To provide monetary support, [donate](https://www.paypal.com/donate?business=3Y9
135178
* ~~Tesco~~
136179
* ~~Argos~~
137180
* Add delay between items from the same store
138-
* Add ~~Email and Maybe~~ SMS Notifications
139181
* More OOP!!
140182
* Add way to track notification status independent of items in a store
141183
* ~~Fix~~ Find Bugs
184+
* Fix notifications relying on `OPEN_URL`
185+
* ~~Add Email and SMS Notifications~~
142186
* ~~Add Proxies~~
143187
* ~~Add GUI - Make it easier to use~~
144188
* ~~Initially create seperation between intervals for Amazon items~~

config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@
2929
"slack"
3030
],
3131
"PROXIES": false,
32-
"EMAIL": false
32+
"EMAIL": false,
33+
"SMS_METHOD": "None"
3334
}

example.env

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
1-
# ** Configuration for email alerts ** #
2-
########################################
1+
# ** Configuration for alerts ** #
2+
##################################
33

44
EMAIL_SERVICE =
55
EMAIL_FROM =
66
EMAIL_PASS =
7-
EMAIL_TO =
7+
EMAIL_TO =
8+
SMS_AWS_REGION =
9+
SMS_AWS_ACCESS_KEY =
10+
SMS_AWS_SECRET_ACCESS =
11+
SMS_AWS_PHONE_NUMBER =
12+
SMS_EMAIL_SERVICE =
13+
SMS_EMAIL_FROM =
14+
SMS_EMAIL_PASS =
15+
SMS_EMAIL_PHONE_CARRIER =
16+
SMS_EMAIL_PHONE_NUMBER =
17+
SMS_TWILIO_ACCOUNT_SID =
18+
SMS_TWILIO_AUTH_TOKEN =
19+
SMS_TWILIO_FROM_NUMBER =
20+
SMS_TWILIO_TO_NUMBER =

main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@ export var {
2424
INTERVAL,
2525
OPEN_URL,
2626
ALARM,
27-
PROXIES,
2827
AMAZON_DELAY,
2928
TARGET_ZIP_CODE,
3029
TARGET_KEY,
30+
WEBHOOK_URLS,
31+
PROXIES,
3132
EMAIL,
32-
WEBHOOK_URLS
33+
SMS_METHOD, // "None", "Amazon Web Services", "Email", "Twilio"
3334
} = require('./config.json')
3435

3536
// For Testing

0 commit comments

Comments
 (0)