How to get user info from context to display on Smartassist Agent console

Here are the sample steps in which the bot asks for the user details like first name, last name, email, and ID and displays these details while transferring to an agent.

  1. In the dialog task, we have 4 entity nodes that ask the user for first name, last name, email, and ID details. After the entity nodes add the below script in the script node in the bot action node which is used to store the entity details in the context object.

UserSession.put(‘<variable_name_to_store_in_context>’,<entity_node_path>)

Script:

UserSession.put('fName',context.entities.firstName);
UserSession.put('lName',context.entities.lastName);
UserSession.put('email',context.entities.emailID);
UserSession.put('id',context.entities.ID);

  1. Now in the agent transfer task in the automation bot, before the agent transfer node add the message prompt, and in the advanced mode, add the below utils script to set the user info.

Advanced JS script:

var userType = [
{
"firstName": context.session.UserSession.fName,  //context path of the first name
"lastName": context.session.UserSession.lName,  //context path of the last name
"email": context.session.UserSession.email,  //context path of the email
"ID": context.session.UserSession.id  //context path of the id
}];

agentUtils.setUserInfo(userType[0]);

  1. After configuring the two steps publish the automation bot.

Here is the sample example for your reference:

Bot asked for the user details in the dialog task and then while transferring to an agent the user info is set instead of anonyms.

@praveen.adari’s Sowjanyam.