feat(notifications): add Amazon Connect Customer Profiles provider for Push Notifications#14866
Open
soberm wants to merge 1 commit into
Open
Conversation
…ew subpath export Add an opt-in Push Notifications provider backed by Amazon Connect Customer Profiles, exposed as a new subpath export alongside the existing Pinpoint provider (mirroring the Analytics Customer Profiles provider from #14864): - aws-amplify/push-notifications/customer-profiles - @aws-amplify/notifications/push-notifications/customer-profiles Device-token registration (initializePushNotifications) and identifyUser register the device with Connect Customer Profiles instead of calling the Pinpoint UpdateEndpoint API. Authorization mode is selected automatically from the resolved auth session: - Authenticated (Cognito user-pool): POST {endpoint}/identify-user with Authorization: Bearer <accessToken>; backend keys the profile on `sub`. - Guest (Identity Pool unauthenticated): POST {endpoint}/identify-user-guest, SigV4-signed (execute-api) with the guest credentials; backend keys the profile on `identityId`. Enables registering a device token before sign-in. On a later authenticated call, options.previousGuestIdentityId folds the guest profile (and its devices) into the authenticated profile. Configured via the new notifications.amazon_connect_customer_profiles amplify_outputs key (Notifications.PushNotification.CustomerProfiles = { endpoint, region }). All public method signatures, the native event bus, and the token lifecycle match the Pinpoint provider 1:1; IdentifyUserInput options additionally accept optional deviceId/platform/appVersion/ previousGuestIdentityId device-registration fields. Pinpoint engagement telemetry (_campaign.*/_journey.*) is intentionally not ported (Connect Customer Profiles has no client-side event API). Additive and non-breaking: the default push-notifications export still resolves to Pinpoint; core gains an optional CustomerProfiles config type parsed side-by-side with Pinpoint.
🦋 Changeset detectedLatest commit: fd7f092 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
Adds a new, opt-in Push Notifications provider backed by Amazon Connect Customer Profiles, exposed as a new subpath export alongside the existing Amazon Pinpoint provider (mirroring how the Analytics Customer Profiles provider is exposed):
aws-amplify/push-notifications/customer-profiles@aws-amplify/notifications/push-notifications/customer-profilesWith this provider,
initializePushNotifications(device-token registration) andidentifyUserregister the device with Amazon Connect Customer Profiles instead of calling the PinpointUpdateEndpointAPI. The authorization mode is selected automatically from the resolved auth session:POST {endpoint}/identify-userwith anAuthorization: Bearer <accessToken>header; the backend keys the profile on the verifiedsub.POST {endpoint}/identify-user-guest, SigV4-signed (execute-api) with the guest credentials; the backend keys the profile on the caller'sidentityId. This lets an app register a device token and receive push before sign-in. On a later authenticated call, pass the prior guestidentityIdviaoptions.previousGuestIdentityIdto fold the guest profile (and its devices) into the authenticated profile (merge-on-sign-in).Configured through the new
notifications.amazon_connect_customer_profileskey inamplify_outputs(Notifications.PushNotification.CustomerProfiles = { endpoint, region }). All public method signatures (identifyUser,IdentifyUserInput, and everyon*/get*/request*/setBadgeCountAPI), the native event bus, and the token lifecycle match the Pinpoint provider 1:1;IdentifyUserInput's options additionally accept optionaldeviceId/platform/appVersion/previousGuestIdentityIddevice-registration fields. The Customer Profiles provider does not emit Pinpoint engagement telemetry (_campaign.*/_journey.*), as Amazon Connect Customer Profiles has no client-side event API.Additive and non-breaking:
aws-amplify/push-notifications(and@aws-amplify/notifications/push-notifications) export is unchanged and still resolves to the Amazon Pinpoint provider, including its engagement telemetry. The existingaws-amplify/push-notifications/pinpointsubpath is likewise unchanged.@aws-amplify/coregains an optionalNotifications.PushNotification.CustomerProfilesconfig type (Pinpoint config remains supported side-by-side) and parses the newnotifications.amazon_connect_customer_profilesamplify_outputskey in addition to the existing Pinpoint notifications config.Issue #, if available
N/A — builds on #14864.
Description of how you validated changes
tsc --noEmitpasses for@aws-amplify/core,@aws-amplify/notifications, and theaws-amplifyumbrella.eslintpasses on all changed files.npx changeset statusreports a minor bump for@aws-amplify/notifications,@aws-amplify/core, andaws-amplify(no major).parseAmplifyOutputscases) exercise real code paths, mocking only the network/auth boundary:resolveConfig— readsPushNotification.CustomerProfiles.resolveCredentials— authenticated (bearer token), guest (credentials +identityId), and neither-present error.registerDeviceWithCustomerProfiles— authenticated BearerPOST /identify-user; guest SigV4-signedPOST /identify-user-guest; request body, non-2xx, and network-failure handling; asserts no PinpointUpdateEndpointcall.identifyUser.native— device + profile registration, inflight-token race, guest-merge/device option passthrough.initializePushNotifications.native— token → Connect registration, inflight race.parseAmplifyOutputs— newamazon_connect_customer_profilesnotifications key (Pinpoint + CP together, and CP-only).Checklist
yarn testpassesChecklist for repo maintainers
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.