Skip to main content

Collecting Input

To collect user input during a call in PCMO, you can use the input() method of the PiopiyAction class. This method allows you to collect DTMF (keypad) input from users, such as key presses, and send the collected data to a specified URL for processing.

input(url, options)
parameterTypeDescription
urlstringThe URL to send the input data to
optionsObjectAn object containing optional parameters (max_digit, min_digit & timeout)
timeoutnumberTime in seconds to wait for input
max_digitnumberMaximum number of digits expected from the user input
min_digitnumberMinimum number of digits to collect

Example Implementation

  • The following code demonstrates how to collect user input, such as key presses, and send the data to a specified URL for further processing:
const { PiopiyAction } = require("piopiy");

const action = new PiopiyAction();

action.input("https://example.com/action", {
timeout: 20,
max_digit: 4,
min_digit: 2,
});