Latest Legacy

The GetDigits element

Note: The GetInput XML element is designed to replace Plivo’s older GetDigits XML element, which only supports the collection of digit press inputs. We recommend you use GetInput instead of GetDigits even if you only intend to collect digit press input from users.

You can use the GetDigits element to collect the digits entered by a caller. Once the caller finishes entering the digits, the API submits the data to the provided action URL using a HTTP GET or POST request.

You can play a message nested inside the GetDigits element while the digits are being received in the background, which is useful for creating an interactive voice response (IVR) tree.

Nesting rules

You can nest Speak and Play elements within the GetDigits element.


action stringCallback-retry configurable

The URL to which the digits are sent. See the “Parameters sent to the action URL” table below for more information.

Allowed values: a full qualified URL

method string

Method used to send HTTP request to the action URL.

Allowed values: GET, POST
Defaults to POST.

timeout integer

Time in seconds to wait to receive the first digit. If the user fails to provide input within the timeout period, the next element in the response is processed.

Allowed values: any positive integer
Defaults to 5.

digitTimeout integer

Time in seconds allowed between consecutive digit inputs. If input is not provided within the digitTimeout period, digits entered until then will be processed.

Allowed values: any positive integer
Defaults to 2.

finishOnKey string

A digit that the user can press to submit digits.

Allowed values: One and only one of  0–9, *, #, <empty string>, none
Defaults to #.

If set to <empty string> or none, input capture will end based on a timeout or the numDigits attribute.

numDigits integer

Maximum number of digits to be processed in the current operation. Only the number of numDigits is captured; any additional digits entered are ignored.

Allowed values: integer >= 1
Defaults to 99.

retries integer

Indicates the number of retries the user is allowed to input digits if digits are not received within the time specified by timeout.

Allowed values: integer >= 1
Defaults to 1.

redirect boolean

Redirect to action URL if true. If false, request the URL and continue to next element.

Allowed values: true, false
Defaults to true.

playBeep boolean

Plays a beep when all Speak and Play elements finish executing.

Allowed values: true, false
Defaults to false.

validDigits string

Specifies the set of digits the user is allowed enter.

Allowed values: any digit, #, *
Defaults to 1234567890*#

invalidDigitsSound string

URL of the sound file to be played when the user enters an invalid digit.

Allowed values: Any remote sound file URL (MP3 or WAV)

log boolean

If true, Plivo logs digits entered by the caller, and you can view them in debug logs. If false, logging is disabled during GetDigits element processing.

Allowed values: true, false
Default is true.

Parameters sent to the action URL

These parameters are sent to the action URL after DTMF input is captured.


The digits input by the caller, excluding the finishOnKey digit if used.