$analytics.setMessageLabel
The method sets labels to client phrases.
Syntax
The method accepts two arguments:
| Argument | Type | Description | Required |
|---|---|---|---|
labelName | String | The label name in a group | Yes |
groupName | String | The name of labels group | No |
$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 catalog → Phrase labels. In the interface, each label must belong to at least one group.
cautionIf you pass a label to the method that doesn’t exist in the catalog, it won’t be added.
-
If the
groupNameparameter 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?")
# ...