Skip to main content

$analytics.setMessageLabel

The method sets labels to client phrases.

Syntax

The method accepts two arguments:

ArgumentTypeDescriptionRequired
labelNameStringThe label name in a groupYes
groupNameStringThe name of labels groupNo
$analytics.setMessageLabel("labelName", "groupName")

The label set to a particular phrase will be displayed in the Analytics > Dialogs section and in the phrases report.

Usage details

  • Before using a label in your script, you must create it in the interface. To do this, click in the upper-right corner and go to Label catalogPhrase labels. In the interface, each label must belong to at least one group.

    caution

    If you pass a label to the method that doesn’t exist in the catalog, it won’t be added.

  • If the groupName parameter is omitted, the label will be added to all groups it belongs to.

  • A label that is inactive in the interface will still be added to the report.

  • If there are multiple labels with the same name, all of them will be applied.

How to use

state: Help
a: How can I help you?

state: Return
intent: /returnPurchase
script:
$analytics.setMessageLabel("Returning purchase", "Question category")
$reactions.answer("What is your order number?")
# ...