---
title: "Identify a user"
section: "frontend/in-app-messaging"
platforms: ["angular", "javascript", "nextjs", "react", "react-native", "vue"]
gen: 2
last-updated: "2026-03-25T17:40:00.000Z"
url: "https://docs.amplify.aws/react/frontend/in-app-messaging/identify-user/"
---

To fully harness the potential of In-App Messaging, you must segment and target your In-App Messaging campaigns to specific user subsets. By identifying users with additional information, including their device demographics, location and any attributes of your choosing, you will be able to display intelligent, targeted in-app messages to the right users.

```js title="src/index.js"
import { identifyUser } from 'aws-amplify/in-app-messaging';

await identifyUser({
  userId: '', // E.g. user-id
  userProfile: {
    email: '', // E.g. example@service.com
    name: '', // E.g. name-of-the-user
    plan: '' // E.g. plan-they-subscribe-to
    customProperties: {
      // E.g. hobbies: ['cooking', 'knitting'],
    },
    demographic: {
      appVersion: '',
      locale: '', // E.g. en_US
      make: '', // E.g. Apple
      model: '', // E.g. iPhone
      modelVersion: '', // E.g. 13
      platform: '', // E.g. iOS
      platformVersion: '', // E.g. 15
      timezone: '' // E.g. Americas/Los_Angeles
    },
    location: {
      city: '', // E.g. Seattle
      country: '', // E.g. US,
      postalCode: '', // E.g. 98121
      region: '', // E.g. WA
      latitude: 0.0,
      longitude: 0.0
    },
    metrics: {
      // E.g. logins: 157
    },
  },
});
```

## Identify a user with Amazon Pinpoint

When using `identifyUser` with Amazon Pinpoint, in addition to the other user info properties you can configure the `address`, `optOut`, and `userAttributes` properties under `options`.

```js title="src/index.js"
import { identifyUser } from 'aws-amplify/in-app-messaging';

await identifyUser({
  userId: '', // E.g. user-id
  options: {
    address: '' // E.g. A device token or email address
    optOut: ''  // Either ALL or NONE
    userAttributes: {
      // E.g. interests: ['soccer', 'shoes'],
    }
  },
});
```
