- [JSON representation](https://developers.google.com/workspace/chat/api/reference/rest/v1/User#SCHEMA_REPRESENTATION)
- [Type](https://developers.google.com/workspace/chat/api/reference/rest/v1/User#Type)

A user in Google Chat.

When returned as an output from a request, if your Chat app [authenticates as a user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), the output for a `User` resource (such as in the Messages and Memberships APIs) only populates the `name` and `type` fields for both internal and external users, unless they are members of the space or have prior affinity with the calling user.

| JSON representation |
|---|
| ``` { "name": string, "displayName": string, "avatarUrl": string, "email": string, "domainId": string, "type": enum (`https://developers.google.com/workspace/chat/api/reference/rest/v1/User#Type`), "isAnonymous": boolean } ``` |

| Fields ||
|---|---|
| `name` | `string` Resource name for a Google Chat `https://developers.google.com/workspace/chat/api/reference/rest/v1/User`. Format: `users/{user}`. `users/app` can be used as an alias for the calling app `https://developers.google.com/workspace/chat/api/reference/rest/v1/User#Type.ENUM_VALUES.BOT` user. For `https://developers.google.com/workspace/chat/api/reference/rest/v1/User#Type.ENUM_VALUES.HUMAN`, `{user}` is the same user identifier as: - the `id` for the [Person](https://developers.google.com/people/api/rest/v1/people) in the People API. For example, `users/123456789` in Chat API represents the same person as the `123456789` Person profile ID in People API. - the `id` for a [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users) in the Admin SDK Directory API. - the user's email address can be used as an alias for `{user}` in API requests. For example, if the People API Person profile ID for `user@example.com` is `123456789`, you can use `users/user@example.com` as an alias to reference `users/123456789`. Only the canonical resource name (for example `users/123456789`) will be returned from the API. |
| `displayName` | `string` Output only. The user's display name. Populated for both app authentication and user authentication. This field is always populated for requests made with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). When calling the Messages and Memberships APIs with [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), this field is populated for both internal and external users for the `sender` of a message, users within `annotations` (such as user mentions), and within `Membership` resources, provided the user is a member of the space or has prior affinity with the calling user. |
| `avatarUrl` | `string` Output only. The user's avatar image URL. When calling the Messages and Memberships APIs with [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), this field is populated for both internal and external users for the `sender` of a message, users within `annotations` (such as user mentions), and within `Membership` resources, provided the user is a member of the space or has prior affinity with the calling user. |
| `email` | `string` Output only. The user's email address. When calling the Messages and Memberships APIs with [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), this field is populated for both internal and external users for the `sender` of a message, users within `annotations` (such as user mentions), and within `Membership` resources, provided the user is a member of the space or has prior affinity with the calling user. |
| `domainId` | `string` Unique identifier of the user's Google Workspace domain. |
| `type` | ``enum (`https://developers.google.com/workspace/chat/api/reference/rest/v1/User#Type`)`` User type. |
| `isAnonymous` | `boolean` Output only. When `true`, the user is deleted or their profile is not visible, such as when a user is mentioned in a space without being a member and without prior affinity with the calling user. |

## Type

| Enums ||
|---|---|
| `TYPE_UNSPECIFIED` | Default value for the enum. DO NOT USE. |
| `HUMAN` | Human user. |
| `BOT` | Chat app user. |