Using "user_details" Variable

User Details

The Data that is stored in this context variable will be saved at a user level and will be available for all the conversations that the user has. Data inside user_details will be available across bots and businesses as long as the underlying user is the same in the database.

This context variable should be used for storing permanent details about the user that are not specific to a given conversation like their email, phone number, or other such details.

Value in user_details schema expects data to be a string type. If the user wants to store a list corresponding to the user detail key, then they should handle the serializer/deserializer logic inside the code before returning the response from the code step.

The default value for user details is {'language_code': 'en', 'name': 'Guest User'}

For logged-in bots, the customs data that is passed in the HaptikSDK.signup()is stored in the user_details variable for the code step. Click here to know more about custom sign up.

Why use user_details? 

We collect information from the user such as PAN number, Aadhar number, etc which is stored in the entity, but when the user journey hits an end step on the IVA, the entities get flushed away.

So when the user is returning on the IVA, we will have to ask them these details again. user_details will help to solve this problem. When we store information such as PAN number or phone number, the bot will not ask for these entities again since it is stored locally.

Things to remember while using user_details:

  1. The information which is stored should be related to the user.
  2. The data stored in user details is permanent. As long as the user does not clear their browser cache.
  3. The data storage limit is upto 20 keys in the JSON object.
  4. Each key value limit is upto 1000 characters.

Store such data which is never going to change such as Date of Birth.


Can’t find what you’re looking for? Email us at support@haptik.ai.