how to use javascrip includes

how to use javascrip includes

Hello @tech ,

In builder, we have script node, there you may use the includes function of javascript.

Example:

Let’s say u take user input into variable, and later want to parse the input for some key words and set tags accordingly you can use:

var uInput = context.entities.actualUtterance;
if (uInput.includes("refund",0)) {
    tags.addMessageLevelTag("requestType","refund");
}
else
{
        tags.addMessageLevelTag("requestType","general query");
}

Hope this helps!

1 Like