Constructor
new DataQueryContext(request)
- Description:
- Constructor of data query context. DO NOT USE - INSTANCE IS ALREADY PASSED TO EVENT HANDLERS
- Source:
Parameters:
Name | Type | Description |
---|---|---|
request |
object |
Extends
Methods
constructMessagePayload(payload) → {object}
- Description:
- Creates a message payload object
- Source:
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
payload |
object | can take a string message, a message created by the MessageFactory, or a message created by the deprecated MessageModel. |
Returns:
message payload in JSON format
- Type
- object
createEndFlowPostbackAction(the, action)
- Description:
- Creates a postback action that ends the flow with the specified end flow action.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
the |
string | label of the postback button |
action |
string | the end flow action that can be used to transition in the main flow |
createFollowUpQueryAction(buttonLabel, the, the) → {PostbackActionType}
- Description:
- Create a CMM postback action that when clicked / tapped by the user will execute a follow-up query.
- Source:
- Deprecated:
- Use createQueryAction instead, this returns a PostbackAction created using the MessageFactory which replaces the deprecated MessageModel.
Parameters:
Name | Type | Description |
---|---|---|
buttonLabel |
string | |
the |
string | OMRL query |
the |
string | title that is used when displaying the query results |
Returns:
the postback action to execute the query
- Type
- PostbackActionType
createInvokeFlowPostbackAction(the, flowName)
- Description:
- Creates a postback action that invokes the specified flow.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
the |
string | label of the postback button |
flowName |
string | name of the flow to invoke |
createQueryAction(buttonLabel, the, the) → {PostbackAction}
- Description:
- Create a CMM postback action that when clicked / tapped by the user will execute a follow-up query.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
buttonLabel |
string | |
the |
string | OMRL query |
the |
string | title that is used when displaying the query results |
Returns:
the postback action to exeute the query
- Type
- PostbackAction
getAttributeUISettings(attributeName)
- Description:
- Returns the attribute UI settings for a specific attribute
- Source:
Parameters:
Name | Type | Description |
---|---|---|
attributeName |
string |
getAttributesUISettings()
- Description:
- Returns an array of the attribute UI settings
- Source:
getChannelType() → {string}
- Description:
- Return the channel conversation type
- Source:
- Overrides:
Returns:
the channel type
- Type
- string
getLayout()
- Description:
- Returns the layout used to render the query result set. One of table, form or tableForm.
- Source:
getLogger() → {object}
- Description:
- Retrieves the logger object.
- Source:
- Overrides:
- Deprecated:
- use logger() function instead
Returns:
The logger object.
- Type
- object
getMessageFactory() → {MessageFactory}
- Description:
- Returns the MessageFactory class for creating bots messages
- Source:
- Overrides:
Returns:
The MessageFactory class
- Type
- MessageFactory
getMessageModel() → {MessageModel}
- Description:
- Returns the MessageModel class for creating or validating messages to or from bots.
- Source:
- Overrides:
- Deprecated:
- Use getMessageFactory() instead
- See:
-
- MessageModel.js
Returns:
The MessageModel class
- Type
- MessageModel
getOMRLQuery()
- Description:
- Returns the OMRL query
- Source:
getQueryExecutionTime()
- Description:
- Returns the time it took to execute the query
- Source:
getQueryResult() → {object}
- Description:
- Returns the result of the query
- Source:
Returns:
query result
- Type
- object
getRequest() → {object}
- Description:
- Retrieves the request object.
- Source:
- Overrides:
Returns:
The request object.
- Type
- object
getResponse() → {object}
- Description:
- Retrieves the response object.
- Source:
- Overrides:
Returns:
The response object.
- Type
- object
getRootEntity() → {string}
- Description:
- Return the name of the root entity of the query
- Source:
Returns:
root entity name
- Type
- string
getRowCount() → {number}
- Description:
- Returns the number of rows returned by the query
- Source:
Returns:
row count
- Type
- number
getSQLQuery()
- Description:
- Returns the SQL query that is executed
- Source:
getUISettings()
- Description:
- Returns the UI Settings
- Source:
getUserMessage() → {NonRawMessage}
- Description:
- Returns the last user message.
- Source:
- Overrides:
Returns:
the last user message. You can cast this message to the appropriate message type.
- Type
- NonRawMessage
getVariable(name) → {object}
- Description:
- Returns the value of a context or user variable
- Source:
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
name |
string | name of the variable |
Returns:
variable value
- Type
- object
getVariableDefinition(name)
- Description:
- Get the definition of a variable
- Source:
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the variable |
invokeFlow(flowName)
- Description:
- Invoke another flow
- Source:
Parameters:
Name | Type | Description |
---|---|---|
flowName |
string | name of the flow to invoke |
isFollowUpQuery()
- Description:
- Return true when the query executed is a follow-up query
- Source:
logger() → {object}
- Description:
- Retrieves the logger object.
- Source:
- Overrides:
Returns:
The logger object.
- Type
- object
nlpResult(nlpVariableNameopt) → {NLPResult}
- Description:
- Returns an NLPResult helper object for working with nlpresult variables.
See the NLPResult documentation for more information.
If your skill uses visual flows, you don't need to specify a variable name. If your skill uses a YAML flow, you may specify a particular nlpresult by name (if you have multiple nlpresult variables defined in the flow), or omit the name if you only have 1 nlpresult.
- Returns an NLPResult helper object for working with nlpresult variables.
See the NLPResult documentation for more information.
- Source:
- Overrides:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
nlpVariableName |
string |
<optional> |
variable that holds the nlpResult |
Returns:
The nlp resolution result.
- Type
- NLPResult
setAttributeUISettings(attributeName, settings)
- Description:
- Change the attribute UI settings for a specific attribute
- Source:
Parameters:
Name | Type | Description |
---|---|---|
attributeName |
string | |
settings |
ReadOnlyFieldMetadata |
setEndFlowAction(action)
- Description:
- The end flow action that is set that can be used to transition to a different flow by defining a mapping for this action in the main flow.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
action |
string | the end flow action that can be used to transition in the main flow |
setQueryResult()
- Description:
- Modify the query result
- Source:
setUISettings()
- Description:
- Change the UI settings
- Source:
setVariable(name, value)
- Description:
- Sets the value of a context or user variable
- Source:
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
name |
string | name of the variable |
value |
object | value of the variable |
translate(rbKey, …rbArgs) → {string}
- Description:
- Get translated string using a resource bundle key defined in the skill.
- Source:
- Overrides:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
rbKey |
string | key of the resource bundle entry defined with the skill that should be used to translate | |
rbArgs |
string |
<repeatable> |
substitution variables |
Returns:
resource bundle freemarker expression that will be resolved when event handler or custom component response is
received by dialog engine
- Type
- string
variable(name, valueopt)
- Description:
- Read or write variables defined in the current flow.
It is not possible to change the type of an existing variable through
this method. It is the caller's responsibility to ensure that the
value being set on a variable is of the correct type. (e.g. entity,
string or other primitive, etc).
A new variable can be created. However, since the variable is not defined in the flow, using it in the flow subsequently may be flagged for validation warnings.
This function takes a variable number of arguments.The first form: variable(name); reads the variable called "name", returning its value. The name could be in the form of <scope>.<variableName>. For example, a variable firstName in the profile scope needs to be retrieved as variable("profile.firstName").
The second form: variable(name, value); writes the value "value" to the variable called "name".
- Read or write variables defined in the current flow.
It is not possible to change the type of an existing variable through
this method. It is the caller's responsibility to ensure that the
value being set on a variable is of the correct type. (e.g. entity,
string or other primitive, etc).
- Source:
- Overrides:
Example
let firstName = conversation.variable("profile.firstName");
let lastName = conversation.variable("profile.lastName");
conversation.variable("fullName", firstName + ' ' + lastName);
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | The name of variable to be set or read | |
value |
string |
<optional> |
value to be set for variable |