A server that manages push notifications for the UCL Assistant API.
Maps a list of UCL Unique Person Identifiers (UPIs) to Exponent notification push tokens.
These can then be called on to push notifications to a user, if they have notifications enabled. This data is stored in a PostgreSQL database, the login details for which are provided by environment variables.
-
POST /register
- registers a user for notifications. Requires aupi
and apushToken
, provided as JSON keys. Can be used to overwrite old entries too. -
POST /upi/xxx/
- send a push notification to the specified UPI. Requires a JSON object as body, withtitle
,content
, andtype
parameters. Returns 200 if notifcation sent, returns a 404 error if that user is not registered for notifications. -
DELETE /upi/xxx/
- removes a user from the notifications system. Deletes the notification entry from the database entirely.