InputNumber
The InputNumber
action allows your bot to ask the user to enter a number within the specified range and save it into a variable.
Parameters
Parameter | Type | Description | Required |
---|---|---|---|
prompt | String | The message prompting the user to enter a number. If you intend to use HTML markup in the message, leave this parameter empty ( prompt = ) and fill out the html parameter instead. | Yes |
varName | String | Variable name. The number 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 |
html | String | The message prompting the user to enter a number, with HTML markup. If you don’t intend to use HTML markup, omit this parameter and use prompt only. | No |
htmlEnabled | Boolean | If set to true , the bot message will use the html parameter value, and the error message will use failureMessageHtml . If omitted or set to false , the prompt and failureMessage values will be used instead. | No |
failureMessage | Array of strings | The list of error messages. The bot will randomly select and send one of these messages if the user enters a number not within the allowed range or not a number at all. | No |
failureMessageHtml | Array of strings | The list of error messages with HTML markup. | No |
then | String | The state the dialog will switch to if the tag script completes without errors. | No |
minValue | Number | The minimum allowed number value. | Yes |
maxValue | Number | The maximum allowed number value. | Yes |
actions | Array of objects | Buttons that will be displayed along with the request. Use the following format for the value:
| No |
How to use
state: RatingSurvey
InputNumber:
prompt = How likely are you recommend our service, on a scale from 1 to 5?
failureMessage = ["Would you mind trying that again?", "Please enter a number in the range 1–5."]
minValue = 1
maxValue = 5
varName = rating
then = /RatingSurvey/GetRating
state: GetRating
a: Thank you for rating us!
script:
$analytics.setSessionResult($session.rating);
$jsapi.stopSession();