Choice interface

An instance of a choice that can be used to render a choice to a user or recognize something a user picked.

Remarks

The value will be rendered to a user unless an action is provided in which case the actions title will be rendered to the user.

At recognition time the value will always be what gets returned by findChoices() and recognizeChoices(). By default, the users utterance will be compared against all of the strings provided in the choice. You can disable using the value and/or action.title during recognition using the FindChoicesOptions structure.

const choice = {
    value: 'red',
    action: {
        type: 'imBack',
        title: 'The Red Pill',
        value: 'red pill'
    },
    synonyms: ['crimson', 'scarlet', 'ruby', 'cherry']
};

Properties

action

(Optional) action to use when rendering the choice as a suggested action. This MUST be a complete action containing type, title, and value fields. If not specified an imBack action will be generated based on the choices value field.

synonyms

(Optional) list of synonyms to recognize in addition to the value and action fields.

value

Value to return when recognized by findChoices(). Will also be used to render choices to the user if no action is provided.

Property Details

action

(Optional) action to use when rendering the choice as a suggested action. This MUST be a complete action containing type, title, and value fields. If not specified an imBack action will be generated based on the choices value field.

action?: CardAction

Property Value

CardAction

synonyms

(Optional) list of synonyms to recognize in addition to the value and action fields.

synonyms?: string[]

Property Value

string[]

value

Value to return when recognized by findChoices(). Will also be used to render choices to the user if no action is provided.

value: string

Property Value

string