Skip to main content

InputPhoneNumber

The InputPhoneNumber action allows your bot to ask the user to enter a phone number and save it into a variable (only Russian phone numbers are supported).

Parameters

ParameterTypeDescriptionRequired
promptStringThe message prompting the user to enter a phone number.
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 phone 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
htmlStringThe message prompting the user to enter a phone number, 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, and the error message will use failureMessageHtml.
If omitted or set to false, the prompt and failureMessage values will be used instead.
No
failureMessageArray of stringsThe list of error messages.
The bot will randomly select and send one of these messages if the user enters an invalid phone number.
No
failureMessageHtmlArray of stringsThe list of error messages with HTML markup.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: Reminder
InputPhoneNumber:
prompt = I can text you the appointment details in an SMS message. Just tell me your phone number.
failureMessage = ["Would you mind repeating your number?", "Please tell me a valid phone number."]
varName = phoneNumber
then = /Reminder/Send

state: Send
Sms:
text = Dr. Smith will be expecting you tomorrow at 12 pm.
destination = {{$session.phoneNumber.slice(1)}}
okState = /Reminder/Send/Success
errorState = /Reminder/Send/Failure

state: Success
a: I’ve just sent you a message at {{$session.phoneNumber}}!

state: Failure
a: Sorry, SMS delivery failed.