Skip to content

docs: expand Customer Profiles push notifications to Android, Flutter, and Swift - #8616

Open
ekjotmultani wants to merge 3 commits into
mainfrom
docs/connect-enrichment-mobile-clients
Open

docs: expand Customer Profiles push notifications to Android, Flutter, and Swift#8616
ekjotmultani wants to merge 3 commits into
mainfrom
docs/connect-enrichment-mobile-clients

Conversation

@ekjotmultani

Copy link
Copy Markdown
Member

Description

The standalone Amazon Connect Customer Profiles clients are now released on all three mobile platforms:

  • Android: aws-connect (AmplifyConnectClient) in amplify-android
  • Flutter: amplify_connect_client in amplify-flutter
  • Swift: AmplifyConnectClient in amplify-swift

This expands the five Customer Profiles client pages under frontend > Push Notifications from platforms: ['react-native'] to include android, flutter, and swift, following up on the platform scoping deliberately deferred in #8613.

Pages expanded

  • Overview — per-platform install and client creation (Gradle/pubspec/SPM), including the Swift credentials bridge and the Flutter Amplify Auth default
  • Identify a user — per-platform UserProfile snippets and error handling
  • Register a device — FCM/APNs token acquisition per platform and the per-platform resolved device fields
  • Remove a device — remove-before-sign-out guidance and per-platform never-registered behavior
  • Guest and authenticated users — documents that the mobile clients require an explicit registerDevice after sign-in (React Native handles this automatically)

Deliberately unchanged

  • The four React Native push-handling pages (request permissions, manage device token, interact with notifications, app badge count) stay React Native only — the standalone clients register tokens with the backend but do not handle notification display.
  • The Analytics client pages (Kinesis, Firehose) already cover all three platforms.

All snippets were written against the released public API surfaces in each repo.

Testing

  • yarn test:unit: 305 tests, 62 suites, all passing
  • yarn spellcheck: clean (3,023 files)
  • Full production build: all four platforms prerender the customer-profiles routes; RN-only child pages correctly absent from the new platforms; all internal link targets verified to build on android/flutter/swift

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…, and Swift

The standalone Connect clients are released in amplify-android
(aws-connect), amplify-flutter (amplify_connect_client), and
amplify-swift (AmplifyConnectClient). Expand the five client pages that
apply to them from platforms: ['react-native'] to the four-platform set,
with per-platform install, client creation, and identifyUser /
registerDevice / removeDevice snippets and error handling.

The four React Native push-handling pages (permissions, device token,
notification interaction, badge count) stay React Native only: the
standalone clients register tokens with the backend but do not handle
notification display.

Verified with jest (305 passing), cspell (clean), and a full production
build: all four platforms prerender the customer-profiles routes, and
every internal link target builds on the three new platforms.
…tter setup

amplify_core's NotificationsOutputs parser still requires the legacy
Pinpoint fields (aws_region, amazon_pinpoint_app_id), so passing the
full outputs file containing notifications.amazon_connect to
Amplify.configure throws a parse error. Remove the key before
configuring, matching the released example app; the Connect client
reads it from the decoded map instead.
@ekjotmultani
ekjotmultani marked this pull request as ready for review July 31, 2026 22:43
// Amplify.configure parses only its own sections, so remove the
// notifications key before configuring. The Connect client reads it
// from the decoded map instead.
final authOutputs = Map<String, dynamic>.from(outputs)..remove('notifications');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[suggestion] Is this stripping-the-notifications-key step actually required? The published amplify_connect_client README just calls AmplifyConnectClientFlutter.createFromAmplifyOutputs(amplifyOutputs: amplifyOutputs) on the full decoded outputs, no mention of removing the notifications key before Amplify.configure(). If Amplify.configure genuinely chokes on that key on the current release, keep this, but if it doesn't we should drop the workaround since it adds unnecessary complexity and could send readers down the wrong path.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, unfortunately. NotificationsOutputs in amplify_core still has the pinpoint fields as required, so Amplify.configure throws on an outputs file where notifications only has amazon_connect. The README doesn't hit it because its snippet never calls Amplify.configure, but the example app in the repo does the same strip for the same reason. We have a parser fix in flight on amplify-flutter to accept the new shape, once that releases I'll simplify this snippet to a plain configure.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make the pinpoint fields optional?


```kotlin
dependencies {
implementation("com.amplifyframework:aws-connect:LATEST_VERSION")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Couldn't confirm com.amplifyframework:aws-connect on Maven Central when I checked (0 results), though that could just be an indexing lag since the Flutter package was released only a couple days ago too. Worth a quick sanity check of the exact group/artifact coordinate before merge so nobody copies a build.gradle line that 404s.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's there, the search index just hasn't caught up. Direct path resolves: https://repo1.maven.org/maven2/com/amplifyframework/aws-connect/2.39.0/ (went out with the 2.39.0 release on Jul 30).

| `phone` | `string` | The user's phone number. |
| `location` | `object` | The user's location. Accepts `city`, `country`, `postalCode`, and `region`, each a `string`. |
| `customAttributes` | `Record<string, string>` | Additional key-value pairs to store on the profile. |
| `customAttributes` | `map` | Additional string key-value pairs to store on the profile. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The old copy explicitly said "customAttributes values must be strings", this drops that constraint when the type became map instead of Record<string, string>. If all four SDKs still require string values here, worth restoring that note so it doesn't read like arbitrary values are now allowed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored the note.


<Callout info>

Device registration requires a push channel, so `registerDevice` throws `ConnectUnsupportedOperationException` on web and desktop platforms. `identifyUser` works on every platform.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Flagging for awareness rather than asking for a change: this callout implies the flutter platform tag here covers non-mobile targets too (web/desktop), which matches the package's platform support matrix on pub.dev, but nothing else on this page discusses non-mobile Flutter usage. Fine to leave as is if that's intentional.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's intentional. identifyUser works everywhere Flutter runs, only device registration needs a push channel, so the callout scopes exactly that.

See [Identify a user](/[platform]/frontend/push-notifications/customer-profiles/identify-user/).
</InlineFilter>

After sign-out completes, subsequent calls are signed as a new guest identity. See [Remove a device](/[platform]/frontend/push-notifications/customer-profiles/remove-device/).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good restructuring here, moving the ordering callout to wrap all four platform variants instead of duplicating it per platform, and generalizing "after signOut completes" to "after sign-out completes" so the prose doesn't leak a specific API name into shared copy.

| `deviceId` | A stable identifier the library generates and persists per installation, shared with other Amplify libraries. |
| `platform` | The `platform` string passed when creating the client. |
| `appVersion` | The `appVersion` string passed when creating the client. |
| `channelType` | The `channelType` passed when creating the client. Defaults to `ChannelType.GCM`. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ChannelType.GCM default here lines up with what the overview page's client-creation snippet documents, and the Flutter/Swift derivation logic in the rows below is consistent with their respective overview sections too. Nice to see that stayed in sync across pages.

<InlineFilter filters={['swift']}>

```swift
try await client.removeDevice()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be something like

func handleSignOut() async {
    do {
        try await client.removeDevice()
    } catch {
        print("Failed to remove device before sign out: \(error)")
    }

    _ = await Amplify.Auth.signOut()
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, switched it to that shape. It also matches what the remove-device page shows, so the two pages agree now.

- identify-user: restore the note that customAttributes values must be
  strings, which was dropped when the field table generalized the type
  for the mobile platforms.
- guest-and-authenticated-users: guard removeDevice in the Swift
  sign-out snippet so a failed removal cannot skip signOut, matching
  the pattern the remove-device page documents.
@mergify

mergify Bot commented Aug 4, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants