---
# System prepended metadata

title: Automatic notifications workflow.

---

# Automatic notifications workflow.

1. create a schema `newUsers` that will hold the user id and signup date of new users.
2. on users-service, emit an event that will publish to kafla whenever the sign up function is called successfully, pass the resulting user details to kafak. this message will be consumed on notification service and stored in the schema created in `newUser`.
3. create a utility function that will take in two dates as argument and return the difference in number.
4. have a cron job that will run every 24 hours and check for records in `newUsers` whose signup date is not greater than 27 days ago.
5. every record retreived will have its `signup date` passed to the date utilty function 
6. depending to the result of the calculation, each of the use cases will be triggered. some require getting data from other services e.g `if the user has invested or not` that data lives in the `investing service`.
