User Custom Attributes
Assign a custom field to your Medchat members
Organizations that need to associate a custom field value -- for e.g., a custom identifier such as a 'Salesforce ID' -- with their Medchat users can do so with the Manage Attribute feature under the Manage Team portal. Medchat Admin users that have either Organization Owner or Member Admin roles can configure these user attributes.
Managing User Attributes
To manage user attributes, navigate to Admin > Manage Team, and under the Team Members page, click on 'Manage Attributes' on the top-right corner of the screen.
In the Manage Attributes dialog, Admins can add, edit, or delete the user attributes. In addition, admins can configure whether a user attribute value can be assigned by Admins only, or by both Admins and Team members.
Deleting User Attributes
Caution: Please note that deleting a user attribute that has assigned values will wipe out all user assigned values that have been added/applied to it by admins/team members.
A. Admins-only User Attributes
For attributes that are configured for Admins-only editing, Org Owner and Member Admins can assign values for each team member by clicking on a record under the Team Members page, clicking on the add/edit icon on the right-side panel, and typing in the attribute value specific to the user.
B. Admins and Team Members User Attributes
For attributes that are configured for Admins and Team Members editing, values can be assigned by non-admin Team Members via the Account Settings dialog:
Edit and Delete option availability
Note that for non-admin users, edit and delete options are only available for attributes configured to be edited by "Admins and Team Members"; attributes configured to be edited by "Admins only" will be read-only.
Viewing User Attributes in Custom Reports
Use Custom Reports to view your organization's user attributes information.
A. View User Attribute values by Attribute Name
To get a report of your team member's custom user attribute assignments/values, navigate to Admin > Custom Reports, and run the following query:
CustomUserAttributes
| join kind=inner Users on UserId
| project LastName, FirstName, EmailAddress, UserId, AttributeName, Value, AttributeId
| order by LastName, FirstName, EmailAddress
| where AttributeName == "Salesforce ID" //example: AttributeName is "Salesforce ID"
The custom report and results should look something like the image below:
In the above sample image, you can see that each Medchat member has a corresponding UserID as well as a corresponding value for the 'Salesforce ID' custom attribute. Also note that the custom attribute 'Salesforce ID' has an AttributeId of bf208510-6438-4879-be87-2c4a706b820c
, which will need to be used when you need to retrieve a specific user's custom attribute value via API calls.
B. View Attribute Names and their respective Attribute IDs
To get a list of your organization's Attribute Names and their respective Attribute IDs for use in API calls, run the following query in Admin > Custom Reports:
CustomUserAttributes
| distinct AttributeName, AttributeId
The custom report and results should look something like the image below:
In the above sample image, you can see that the custom user attributes setup for the org are 'Salesforce ID' and 'Nickname'. Each of these attributes will have their respective unique AttributeId
.
Retrieving User Attribute value for a specific user
Use the guidelines below to retrieve the value of a user attribute from a chat:
- The Get Chat ContextAPI call metadata now includes a Medchat user's
AgentId
, which can now be used to make a subsequent call to get the user's corresponding user attribute details.
{
"value": "d9e1c568-9499-195b-9e90-39f1b7183d68",
"type": "StringRuntimeAttribute",
"chatAttributeId": "f7306ade-624d-10a4-5574-3a1249012926",
"name": "AgentId",
"chatAttributeData": {
"id": "f7306ade-624d-10a4-5574-3a1249012926",
"chatId": "6ac395be-a198-8b84-5324-3a1249007bf7",
"attributeName": "AgentId",
"dataType": "string",
"attributeValue": "d9e1c568-9499-195b-9e90-39f1b7183d68",
"isCustom": false,
"shouldDisplayToAgent": false,
"createdDateTime": "2024-05-02T01:03:55.177101Z",
"updatedDateTime": "2024-05-02T01:03:55.1771012Z"
}
}
- Use the Agent ID's
value
(which is 'd9e1c568-9499-195b-9e90-39f1b7183d68
' in the above sample) with theAttributeId
ofbf208510-6438-4879-be87-2c4a706b820c
in a subsequent Get user's custom attribute by ID API call:
https://auth.medchatapp.com/v1/orgs/{orgId}/users/{userId}/customattributes/{attributeId}
- The call will return the specific agent's user attribute value; see sample body below where the value is
zm12345
:
{
"attributeId": "bf208510-6438-4879-be87-2c4a706b820c",
"value": "zm12345",
"attributeName": "Salesforce ID",
"permissionScope": "AdminOnly"
}
Visit our API reference on User Custom Attribute endpoints here.
Updated 6 months ago