> ## Documentation Index
> Fetch the complete documentation index at: https://docs.overhyped.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# initUser - Initializes the User

### `initUser` : OverhypedAI("initUser", identifier, customMetadata, widgetOptions?)

This method should be called only once when any user logs in to the platform to initialize the user with OverhypedAI.

```typescript theme={"system"}
// NOTE: This is a MANDATORY parameter.
const identifier = {
    /**
     * This currently supports only "email"
     */
    type: "email"  // "email"
    value: string  // "name@company.com"
}
-----------------------------------------
// NOTE: This is a MANDATORY parameter.
const customMetadata = {
    subscriptionPlan: string  // "Free Trial"
    firstName?: string
    lastName?: string
    role?: string
    company?: string
    /**
     * The user's creation date in ISO 8601 format (e.g., "2025-11-15T09:00:00.000Z").
     * If provided, users created before the widget integration will not see the Activation modal.
     */
    userCreatedAt?: string
}
-----------------------------------------
// NOTE: This is an optional parameter.
const widgetOptions = {
    /**
     * Show/Hide the widget initially. This has no effect on the modal.
     * 
     * Defaults to true.
     */
    show?: boolean
    /**
     * Used to adjust the position of the widget relative to it's initial position.
     *
     * Defaults to { x: 0, y: 0 }.
     */
    positionOffset?: {
        x?: number | string
        y?: number | string
    }
}
```

```typescript {3} theme={"system"}
import OverhypedAI from '@overhyped-ai/connect/OverhypedAI';

OverhypedAI("initUser", identifier, customMetadata, widgetOptions)
```

Initializes the user for connection. This should be called upon user login. Params:

<Tip>Tag (Optional) is added for non-mandatory fields</Tip>

* `identifier: object` : Primary field to identify the user.
  * `type: 'email'` : Type of the primary field. For now you can send only "email" text as type.
  * `value: string` : Value of the primary field. Ex: If type is "email", value will be user's email(`name@company.com`).
* `customMetadata: object` : Any other data of the end user.
  * `subscriptionPlan: string` : Subscription plan of the user.
  * `firstName: string` (Optional): First Name of the user.
  * `lastName: string` (Optional): Last Name of the user.
  * `role: string` (Optional): Role of the user in their company.
  * `company: string`  (Optional):  Company of the user.
  * `userCreatedAt: string`  (Optional):  User's creation date in ISO 8601 format (e.g., `2025-11-15T09:00:00.000Z`). This is used to hide the Activation modal for existing users(users created before the widget integration).
* `widgetOptions: object` (Optional): Options to customize the widget.
  * `show: boolean` (Optional): Show/Hide the widget initially. This has no effect on the modal.
  * `positionOffset: object` (Optional): Adjust the position of the widget relative to it's initial position.
    * `x: number | string`  (Optional):  X-axis offset.
    * `y: number | string`  (Optional):  Y-axis offset.
