Apply Labels
Verb: applyTags
Adds or removes a tag from a collection.
The tags can be used in a Chatbot to interrupt interactions, perform specific actions, making it possible to achieve a specific goal.
Syntax
applyTags --collection(List<String>) --tags(String)
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--collection | Collection | Required | List<Text> | Collection to which tags are added or removed. |
--tags | Tags | Required | Text | Text that defines the tags that must be added or removed from the list.
The use of more than one "+" or "-" operator indicates the number of times a label must be inserted or removed from the list. |
Example
Example 1: The Apply Labels command adds the tag "Social" to a collection.
defVar --name collection --type List --innertype String --value "[Sale,Interest]"
logMessage --message "Collection before adding a new tag: ${collection}" --type "Info"
applyTags --collection ${collection} --tags "+Social"
logMessage --message "Collection after adding a new tag: ${collection}" --type "Info"
//
// The execution of the script returns:
// Collection before adding a new tag: [Sale,Interest]
// Collection after adding a new tag: [Sale, Interest, Social]
Example 2: The syntax "+social, ++work, +++health" inserted in the command Apply Labels adds the tags "Social" once, "Work" twice and "Health" three times to a collection.
defVar --name tags --type List --innertype String
applyTags --collection ${tags} --tags "+social, ++work, +++health"
logMessage --message "Inserted tags: ${tags}" --type "Info"
//
// The execution of the script returns:
// Inserted tags: [social,work,work,health,health,health]