Name:
interface
Value:
Extend your Amplify Gen 2 app with AWS Blocks — self-contained backend capabilities you compose into your existing backend.

Choose your framework/language

Gen1 DocsLegacy

Page updated Jul 30, 2026

Identify a user

Use identifyUser to send profile information for the current user to Amazon Connect Customer Profiles. The values you send populate the Customer Profile that your Amazon Connect journeys target and personalize messages with.

import { identifyUser } from 'aws-amplify/push-notifications/customer-profiles';
await identifyUser({
userProfile: {
email: 'jane@example.com',
name: 'Jane Doe',
phone: '+15551234567',
location: {
city: 'Seattle',
country: 'US',
postalCode: '98101',
region: 'WA'
},
customAttributes: {
plan: 'premium',
favoriteCategory: 'outdoors'
}
}
});

Every field is optional, so send only the values your application has. Each call replaces the fields you provide on the profile.

User profile fields

FieldTypeDescription
emailstringThe user's email address.
namestringThe user's name.
phonestringThe user's phone number.
locationobjectThe user's location. Accepts city, country, postalCode, and region, each a string.
customAttributesRecord<string, string>Additional key-value pairs to store on the profile.

Values are validated before the request is sent. Every string, along with each customAttributes key and value, must be 255 characters or fewer, and customAttributes values must be strings. A profile that violates these bounds throws a validation error.

principalId is a reserved customAttributes key and is rejected. Your backend uses it to store the profile identity.

How the profile identity is resolved

Your application does not send a user identifier. Requests are signed with Signature Version 4 using Amazon Cognito identity pool credentials, and your backend derives the principalId for the profile from the signer identity of the request. A caller therefore cannot write to another user's profile, and there is no identifier for your application to manage.

Because the identity comes from the credentials, identifyUser works for both signed-in and guest users. See Guest and authenticated users.

When to call identifyUser

Call identifyUser when the profile information you hold changes, for example:

  • After a user signs in, to associate their profile details with their authenticated identity.
  • After a user updates their contact details or preferences.

identifyUser sends profile information only and performs no device work. To manage push devices, use registerDevice and removeDevice.

identifyUser does not require initializePushNotifications. Its only prerequisites are a configured endpoint and identity pool credentials, so you can call it before push notifications are initialized.

Personalize messages with profile values

Message templates reference profile values with the Attributes namespace, so a customAttributes entry named favoriteCategory is available to a template as {{Attributes.favoriteCategory}}. See Author message templates.

Handle errors

identifyUser returns a promise that rejects when validation fails or the endpoint returns an error, so handle failures where a rejected promise would otherwise go unobserved:

import { identifyUser } from 'aws-amplify/push-notifications/customer-profiles';
try {
await identifyUser({ userProfile: { email: 'jane@example.com' } });
} catch (error) {
console.error('Failed to identify user', error);
}