Alan Electron Framework


Integrating with Alan

To integrate an Electron app with Alan:

  1. Add the Alan Web SDK to your app. You can do it in two ways:

    • With the npm package

    • In the browser library mode

    To install the Alan Web SDK with the npm package:

    1. In the Terminal, run the command:

      npm install @alan-ai/alan-sdk-web --save
      
    2. Include the following <script> tag in the index.html file:

      <script src="node_modules/@alan-ai/alan-sdk-web/dist/alan_lib.min.js"></script>
      

    To load the Alan Web SDK in the browser library mode, add the alan_lib.min.js library to the index.html file using the <script> tag:

    <script type="text/javascript" src="https://studio.alan.app/web/lib/alan_lib.min.js"></script>
    
  2. Add the Alan button to the index.html file:

    <script>
        alanBtn({
        key: 'YOUR_KEY_FROM_ALAN_STUDIO_HERE',
            onCommand: (commandData) => {
                if (commandData.command === 'go:back') {
                    // Call the client code that will react to the received command
                }
            },
        });
    </script>
    

For details, see Alan button parameters.

Trying the Alan sample app

In our GitHub repository, you can find a sample Electron app already integrated with Alan. Download the app to get an idea of how you can voice enable your Electron app and trigger actions in the app with voice commands.

What’s next?

Go to Script concepts to learn about Alan concepts and functionality you can use to create a voice script.