# apollo-playlists-messages-lambda
Managed by Terraform.

Lambda to get internal apollo playlist-related events from SQS, match them with users preferences and create messages 
via User-Data API 

Currently, it supports 4 playlist-related event types: 
1. playlists_entry
2. playlists_tracklist_update
3. playlists_exit 
4. playlists_major_move


One lambda instance should be configured for one event type, input chunk is NOT allowed to contain mixed types events,
it should only include events which type matches with the configured one.

- 'playlists_entry' lambda produces 'starred_track_top_playlist_entry' and 'starred_track_starred_playlist_entry' 
messages both
- 'playlists_tracklist_update' lambda produces 'starred_playlist_tracklist_update' messages
- 'playlists_exit' lambda produces 'starred_track_top_playlist_exit' and 'starred_track_starred_playlist_exit' messages
both
- 'playlists_major_move' lambda produces 'starred_track_top_playlist_major_move' and 
'starred_track_starred_playlist_major_move' messages both

Dependencies:

- User-Data API
- Apollo API
- Gate API

Required environment variables:

- EVENT - one of playlists_entry, playlists_tracklist_update
- USERDATAAPI_APPKEY
- USERDATAAPI_HOSTNAME
- USERDATAAPI_SCHEMA
- GATEAPI_APPKEY=
- GATEAPI_HOSTNAME=
- GATEAPI_SCHEMA=
- APOLLOAPI_APPKEY=
- APOLLOAPI_HOSTNAME=
- APOLLOAPI_SCHEMA=
- SENTRY_DSN

Optional environment variables:

- EVENT_HOLDER
- TTL
- PUBLIC
- CHUNK_SIZE
- CHUNK_WAIT
- CORE_IMAGE_SERVICE_HOSTNAME
- CORE_IMAGE_SERVICE_SCHEMA
