# User Info Channel


Source: https://docs.stxapp.io/websockets/channels/user-info/

Topic: `user_info:{user_id}`

Delivers your profile information, and pushes an update whenever it
changes. `user_id` is the UUID that `GET /api/v1/me` returns as `user_id`, the same
id every account channel topic takes. It is not `userUid`.

## UserInfo object

- `userId` : Your user id: the UUID in this channel's topic, and `user_id` from
  `GET /api/v1/me`.
- `userUid` : A second, external identifier for the user. It can differ from
  `userId`; never use it in a topic.
- `userStatus` : The user's account status, one of `archived`,
  `pending_approval`, `active`, `suspended`, `banned`, `self_excluded`,
  `closed`, `rejected`, `dormant`, `cool_off` or `overdrawn`.
- `firstName` : The user's first name.
- `lastName` : The user's last name.
- `middleName` : The user's middle name, if any.
- `preferredName` : The user's preferred name, if any.
- `countryCode` : The country code for `phoneNumber`, if any.
- `phoneNumber` : The user's phone number, if any.
- `businessCountryCode` : The country code for `businessPhone`, if any.
- `businessPhone` : The user's business phone number, if any.
- `dateOfBirth` : The user's date of birth, if on file.
- `address1` : Address line 1 of the user's address, if on file.
- `address2` : Address line 2 of the user's address, if on file.
- `city` : The city of the user's address, if on file.
- `state` : The state of the user's address, if on file.
- `zipCode` : The zip code of the user's address, if on file.
- `jobTitle` : The user's job title, if any.
- `industry` : The industry the user works in, if any.
- `password_changed` : `true` immediately after the user changes their
  password.
- `logout` : `true` when this update should force the client to log the
  user out (for example, after a password change).
- `test_account` : Whether the account is marked as a test account.
- `country` : The country of the user's address, if any.
- `citizenshipCountry` : The user's country of citizenship, if any.
- `employerName` : The user's employer's name, if any.
- `employerAddress` : The user's employer's address, if any.
- `optInMarketing` : Whether the user has opted in to marketing
  communications.
- `allowMultipleLogins` : Whether the user may be logged in from more than
  one place at once.
- `whitelistIpAddresses` : The user's whitelisted IP addresses, as a
  comma-separated string. Null if none are set.
- `referralCode` : The user's own referral code.

## Use Cases

| Use case | Message to send |
| --- | --- |
| Join and receive your profile | `["3","3","user_info:<user_id>","phx_join",{}]` |
| Check the connection is alive | `["3","4","user_info:<user_id>","ping",{}]` |

### Joining

```json
["3","3","user_info:<user_id>","phx_join",{}]
```

```json
[
  "1",
  "1",
  "user_info:7fb55544-3a7e-4f6b-bd66-fc89bd3a1087",
  "phx_reply",
  {
    "response": {},
    "status": "ok"
  }
]
```

Immediately after joining, expect a `user_updated` event carrying the
current snapshot; the join reply itself carries nothing.

### Pushed when the user's information changes

```json
[null, null, "user_info:7fb55544-3a7e-4f6b-bd66-fc89bd3a1087", "user_updated", UserInfo]
```

```json
[
  null,
  null,
  "user_info:7fb55544-3a7e-4f6b-bd66-fc89bd3a1087",
  "user_updated",
  {
    "userId": "7fb55544-3a7e-4f6b-bd66-fc89bd3a1087",
    "userUid": "v5yDoWte75hCuhp3ejRMPTWz8Yz1",
    "userStatus": "active",
    "firstName": "Jonny",
    "lastName": "Lu",
    "middleName": null,
    "preferredName": null,
    "countryCode": "+1",
    "phoneNumber": null,
    "businessCountryCode": null,
    "businessPhone": null,
    "dateOfBirth": "1988-03-05",
    "address1": "123 Main St",
    "address2": null,
    "city": "New York",
    "state": "NY",
    "zipCode": "10121",
    "jobTitle": null,
    "industry": null,
    "password_changed": false,
    "logout": false,
    "test_account": false,
    "country": "USA",
    "citizenshipCountry": null,
    "employerName": null,
    "employerAddress": null,
    "optInMarketing": true,
    "allowMultipleLogins": false,
    "whitelistIpAddresses": null,
    "referralCode": "JLU4754"
  }
]
```
