CognigyScript can be used in order to add dynamic and executable content to any kind of virtual chat/voice conversation. Since there are a lot of different helpful examples, this cheat sheet provides an overview.

General

Script Description
{{input.slots.SLOT_NAME[0].keyphrase}}

Extracts the first found keyphrase for the slot with the name SLOT_NAME

{{JSON.stringify(input.data)}}

Can be used inside of a Say Node in order to display a JSON object as text. Mostly, it is used for debugging purposes. The example shown on the left shows the information the virtual agent received in input.data.

Date & Time

Script Description
{{input.slots.DATE[0].start.plain}}

Returns the locale, human-readable, date information if the user sent a date. Example: July 23, 2021

{{moment(input.slots.DATE[0].start.ISODate).format("MMM Do YY")}}

Format a given date that the user provided in the last message. Read more here.

{{input.currentTime.hour}}

Get the hour of the current incoming message in order to greet the user appropriately.


Comments

0 comments

Article is closed for comments.

Was this article helpful?
0 out of 0 found this helpful