The StreetMerchant stock checker can be configured to play a sound, send an email, send a text message or post to a platform (such as Twitter or Twitch) when it finds an item in stock. In this guide we’ll cover setting up some of these notifications.

If you haven’t got StreetMerchant installed and running yet, check out our earlier guide.

Table of Contents

Introduction

To set-up notifications, you need to open the ‘dotenv’ file in your streetmerchant folder with a text editor and fill in the details for the notification types you want to send.

The full list of notification types and the varibles to set for each type can be found on Jef’s website: https://www.jef.buzz/streetmerchant/reference/notification/

After you set the details for a notification type, you can test if it is working by running the following code in the command prompt (remember to change directory to your streetmerchant folder first):

npm run test:notification

Send Email Notifications with Gmail

Example Streetmerchant Email Notification sent when an item is in stock
Streetmerchant Email Notification

Set these varibles in the dotenv file to enable email notifications sent from your Gmail account:

EMAIL_PASSWORD:password for your-email@gmail.com
EMAIL_TO:any email address to send to
EMAIL_USERNAME:your-email@gmail.com

For EMAIL_USERNAME, enter the Gmail email address you want to send emails from.

Enter the password (or an app password) for this email account for EMAIL_PASSWORD. If your Gmail account has 2-Step Verification enabled you will need to enter an app password instead of the usual password you use to sign-in to Gmail. Go to https://myaccount.google.com/apppasswords to generate app passwords.

If you don’t use 2-Step Verification and are entering your usual password, you may need to enable ‘Less secure app access’ in your Google account before email notifications will work (I would recommend adding 2-Step Verification and using an app password.)

enable or disable less secure app access for your Google account
You may need to enable less secure app access if you’re not using 2-Step Verification and an app password.

EMAIL_TO can be left blank if you just want notifications to go to the address in EMAIL_USERNAME.

You do not need to set ‘SMTP_ADDRESS’ or ‘SMTP_PORT’ if you’re sending emails with Gmail.

SMS Notifications

You need to have email notifications set-up for sending a text message when an item is in stock. Only certain mobile network carriers are supported, the list of carriers is here.

Enter values for the following variables in your dotenv file:

PHONE_CARRIER:att or att,verizon,google
PHONE_NUMBER:enter 10 digit phone number(s)

📝Article last updated on January 10th, 2023