Push Notifications
Amplify push notifications are backed by Amazon Connect Customer Profiles. A Customer Profile holds the profile information for one person, keyed on a server-derived principalId. That person's registered push devices are stored separately, in a DynamoDB device store, associated to the same principalId; they are not embedded in the Customer Profile object. You send a notification by targeting profiles from an Amazon Connect journey, which calls into your Amplify backend to deliver the message to that person's devices.
If you are moving an existing application off the Pinpoint-backed push notifications feature, start with Migrate from Pinpoint-backed features.
Add the resource to your backend with the defineNotifications construct:
import { defineBackend } from '@aws-amplify/backend';import { defineNotifications } from '@aws-amplify/backend-notifications';import { auth } from './auth/resource';
defineBackend({ auth, notifications: defineNotifications()});What gets deployed
Deploying defineNotifications provisions the following resources:
- An
AmplifyProfileCustomer Profiles object type, registered on your Customer Profiles domain. It is keyed onprincipalId, a searchable and unique field that holds the Amazon Cognito identity poolidentityIdof the caller. Your backend derivesprincipalIdfrom the signed request, so a client never sends it and cannot write to another person's profile. - A DynamoDB device store that holds the registered push devices. Device records live in this table rather than in Customer Profiles.
- Three HTTP API routes (
identify-user,register-device, andremove-device), authorized with AWS Identity and Access Management (IAM) and called with Signature Version 4 signed requests. A single least-privilege Lambda function serves all three routes. - A push-delivery Lambda function, invoked as a custom action from an Amazon Connect journey. It looks up the target profile's devices and sends the message to each one.
- An AWS End User Messaging application, with the APNs and FCM channels you configure.
Depending on the mode you choose, an Amazon Connect instance and a Customer Profiles domain are created for you, or an existing domain is used. See Set up notifications for both modes.
Review the generated configuration
After a successful deployment, the invoke endpoint and region are written to the notifications section of amplify_outputs.json:
{ "notifications": { "amazon_connect": { "endpoint": "https://abcdefghij.execute-api.us-east-1.amazonaws.com", "aws_region": "us-east-1" } }}Your frontend reads these values when you pass amplify_outputs.json to Amplify.configure().