Overview (from Github)

In order to be able to send push notifications to devices with the mobile app installed, a request to Expo's push notification API must be sent with the corresponding push tokens of the devices you want to send notifications to. A push token is a string tied to the device and the Expo project used to send notifications to that device. (you can read more about how push notifications work with Expo here). At The Daily, we will want to use push notifications to inform readers of breaking news or to promote an article -- this tool will allow the EiC, DME, or Audience Engagement to do so without any involvement from web being necessary.

To centralize the push tokens of all devices, the mobile app will send the push token of the device it is running on to the push server (https://notifications.michigandaily.com in production) upon startup. The server will then store all tokens received in DynamoDB, a simple key-value database service hosted by AWS, so we can later send push notifications to them when necessary.

Since we don't want anybody in The Daily to be able to send push notifications, all users must login with Slack before being able to use the tool. Whether or not the user should actually be able to send notifications is determined by whether or not they are in the mobile-push-admins Slack channel. If the logged in user is not in this channel, they will see a "user not authed" message.

If user authorized to send push notifications is logged in, they will see a form that they can fill out with the respective information they want in the fields and submit it. Upon submission, the server will then loop over all of the tokens in the DynamoDB database and forward the message to them in batches of 10000.

Untitled

(also from Github) 🙂

Client-Side

Server Side