Sending data from the app

You may want your app to communicate with the AI assistant and send data to it. For example, it may be necessary to:

  • Send authentication data from the app to the dialog script

  • Send the app state to the dialog script so that Alan AI understands what page or screen is currently active and provides relevant responses

  • Perform some logic without a voice or text command, for example, play a message in response to user’s actions in the app

In Alan AI, the app can send data to the dialog script in the following ways:

  • With authData: authData lets you send any kind of authentication or configuration data from the app to the dialog script.

  • With visual state: the visual state object lets you send the state of the app to the dialog script. It can be helpful if you want to inform Alan AI about the current visual context and adjust the logic in the dialog, accordingly. For example, you can filter out some commands, give responses applicable to the open page or screen and so on.

  • With project API: the project API has a more general usage scope. It can be helpful if you need to send some information to the dialog script or perform actions (play messages, call functions, set variable values) without a voice or text command.