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.

// 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 = {
    /**
     * 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
    }
}
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:

Tag (Optional) is added for non-mandatory fields
  • 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.
    • 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.