Powered by Algolia

onCommand handler

Responsible for handling commands sent from the Alan voice script.

To accompany user’s utterances with activities in the app UI, you can send commands from the voice scripts to the client app. For example, once the user gives a voice command, another view or page can be opened in the app, a UI element can be selected on the screen and so on.

To send a command, use the play() function in the voice script and pass a JSON object to it. The JSON object contains the command name and, optionally, arbitrary data to be provided to the app. To handle the command on the client side, set up the logic in the onCommand handler in the app.

For details, see Sending commands to the app.