Logo

    Home

    Documentation

    Use Cases

    Training

    Applications

    Release Notes

    Run an automation workflow

    Run an automation workflow

    icon
    Run an automation workflow in your workspace
    • 1. Summary
    • 2. Result
    • 3. Step by Step Guide
    • Variables
    • Automation Hub Client
    • From 23.13.0
    • Sample Application
    • API Endpoint
    • Click Event Handler
    • Client Logic
    • Workflow
    • Update the Automation Hub version in a repository
    • Calling Automation Hub workflow from pasoe
    • 4. Documentation

    1. Summary

    The automation workflow can be triggerd

    2. Result

    Automation hub is triggered successfully

    3. Step by Step Guide

    Variables

    GitPod-Url: <Workspace url> Workflow-Name: my-workflow

    Automation Hub Client

    Automation hub client runs on port 5678, so in GitPod you change 8080 to 5678 https://8080-(...).gitpod.io/ -> https://5678-(...).gitpod.io/

    Automation Hub is reachable via: <url>/service/automation $ b1 export-automation workflows Exports workflows to src/backend/data/n8n $ b1 import-automation workflows Imports workflows from src/backend/data/n8n

    From 23.13.0

    $ b1 export-automation now supports as parameter workflows|credentials to specify, if either workflows or credentials will be exported to the gitpod workspace. Only workflows will exported to the repository. As a second parameter also the filename of the export file can be specified. Exporting workflows is also possible with the button Export Automation-Hub in the CI/CD desktop

    $ b1 import-automation also supports the parameter workflows|credentials to specify if workflows or credentials will be imported. Additionally it is also possible to update the workflows during import process to reference the right credentials. So you can specify per environment which credentials will be used. To enable that, you have to define a suffix for the credentials name e.g. testCredentials_dev or testCredentials_prod. On import of workflows you can specify two additional parameter, which check your current workflows and replace the reference to the correct ones. b1 import-automation prod dev will check your workflows to credentials with suffix dev and replace it with credentials with suffix prod (if the name is the same).

    Sample Application

    Screen Blueprint -> Samples -> SampleAutomationWindow

    Client Logic src/webui/akioma/ts/src/client-logic/_export/Samples/N8nButtonForm.ts

    API Endpoint

    Just for reference or testing. In GitPod https://[GitPod-Url]>/service/n8n/webhook(-test)/[Workflow-Name]/

    Click Event Handler

    payload can be any (eval-able) object.

    #.runAutomationWorkflow({
      context: {
        eventSource
      },
      workflowName: 'my-workflow',
      payload: '$_[({
          hardcoded: \'my hard coded value\',
          ...context.eventSource.window.getObject(\'N8nUserForm\').getAllScreenValues()
      })]_$',
      options: { isTest: true }
    })

    Client Logic

    the button on the screen has a click event handler see Comment in src/webui/akioma/ts/src/client-logic/_export/Samples/N8nButtonForm.ts

    Choose one method to send payload to workflow automation

    Workflow

    Create a flow and name it [Workflow-Name]

    Add a Webhook

    change HTTP Method to POST change Path to [Workflow-Name] change Respond to When Last Node Finishes implement your workflow

    Add a code block, e.g. for renaming the keys

    return {
      firstName: items[0].json.body.payload.N8nFirstNameInput,
      lastName: items[0].json.body.payload.N8nLastNameInput,
      userId: items[0].json.body.session.currentUser,
      userDescription: items[0].json.body.session.sessionId,
    };

    Don’t forget to execute it every time (in development mode)

    Update the Automation Hub version in a repository

    • Go to .build/compose/base.docker-compose.ym
    • Change the line for Automation Hub with the correct Automation Hubimage version
      • For example
      • Automation Hub:
            image: docker.cloudsmith.io/buildone/repository/n8n-custom:1.0.1
    • Use b1 gencom in the cli to regenerate the files below .deploy/

    Calling Automation Hub workflow from pasoe

    • Instead of using http://localhost:8080/service/automation/webhook/ENDPOINT (which can be uses e.g. from thunderclient in gitpod workspace, the handling when calling Automation Hub workflows from pasoe is different
    • In pasoe use the container name instead of locale host and the configured Automation Hub port, e.g. http://n8n:5678/webhook/ENDPOINT

    4. Documentation

    To find more information, you can check the following documentation.

    Automation HubAutomation Hub

    Back to Use CasesUse Cases

    Back to Home Page

    Logo
    // #### USING runWorkflow
    const result = await window.akioma.automation.runWorkflow(args);
    const message = { type: result.status, text: result.payload };
    window.akioma.notification(message);
    
    // #### USING invokeServerTask
    const opts = {
      name: 'automation',
      methodName: args.workflowName,
      methodType: 'automation',
      paramObj: {
        context: args.context,
        payload: args.payload,
        options: args.options
      }
    };
    
    let message: { type: 'error' | 'success', text: string };
    
    window.akioma.invokeServerTask(opts)
      .done((result: any) => {
        message = { type: 'success', text: result.payload };
      }).fail((error: any) => {
        message = { type: 'error', text: error.payload };
      }).always(() => window.akioma.notification(message));