Skip to main content
Version: 5.1

Build an Automation

TimeUnder 10 minutes
What you'll buildAn automation that prints Hello World to the terminal when it runs.

An automation runs your integration logic without requiring an external request, either on demand or on a schedule. Automations are useful for tasks such as data synchronization, report generation, and routine maintenance. This quick start walks you through the full process: adding an automation artifact, building the logic in the visual designer, running it, and reviewing scheduling options for production.

Prerequisites​

A working WSO2 Integrator environment.

Local setup

Install and launch WSO2 Integrator on your machine.

WSO2 Cloud Account

For AI assisted development and WSO2 Cloud deployments.

Step 1: Create the integration​

Note

If you're using the cloud editor, a project is already open, so you can skip this step and go directly to Step 2: Add an automation artifact.

  1. Open WSO2 Integrator.

  2. Click Create in the Create a Project card.

    WSO2 Integrator home screen with the Create a Project cardWSO2 Integrator home screen with the Create a Project card
  3. Set Project Name to automation-quickstart.

  4. Set Integration Name to HelloWorldAutomation.

  5. Click Create.

    Create a Project form with Project name set to automation-quickstart and Integration name set to HelloWorldAutomationCreate a Project form with Project name set to automation-quickstart and Integration name set to HelloWorldAutomation

Step 2: Add an automation artifact​

  1. Select your integration from the project overview canvas.

  2. In the design view, click Add Artifact Manually.

    Integration design view with the Add Artifact manually button highlightedIntegration design view with the Add Artifact manually button highlighted
  3. Select Automation under Automation.

    Artifacts page with Automation highlighted under AutomationArtifacts page with Automation highlighted under Automation
  4. Click Create.

    Create New Automation form with the Create buttonCreate New Automation form with the Create button

Step 3: Add logic​

  1. Click + below the Start node to open the node panel.

  2. Select Call Function under Statement.

    Node panel with Call Function highlighted under StatementNode panel with Call Function highlighted under Statement
  3. Select Print under io from the functions list.

    Functions list with print highlighted under ioFunctions list with print highlighted under io
  4. Click Initialize Array for the Values parameter.

    io:print panel with the Initialize Array button highlighted under Valuesio:print panel with the Initialize Array button highlighted under Values
  5. Set Values to "Hello World" and select Save.

    io:print panel with Values set to Hello Worldio:print panel with Values set to Hello World

Step 4: Run and test​

  1. Click Run.

  2. Confirm the terminal output contains Hello World.

    Running the automation and seeing the Hello World output in the terminalRunning the automation and seeing the Hello World output in the terminal

Step 5: Deploy to WSO2 Cloud​

Deploy your integration to WSO2 Cloud - Integration Platform in any of the following ways:

Skip ahead: deploy a ready-made sample

Rather not build it yourself? One-click deploy the HelloWorldAutomation sample straight to WSO2 Cloud.

Deploy to WSO2 Cloud

Source code​

View the generated Ballerina code

The steps above generate the following complete, runnable Ballerina program:

import ballerina/io;
import ballerina/log;

public function main() returns error? {
do {
io:print("Hello World");
} on fail error e {
log:printError("Error occurred", 'error = e);
return e;
}
}

Scheduling automations​

Periodic invocation is configured in an external system once the automation is deployed. Available options include:

  • Cron job: schedule the automation from a cron entry on a Unix or Linux host.
  • Kubernetes: define a CronJob resource to run the automation on a recurring schedule.
  • VM: use a host scheduler such as Windows Task Scheduler or systemd timers.
  • WSO2 Integration Platform: configure the schedule in the WSO2 Integration Platform when the integration is pushed to the cloud.

What's next​