Bot Asks Phone Number
The bot asks and recognizes phone numbers in the text provided by the user.
Starting from IBM RPA 23.0.3, support for Interactive Voice Response (IVR) is removed from this command due to the removal of IVR. For more information, see Removed.
Command availability: IBM RPA SaaS and IBM RPA on premises
Script syntax
IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.
botAskPhoneNumber --defaultareacode(String) [--retry(Boolean)] [--attempts(Numeric)] [--retrytext(String)] [--timeoutsub(String)] [--recognitionTimeout(TimeSpan)] [--speechCompleteTimeout(TimeSpan)] [--noInputTimeout(TimeSpan)] [--speechIncompleteTimeout(TimeSpan)] [--confidenceThreshold(Numeric)] [--beep(Boolean)] [--language(Language)] --text(String) [--textformat(String)] [--timeout(TimeSpan)] (String)=utterance (Boolean)=timedout (String)=botHistoryMessageId (List<PhoneNumber>)=values (PhoneNumber)=first (DataTable)=valuesmapping (Boolean)=success
Dependencies
- You must start a Chatbot or IVR instance by using the Connect to Chatbot (
botConnect
) command. - This command must be in the Connect to Chatbot scope.
Input parameters
The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.
Designer mode label | Script mode name | Required | Accepted variable types | Description |
---|---|---|---|---|
Default area code | defaultareacode |
Required |
Text |
Country area code to be recognized in the phone number. |
Retry | retry |
Optional |
Boolean |
Enable to allow the bot to ask a new question if there is no answer on the first try. |
Attempts | attempts |
Optional |
Number |
Number of times the question is repeated. |
Alternatives texts | retrytext |
Optional |
Text |
Alternative question that is asked to the user if there is no answer on the first attempt. |
Time out sub | timeoutsub |
Optional |
Text |
Subroutine that is executed if the user's response time runs out. |
Recognition timeout | recognitionTimeout |
Optional |
Time Span |
Timeout to acknowledge the user's response. |
Speech complete timeout | speechCompleteTimeout |
Optional |
Time Span |
Maximum time allowed without interaction with the bot after its last speech. Starting from IBM RPA 23.0.3, this parameter is removed. |
No input timeout | noInputTimeout |
Optional |
Time Span |
Timeout for the user to start the conversation. Starting from IBM RPA 23.0.3, this parameter is removed. |
Speech incomplete timeout | speechIncompleteTimeout |
Optional |
Time Span |
Maximum amount of time to wait for the user to complete the speech. Starting from IBM RPA 23.0.3, this parameter is removed. |
Confidence threshold | confidenceThreshold |
Optional |
Number |
Numeric expression that indicates the confidence level for recognizing user response. Confidence rate is in the range 1 - 100. If the obtained value is lower than the specified range, it returns null. Starting from IBM RPA 23.0.3, this parameter is removed. |
Beep | beep |
Optional |
Boolean |
Enable to play a beep each time that the bot speaks. Starting from IBM RPA 23.0.3, this parameter is removed. |
Language | language |
Optional |
Language |
Language used for bot communication. Use the Create a Language (createLanguage ) command to get the language variable. |
Text | text |
Required |
Text |
First question that is asked to get the phone number. |
Text Format | textformat |
Optional |
Text , BotTextFormat |
Specifies the text format to send to the chat, either Plain Text or Markdown (default). |
Timeout | timeout |
Optional |
Time Span , Number , Text |
Timeout for waiting for user response. |
Output parameters
Designer mode label | Script mode name | Accepted variable types | Description |
---|---|---|---|
Utterance | utterance |
Text |
Returns the text provided by the user. |
Timed out | timedout |
Boolean |
Returns True if the time has run out, otherwise returns False . |
History Message | botHistoryMessageId |
Text |
Identifier for other commands to save their history along with the history of this command. This field returns the identity value of the saved history if one has been set to the Storage Adapter parameter of the Connect to Chatbot ( botConnect ) command. To use it, simply add this output to the command specific input parameter of which the history you want to link to this command's
history. |
Values | values |
List<Phone Number> |
List of phone numbers recognized in user-entered text. |
First | first |
Phone Number |
First phone number recognized in the text. |
Values mapping | valuesmapping |
Data Table |
Data table that returns the position of the phone number in the sentence you entered, its size, and the text itself. |
Success | success |
Boolean |
Returns True if the script runs successfully, otherwise returns False . |
Example
The Bot Asks Phone Number command recognizes the phone numbers on the sentence "My telephone numbers are +(1)(425) 555-0100 and +(1)(425) 555-0524", entered by the user, returning these numbers.
defVar --name robotLanguage --type Language
defVar --name chatConnection --type ChatData
defVar --name conversationUtterance --type String
defVar --name obtainedPhoneNumbers --type List --innertype PhoneNumber
defVar --name mappingValue --type DataTable
defVar --name firstPhoneObtained --type PhoneNumber
createLanguage --culture "enUS" robotLanguage=value
botConnect --type "Chat" --language ${robotLanguage} --autoanswer --timeout 00:01:00 chatConnection=chat
botSay --language ${robotLanguage} --text "Hi! I am a ChatBot."
botAskPhoneNumber --defaultareacode 1 --beep --language ${robotLanguage} --text "What\'s your phone number?" --timeout 00:01:00 mappingValue=valuesmapping firstPhoneObtained=first conversationUtterance=utterance obtainedPhoneNumbers=values
logMessage --message "Values: ${obtainedPhoneNumbers}\r\nMapped Values: ${mappingValue}\r\nStatement: ${conversationUtterance}\r\nFirst: ${firstPhoneObtained}" --type "Info"
// Sample Values: [(1)(425) 555-0100, +(1)(425) 555-0524]
// Mapped Values: 1, 25, 13, (1)(425) 555-0100, 1, 425, 555-0100,
// 2, 41, 12, 555-0524, 1, 425, 555-0524
// Statement: My phone numbers are +(1)(425) 555-0100 and +(1)(425) 555-0524
// First: +(1)(425) 555-0100
botDisconnect
Limitations
-
If the amount of time specified in the Recognition timeout, No input timeout, Speech complete timeout, Speech incomplete timeout, and Timeout parameters runs out, the interaction is forwarded to the subroutine specified in the Time out sub parameter.
-
The Recognition timeout, No input timeout, Speech complete timeout, Speech incomplete timeout, and Beep parameters are specific for IVR communication.
-
If no value is defined for the timeout parameters, the default timeout is 5 seconds. You can change the default timeout by using the Set Timeout (
setTimeout
) command.