Skip to main content
Version: 2.0.0

Metadata & Attribute

This chapter will introduce: what is metadata, what is attribute, and how to use them for personalized response.

What is Metadata?

During each conversation, in addition to identifying the key information (e.g. intent) through NLP, the native information carried by messages (e.g. timestamps, emotions, user attributes) can help the agent better make a response. These kinds of native information are called metadata.

Metadata contains the following common types:

  1. The parameter name and parameter value created externally and passed in together with the message through the dialog interface, such as timestamp, user ID and other information.
  2. The user ID can describe the attribute name and attribute value of the user's portrait, such as user position, member level, etc.
  3. The model calculates based on the message and generates the parameter name and parameter value of additional description information, such as sentiment classification.

Metadata contains the following common types:

  1. The parameter name and parameter value created externally and passed in with the message through the API, such as timestamps and user IDs.
  2. The attribute name and attribute value that can be queried by the user ID to paint a picture of the user, such as user position and membership level.
  3. The parameter name and parameter value generate additional descriptive information based on the message, such as sentiment.

Preset metadata

Preset metadata is information that is automatically generated by the platform when the API is called. Currently, the platform provides the following preset metadata:

Metadata nameAdditional InfoExample
TimezoneTime zone where the session is taking place. For details, see agents.Asia/Shanghai
agent_ IDThe ID of the agent that sends responses. For details, see agents.8016
EnvironmentThe environment where the responses are sent. For details, see train & test.SKETCH

What is Attribute?

Attributes are the most commonly used type of metadata. You can meet most business-related personalization needs through attributes, for example,

  • Send different responses to users with different business attributes or attribute groups.
  • Splice user attributes into responses to make them more personalised.
  • Pass user attributes to third-party APIs to provide users with additional capabilities besides conversations.

You can create and manage user attributes, as well as use them to build the dialogue flow on the platform.

There are two types of attributes -- 'single value' and 'multiple value', which differ in their updated policies.

  • Single value attributes have a single value. The original value will be replaced when updated.
  • Multiple value attributes can have multiple values. The original values will be kept and new values will be added when updated.

Preset attributes

Preset attributes are information that the platform automatically generates for users when they are created, and all preset attributes can be seen in the attributes management page. Currently, the preset attributes available on the platform are as follows:

Attribute nameAdditional Info
ChannelThe ID of the channel the user is on

Create and manage attributes

  1. Click "Build - Custom Configs - attributes" to enter the page. The list displays attribute ID, attribute name, attribute type and operation buttons: no-attribute

  2. Click "+CREATE", set attribute name and attribute type to create a new attribute. create-attribute

  • Single value types are generally mutually exclusive attributes between attribute values. For example, highest education, gender, etc.
  • Multiple value types are generally user tags that can be tagged with multiple values at the same time. For example, speciality, preference, etc.

Change chanel user's attributes

  1. After a user has been created, APIs can be called to manipulate the values of the specified user's attributes. The APIs that may be used for the call are as follows :
    1. Create channel users: MutateChannelUsers/chatbot/v1alpha1/agents/{agentId}/channels/{channelId}/users/mutate
    2. Get channel user's attribute values: GetUserAttributeValue/chatbot/v1alpha1/agents/{agentId}/channels/{channelId}/users/{username}/attribute-value
    3. Set channel user's attribute values: MutateUserAttributeValue/chatbot/v1alpha1/agents/{agentId}/channels/{channelId}/users/{username}/attribute-value/mutate

Use metadata for personalized response

Common reference format and rendering effect of metadata

Reference format: {metadata=METADATA_NAME}

Rendering effect: If the metadata is empty, the rendering is empty. If the metadata is multivalued, all values are currently stitched together with a "," to render the whole as a string.

Reference metadata value in agent response

Metadata value can be referred in:

  • FAQ responses
  • Agent say and Agent reply in dialogue tree
  • Inform block and Request block in dialogue flow

Use metadata value to render responses in the text response editor, the agent will replace the corresponding reference text with the metadata value: refer-metadata

  • If your agent fails to send the response when tested, please double-check the reference format of metadata.
  • A common error is a JSON parsing error caused by a missing { or } of the reference format, so the agent cannot send a message.

Set slot value to metadata values in the compute block

In the "Set slot value to" of compute blocks, assign metadata value to the slot value. compute-metadata

Use metadata value as request parameters in webhook block

In the "Webhook Setting" of webhook blocks, use metadata value as request parameters. webhook-metadata

Use metadata value in other strategies

  1. Set metadata value as branch jumping conditions.
  2. Set metadata value as the default slot value when the agent has exceeded the maximum query times.