LUA Examples

User Input Examples in LUA

Input contains keywords

Input.match('contains', 'keyword1|keyword2', Context.get('currentMessage'), {})

Input is exactly

Input.match('isEqualTo', 'value', Context.get('currentMessage'), {})

Input matches a regex

Input.match('regex', 'regex expression here', Context.get('currentMessage'), {})

Input matches intent

-- Params    Domain:string, Message:string
-- Returns   Intent Object
-- Ex.
-- intent.categories (contains all the available categories for the domain)
-- intent.confidence.greeting (contains the confidence value, Ex. .91)
intent = Input.intent('generic-es', Context.get('currentMessage'))

-- Branch to a Step Id 1 if Greeting
if intent.confidence.greeting > .90 then
	Workflow.branch(1)
end

-- Branch to a Step Id 2 if Insult
if intent.confidence.insulting > .90 then
	Workflow.branch(2)
end