Send Email Notifications to Subscribers with SendGrid and Node.js
In this article, you will learn how to build an email price notification system using Node.js and SendGrid API. The system tracks sneaker prices and sends email alerts whenever the price of a particular sneaker decreases. To set up the system, you need to configure your environment by setting up your SendGrid account and installing necessary dependencies. You will also create three new files: index.js, .env, and subscribers.json. The index.js file continuously runs and checks for price drops, while the .env file securely stores environmental variables like API keys. The subscribers.json file holds all of your subscribers along with their data. Once the system is set up, you can test it by changing the prices in the subscribers.json file to a higher value and running the script again. Finally, you can create a scheduler using the node-schedule package to schedule time-based jobs for checking price drops every 10 minutes.
Company
Twilio
Date published
Dec. 12, 2021
Author(s)
Dhruv Patel
Word count
2037
Hacker News points
None found.
Language
English