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
- Create an
InitiateUserRequest
object using user credentials. - Call the
initiateUser()
function using the instance of theLMChatClient
class. - 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
Variable | Type | Description | Optional |
---|---|---|---|
userId | String | Unique ID for the userId | |
userName | String | Name of the userName | |
imageUrl | String | URL of the user's profile image | ✔️ |
isGuest | bool | Is the user a guest? | ✔️ |
InitiateUserResponse
List of parameters for the InitiateUserResponse
class
Variable | Type | Description | Optional |
---|---|---|---|
appAccess | bool | Whether user has app access | ✔️ |
user | User | user data | |
community | Community | community data | |
accessToken | String? | Token for accessing the API | ✔️ |
refreshToken | String? | Token for refreshing the session | ✔️ |