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)
parameter | Type | Description |
---|---|---|
url | string | The URL to send the input data to |
options | Object | An object containing optional parameters (max_digit, min_digit & timeout) |
timeout | number | Time in seconds to wait for input |
max_digit | number | Maximum number of digits expected from the user input |
min_digit | number | Minimum 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:
- Node.js
- Python
const { PiopiyAction } = require("piopiy");
const action = new PiopiyAction();
action.input("https://example.com/action", {
timeout: 20,
max_digit: 4,
min_digit: 2,
});
from piopiy import Action
# Create an instance of the Action class
action = Action()
action.input("https://example.com/action", { "timeout": 20, "max_digit": 4, "min_digit": 2})