Skip to main content

Initiate User

To start using the LikeMinds Chat and enable personalized experiences for your users, you need to initiate them within the system. This process associates a user in your application with a user in the LikeMinds Chat, allowing for seamless integration and real-time messaging in your application.

Steps to initiate a User​

  1. Create an InitiateUserRequest object using user credentials.
  2. Call the initiateUser() function using the instance of the LMChatClient class.
  3. Use the response (LMResponse<InitiateUserResponse>) as per your requirement.
InitiateUserRequest request = (InitiateUserRequestBuilder()
..userName("ENTER_USER_NAME")
..userId("ENTER_USER_ID"))
.build();

final LMResponse<InitiateUserResponse> response = await lmChatClient.initiateUser(request);

if (response.success) {
// your function to process the response data
processResponse(response);
} else {
// your function to process error message
processError(response);
}
tip

We suggest that you use the unique ID from your database for the user so that you do not have to save the one we generate.

Models​

InitiateUserRequest​

List of parameters for the InitiateUserRequest class

VariableTypeDescriptionOptional
userIdStringUnique ID for the userId
userNameStringName of the userName
imageUrlStringURL of the user's profile image✔️
isGuestboolIs the user a guest?✔️

InitiateUserResponse​

List of parameters for the InitiateUserResponse class

VariableTypeDescriptionOptional
appAccessboolWhether user has app access✔️
userUseruser data
communityCommunitycommunity data
accessTokenString?Token for accessing the API✔️
refreshTokenString?Token for refreshing the session✔️