In this post, we will talk about how we can access group and user user details of the current logged in user in a custom action card. This can be useful to autofill user details like phone number, user name etc. already known by Kaizala. This prevents the user from manually taking the effort to type in these details.
Extracting group and Kaizala user details
We will take an example of a profile card where user details are filled automatically. To achieve this we will be calling two APIs –getConversationDetailsAsync and getUsersDetailsAsync.
Following is a sample usage of these two APIs
“groupDetails” here will receive a bunch of information about the group.
“currentUserInfo” contains details more specific to the logged in user.
Extracting O365 details of user
You can sign in to your O365 office account by selecting “Linked Accounts” in Kaizala “Profile” tab and then clicking on “Sign-in with Office 365 account” .
Note: Pre-requisites for signing in to O365 account include Microsoft Authenticator App and the Intune Company Portal App both provided by Microsoft. This is available on PlayStore as well as AppleStore.
You can check if a user is signed in to his O365 account using the isCurrentUserO365SubscribedAsync API which returns true/false depending on whether he is signed in or not. If he is signed in you can receive his O365 details by calling the getO365UserDetailsAsync API.
For a user who has not signed into his O365 account using Kaizala, we print a “User has not signed in” message. Apart from email and job title, there are many other details provided by getO365DetailsAsync API like his mobilePhoneNumber, businessPhone, jobTitle in company etc.
You can find the profile card code which uses all these APIs here.