Output Helpers

Jovo Output helpers offer a set of methods that make it easier to build great output templates.

Introduction

The OutputHelpers class offers a variety of methods that help you interact with Jovo output templates. For example, the randomize() method helps you add variety to your output.

import { OutputHelpers } from '@jovotech/output';
// ...

OutputHelpers.randomize([
  // ...
]);

Helpers

  • randomize: Pick a random element from a string.

randomize

The generic message and reprompt elements already support randomization. If you add an array, one random item gets picked:

{
  message: [
    'Hi!',
    'Hello!',
    'Hey there.',
  ],
}

For other elements, you can use the randomize helper to add variety to your output:

import { OutputHelpers } from '@jovotech/output';
// ...

OutputHelpers.randomize([
  // ...
]);