Workflow Designer

Version added 09-Aug-2018| Modified 23-Apr-2019

Workflow Designer is a GUI-based utility which allows you to add AI logic to your web app, without actually modifying its source code. This makes your web app context-aware and therefore provides a better experience to your customers.

For example, without updating the source code of your app, you can configure it to perform operations on voice instructions.

In this initial release, only voice AI logic (Google Assistant) is provided. Make sure Google assistant is set-up.

This functionality is provided by an ecosystem that includes the Workflow Designer and the Context Intent Manager (CIM). While the Workflow Designer is used to define the workflow, the CIM is used to execute the flow. The CIM component that is provided in the webOS image, interacts with the AI engine and the workflow to provide the required functionality. Check the video below for a basic walkthrough.

Some of the main benefits of Workflow Designer are:

  • Reduces time spent in developing AI logic in the web app.

  • Developer does not need in-depth understanding of AI engines.

  • Does not increase the code size and complexity.

Workflow Designer and CIM are based on IBM’s Node-RED framework. In this document, we only explain the aspects that are specific to the webOS implementation. For information on general usage of the Node-RED framework, see https://nodered.org/docs/.

About Releases

v1.0.0 (April 21, 2019)

This is the first official release of Workflow Designer. 

Known Issues

  • None


Installation

Workflow Designer can be run on systems that meet the following criteria: 

Operating System System Requirements

Windows

  • Windows 7 and later

  • Intel Pentium 4 processor or later that's SSE2 capable

  • 512 MB of RAM

macOS

  • macOS 10.10 Yosemite and macOS 10.12 Sierra (64-bit)

  • Intel processor (64-bit)

  • 512 MB of RAM

Linux

  • Ubuntu 16.04 LTS

  • Intel Pentium 4 processor or later that's SSE2 capable

Installation Package

Download the package based on your operating system and then extract the archived package.

Linux

macOS

Windows

Using Workflow Designer

Start the Workflow Designer by executing the .cmd or .sh file (depends on the operating system). The high-level steps for using the Workflow Designer are explained in the following image (gif):

ose-workflow-designer-usage-high-level-steps.gif

A few details about using Workflow designer.

  1. Define the workflow.

    The Workflow Designer provides an easy-to-use interface to define the workflow. All functionality is provided by nodes which have to be added based on your business logic.

    Application developer must ensure that the required launch parameters are handled in the web app.
  2. Package the workflow into the web app and create an updated IPK file.

  3. Deploy the app onto the target webOS device.

    Make sure the webOS image on the device includes the CIM component.

To learn more about Workflow Designer, see the application-level help provided in the user interface (click Help on the Menu bar). For help on individual nodes, click a node and see the corresponding documentation in the right pane.

Source Code Updates to Handle Data Sharing

If the workflow is defined to get data from the app ("data-inject" node) or to publish data to the app ("data-publish" node), minor updates must be made in the app source code. 

  • To inject data from app to the workflow, invoke API : com.webos.service.contextintentmgr/injectDataToWorkflow

  • For app to receive data from the workflow, invoke API : com.webos.service.contextintentmgr/getDataFromWorkflow

For more information on the APIs, see com.webos.service.contextintentmgr

Workflow Designer Explainer Video

Appendix: Google Assistant Setup

For the voice AI logic to work on app, you need to set up Google Assistant on your device.

 

Step A: Create credentials.json file.

  1. ​Create a Google account. 

  2. Go to the Actions Console and perform the following steps:

    1. Create a new project.

    2. Register your device model and download the OAuth-2.0 credentials file. (See instructions.)
      Note: It is recommended that you select the device type as Auto to avoid errors during the setup. 

  3. After downloading the file,

    1. Move it from your local PC to /etc/googleAssistant/client_secret.json on your device using the command:​
      $ scp <downloaded json file> root@<your device ip>:/etc/googleAssistant/client_secret.json 

    2. From the device, run the following script:
      $ cd /etc/googleAssistant
      $ ./get_credentials.sh

  4. Go to the URL generated by the above script. It provides some code.

  5. Copy the code and paste it on the device terminal and run the code. It creates the 'credentials.json' file. 

  6. Enable Google Assistant API, and configure the consent screen and activity controls for your project/account. (See instructions.)

Step B: Register the device ID.

  1. Open device_id.json file. 
    $ cd /etc/googleAssistant
    $ vi ./device_id.json

  2. Modify the fields:

    • id - Input the device instance string. Typically, 'my_webos'.

    • model_id -  Input the device model ID registered in Step A.

  3. Register the device using the command:
    $ ./register_device_id.sh

Step C: Input the device model and device ID for AI service.

  1. Enter the command:
    $ vi /var/systemd/system/env/ai.env

  2. Modify the fields:

    • GOOGLEAI_DEVICE_MODEL - Input the device model ID registered in Step A.

    • GOOGLEAI_DEVICE_ID - Input the device instance string registered in Step B.

Step D: Reboot device or restart service daemon.

  • Enter the command:
    $ reboot
    OR,
    $ systemctl restart ai

Step E: Launch the service using the start() method.

 

Note: Google assistant also supports custom device actions.

  • For more information on the custom actions file, refer to /etc/googleAssistant/action.en.json. 
  • Requires the gactions CLI tool.

Troubleshooting Tips

  • Workflow Designer uses PORT 1881 for operation and must therefore be kept free. It must not be used for other purposes.
Except as noted, this content is licensed under Creative Commons Attribution 4.0 and sample code is licensed under Apache License 2.0.