Skip to main content

InputText

The InputText action allows your bot to request arbitrary text from the user and save it into a variable.

Parameters

ParameterTypeDescriptionRequired
promptStringThe message prompting the user for text input.
If you intend to use HTML markup in the message, leave this parameter empty (prompt =) and fill out the html parameter instead.
Yes
varNameStringVariable name. The text entered by the user will be stored in $session.<varName>. Use the following characters: Aa–Zz, _, 0–9. The first character should be a letter. JavaScript reserved words are not allowed.Yes
htmlStringThe message prompting the user for text input, with HTML markup.
If you don’t intend to use HTML markup, omit this parameter and use prompt only.
No
htmlEnabledBooleanIf set to true, the bot message will use the html parameter value.
If omitted or set to false, the prompt value will be used.
No
thenStringThe state the dialog will switch to if the tag script completes without errors.No
actionsArray of objectsButtons that will be displayed along with the request. Use the following format for the value:
actions =
  [{
    “buttons”: [{
      “name”: “Button text”,
      “transition”: “/State path”
    }],
    “type”: “buttons”
  }]
No

How to use

state: FeedbackSurvey
InputText:
prompt = How satisfied are you with our service?
varName = feedback
then = /FeedbackSurvey/GetFeedback

state: GetFeedback
a: Thank you for your feedback!
script:
$analytics.setSessionData("Service feedback", $session.feedback);
$jsapi.stopSession();