Cheat Sheet: CognigyScript – Cognigy.AI Help Center

Cheat Sheet: CognigyScript

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
<br>{{input.slots.SLOT_NAME[0].keyphrase}}<br> Extracts the first found keyphrase for the slot with the name SLOT_NAME
<br>{{JSON.stringify(input.data)}}<br> 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
<br>{{input.slots.DATE[0].start.plain}}<br> Returns the locale, human-readable, date information if the user sent a date. Example: July 23, 2021
<br>{{moment(input.slots.DATE[0].start.ISODate).format("MMM Do YY")}}<br> Format a given date that the user provided in the last message. Read more here.
<br>{{input.currentTime.hour}}<br> Get the hour of the current incoming message in order to greet the user appropriately.

Best Practices