> ## Documentation Index
> Fetch the complete documentation index at: https://botmesh.afaya.com.co/llms.txt
> Use this file to discover all available pages before exploring further.

# userOf()

> Function exported by @botmesh/core.

```ts theme={null}
function userOf(ctx): UserData;
```

Defined in: [user/UserDataService.ts:352](https://github.com/andresayac/botmesh/blob/main/packages/core/src/user/UserDataService.ts#L352)

`ctx.user` with a non-optional type — for flows and conversations, whose
`ctx` is typed as the minimal [RuntimeMessage](https://botmesh.afaya.com.co/api/core/interfaces/RuntimeMessage.md). Throws
`UserDataError('UNAVAILABLE')` when the context was not built by a Bot.

## Parameters

| Parameter | Type |
| - | - |
| `ctx` | [`RuntimeMessage`](https://botmesh.afaya.com.co/api/core/interfaces/RuntimeMessage) |

## Returns

[`UserData`](https://botmesh.afaya.com.co/api/core/interfaces/UserData)

## Example

```ts theme={null}
flow('idioma')
  .ask('¿Idioma?', 'lang')
  .do(async (ctx, c) => { await userOf(ctx).set('lang', c.state.lang) })
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.