You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.
Amazon offers a push notif service that should do the job. Some thinking about what users should be notified needs to be done before we can implement this fully
Looked into the various options and settled on Amazon SNS; which gives us fairly straightforward implementation of push messages to android / ios.
SNS requires that each client be registered with a deviceId. For the moment I am using Expo.Constants.deviceId but this will be changed to a native implementation later. I originally built a very basic express server to test this device registration, but then realised it could be done in the confirmUser lambda with a bit of work.
infrastructure-provisioning/circles-sns repo holds the terraform build for the SNS resources, as well as a test server (which I will remove now).
circles-sns repo holds the code for this test server. This is now redundant as I have moved things to lambda but could be used for an sns microservice in future if that was the route we take.
circles-lambdas contains the confirmUser() function which calls the sns function to register a device endpoint (so that we can message this user later):
var sns = new AWS.SNS({apiVersion: '2010-03-31'})
exports.handler = (event, context, callback) => {
var snsParams = {
PlatformApplicationArn: process.env.ANDROID_ARN,
Token: event.request.userAttributes.deviceId
}
sns.createPlatformEndpoint(snsParams, function (err, data) {
if (err) console.log(err, err.stack)
else console.log(data)
})
}
I have added a custom field to the Cognito User Pool called 'deviceId' which is pulled out of the request and used to set the Token param.
This is as far as I have gotten, obviously we need a db table to associate userNames with these endpoints.
The previous sns registration stuff was moved from the FE to the circles-api. We need to extend this somewhat and need a full notification api to simplify messaging to the various platforms etc, and on the frontend we will need a way to interpret these messages.
Amazon offers a push notif service that should do the job. Some thinking about what users should be notified needs to be done before we can implement this fully
related to: CirclesUBI/circles-api#32
The text was updated successfully, but these errors were encountered: