The following, built-in functions in Conversation Builder can be used to programmatically call Conversation Orchestrator capabilities. These functions conveniently wrap the Recommendation APIs. You can use them as part of a Maven Concierge bot to ask Conversation Orchestrator for the next best actions (route to skill, route to Knowledge Base article, etc.).

Both methods return a String of the JSON response from the askMaven API. For a response example, see here.

Function Name Arguments Returns
askMaven() None

By default, this method is invoked on the current conversation, i.e., it uses the current conversation ID.
JSON response (String)
askMaven(String conversationId, String consumerId, String groupId) conversationId (String) - Optional. The conversation ID of the current conversation.

consumerId (String) - Optional. The LivePerson consumer ID for the current conversation.

groupId (String) - Optional. The group ID associated with the session store variable call to set values. If no groupId is specified, then the conversationId will be used to associate with the session store variables.
JSON response (String)


// disable context switching
botContext.setBotVariable('skipPreviousDialog', 'true', true, false);
// ask maven
botContext.printDebugMessage("BEGINNING ASK MAVEN CALL");
var askMavenResponse = botContext.askMaven();
botContext.printDebugMessage("ASK MAVEN RESPONSE:"+askMavenResponse);
var getContextJsonResponse = JSON.parse(askMavenResponse);
var policyActions = getContextJsonResponse.rule.actions;
botContext.setBotVariable("policyActions", JSON.stringify(policyActions), true, false);
botContext.printDebugMessage("policyActions: "+JSON.stringify(policyActions));

// test for NO ACTIONS
  botContext.setTriggerNextMessage("Agent No Actions Found");
} else {
  botContext.setTriggerNextMessage("Agent Maven Response");