An email service that provides weekly content similar to Spotify Wrapped (most listened songs, genre, artists, total play time, etc..).
This GitHub project is a serverless solution for sending weekly email summaries of users' Spotify listening history. The project is built on AWS Lambda (deployed using Terraform) and utilizes various AWS services to achieve this functionality. A detailed overview of the workflow mentioned below.
Due to Spotify API's restrictions, this service is not available publicly. Currently, this is only used by me and a few close friends. Please feel free to reach out if you're interested in subscribing to such a service.
The project comprises the following components:
-
User Registration API (AWS Lambda): Python API allows users to register for weekly summaries. It stores user data on DynamoDB
-
DynamoDB (NoSQL database): Stores user data and listening histroy information.
-
Listening History Query Lambda (AWS Lambda): Python Script which runs hourly to fetch users' Spotify listening history over the past hour using the Spotify API.
-
Data Aggregator Lambda (AWS Lambda): Golang script which runs once a week to query DynamoDB (through Athena) and summarize the listening data for each user. Sends summaries to SQS.
-
Amazon Simple Queue Service (SQS): Used to queue the summaries generated by the Data Aggregator Lambda.
-
Email Sender Lambda (AWS Lambda): Python script to consume the SQS queue and sends email summaries to corresponding users.
Almost all components are managed by Terraform, except:
- federated query, which allows athena to query DynamoDB (TODO)
Please feel free to contribute and open a PR. Some Quality-of-Life TODOs are:
- There are still a few components missing from Terraform, like the federated query.
- Add an unsubscribe endpoint and make a landing page for both subscribing and unsubscribing.
- The email itself can use some work. I'm not the best UI designer, sorry.