Skip to main content

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 an external request, on demand or on a schedule. Automations are ideal for data synchronization, report generation, and routine maintenance jobs. This quick start shows the full cycle: add an automation artifact, build the logic in the visual designer, run it, and review the scheduling options for production.

Prerequisites​

A working WSO2 Integrator environment.

Step 1: Create the integration​

  1. On the project home page, click Create on Cloud.

    WSO2 Cloud project home showing the Create on Cloud optionWSO2 Cloud project home showing the Create on Cloud option
  2. The WSO2 Integrator cloud editor opens in your browser. Add an artifact to your integration, then deploy it to WSO2 Cloud from the Deploy to WSO2 Cloud panel on the right.

    WSO2 Integrator cloud editor landing page showing an empty integration and the Deploy to WSO2 Cloud panelWSO2 Integrator cloud editor landing page showing an empty integration and the Deploy to WSO2 Cloud panel

Step 2: Add an automation artifact​

  1. Select your integration from the project overview canvas.
  2. Select + Add Artifact in the design canvas.
  3. Select Automation under Automation.
  4. Select Create.
Create New Automation form opened after selecting Automation under AutomationCreate New Automation form opened after selecting Automation under Automation

Step 3: Add logic​

  1. Select + after the Start node to open the node panel.
  2. Select Call Function.
  3. Select Print under io from the function list.
  4. Select Initialize Array for the Values parameter.
  5. Set Values to "Hello World" and select Save.
io:print configuration panel with the Values parameter set to Hello World, ready to be savedio:print configuration panel with the Values parameter set to Hello World, ready to be saved

Step 4: Run and test​

  1. Select 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. Check Save and deploy.

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.