Simple python script that runs on a aws lambda function once a day - sending emails to registered users that are interested in particular items being on sale.
Uses DynamoDB to store the previous price so we don't continually send emails and we can detect price drops.
// Users table example item
{
email: '[email protected]',
item_keywords: {
'Chocolate',
'Dog food'
}
}
// Items table example item
{
name: 'Green & Blacks 85% Chocolate',
price: 10.09
}
- Python 3
- AWS DynamoDB
- AWS Lambda
- Mailgun
- For sandbox mailgun domains you can't send an email to whole mailing list AFAIK. Current workaround is to send an email to each individual using a loop.
- Coles API endpoint and object retrieval is hardcoded, don't know how often / if this changes
- Search for product
- Click on product
- Copy product stockcode from url (can also see it in networks tab - devtools)
- Open devtools
- Search for product
- Click on product to go to details page
- Find JSON api request for product (uses prefix as listed in
items.json
)