How to Use
koreUtil libraries can be used anywhere in the AI Agent where there is flexibility to write JavaScript code such as script node, message node, confirmation node, entity node, standard responses, answers to FAQs, small talk, event handlers, etc.List of koreUtil Libraries
Below is the list of koreUtil libraries provided by the Platform:koreUtil.rrule
koreUtil.rrule is a platform-offered JS library for creating new recurrence rules, interpreting and reading them in human-readable format. Usage Example:-
For
context.between: -
For
context.readableFormat:
koreUtil.moment
koreUtil.moment is a platform-offered JS library for validating, manipulating, and formatting dates. Usage Example:context.german:
koreUtil.intl
koreUtil.intl is a platform-offered JS library for language-specific string comparison, number formatting, and date and time formatting. Usage Example:- For
context.formattedNumberUK:123,456.789 - For
context.USdate:12/20/2012
koreUtil.momenttz
koreUtil.momenttz is a platform-offered JS library for the formatting of dates in any timezone and converting dates between timezones. Usage Example:- For
context.newyork:5am PDT - For
context.tokyo:7pm JST - For
context.sydney:9pm AEDT
koreUtil.xml2js
koreUtil.xml2js is a Platform-offered JS library for parsing XML to JSON and vice versa. Usage Example:koreUtil.hash
koreUtil.hash is a Platform offered JS library that supports SHA on JavaScript. Usage Example:context.hashString:
koreUtil._
koreUtil._ is a Platform-offered JS library that provides utility functions for common programming tasks. Usage Example:- For
context.chunkArray:[["a","b"],["c","d"]] - For
context.filterActive:
koreUtil.getCurrentOptions
koreUtil.getCurrentOptions is a platform-offered JS library that provides utility functions to get the current template for language selection standard response options. This can be used to customize the standard response. Post the release of v8.1, this function has been enhanced to return the authorization URL used in the standard response when end-user authorization is requested. Following is the return format for each of the situations:-
For the language selection standard response:
-
For the language ambiguity standard response:
-
For the language switch standard response:
{"new_language": "Español","current_language": "English"} -
For User authorization request standard response:
koreUtil.getAmbiguousIntents
ThekoreUtil.getAmbiguousIntents util function is used to obtain the ambiguous intents list when the Ambiguity Intents Identified event gets triggered. Along with the list of ambiguous intents, the retrieved context object contains additional details such as ambiguity reasons and the engine name that detects the intent (ML, FM, or KG).
Sample Response:
koreUtil.getSessionId
koreUtil.getSessionId is a Platform offered JS library for obtaining the current conversation session ID. Usage Example:koreUtil.closeConversationSession
koreUtil.closeConversationSession is a Platform function for force closing any active conversation. This function can be invoked from any component that supports JavaScript. Usage Example:koreUtil.autoTranslate
koreUtil.autotranslate is a platform function that lets you automatically translate the AI Agent’s response from a language in which it’s configured to the language in which the user is interacting or a language of your choice.To use the
koreUtil.autoTranslate function for language translation, you must have the Access Key provided by your translation service provider, such as Google Translator, Microsoft Translator, etc.
Usage Example:
koreUtil.getFormDefinition
ThekoreUtil.getFormDefinition allows you to get the form definition, which consists of the form meta, form components, and form messages.
Usage Example: