Skip to main content

Creating a Simple Workflow: Hello World

This tutorial shows you how to create a simple Workflow that prints Hello World in Bash and Python, using references from input parameters and references from previous Steps.

Prerequisites

  • A Blink account. Sign up here.

Creating a New Pack

A Pack is a collection of Automated Workflows. If you already have a Pack you can open it and skip ahead to creating a new Workflow.
If you don't have an existing pack, follow these steps:

  1. Navigate to the Workflow page in your Workspace.

  2. In the left-hand sidebar, click the "+" icon

  3. Fill in the necessary details:

    Pack name: My first Pack
    Description: This is a Pack.

  4. Then click the Create button. The new Pack is displayed on your Workflow's screen.

Creating a New Workflow

  1. Click Create Workflow.
  2. Enter the parameters:
    • Workflow Name: Hello World
    • Workflow description: This is Hello World
    • Tags: Demo, Hello World
  3. Select a Trigger Type: On-Demand
  4. Click Create Workflow. You will be redirected to the Editor page of the Workflow.

Workflow Step: Printing Hello World

  1. Click to open the Action panel. Alternatively, you can drag Actions to your flow, from the menu on the left side of your Edit screen.
  2. Search and select the Run Bash Script Action.
  3. Enter the following code in your Step:
    • echo "Hello World"
  4. Test the Step by clicking Test run. In the Output field you will see Hello World. COMPLETED appears on the right side of the Step, indicating the Step has succeeded.

Workflow Step: Printing Hello World using Input Parameters

The same Workflow Step can be created using input parameters.

Setting Input Parameters

  1. In the Workflow editor, click the + icon.

  2. Enter the parameters:

ParameterDescription
Parameter NameName
Parameter TypeText
Required ParameterCheck the box
Display NameName
PlaceholderName for greeting
Default ValueJon
  1. Click "Apply". The parameters are displayed under "Input Parameters".

Updating the Step

  1. Click to open the Action panel. Alternatively, you can drag Actions to your flow, from the menu on the left side of your Edit screen.
  2. Search and select the Bash Action.
  3. Enter the following parameters in your Step.
  4. Click on Action #1 to change the name of the action to Print hello world.
  5. Enter the following code code: echo {{inputs.user_name}}
  6. Test the Step by clicking Test run.
  7. Enter the input parameter Name: Jon. In the Output field you will see hello Jon.
  8. "COMPLETED" appears on the right-hand side of the Step, indicating the Step has succeeded.

Workflow Step: Printing Hello World using Python and Input Parameters

The same Workflow Step can be created using python. In Python action, you can access the context object dictionary and get values from input parameters, variables and Step outputs.

  1. Click to open the Action panel. Alternatively, you can drag Actions to your flow, from the menu on the left side of your Edit screen.

  2. Search and select the PythonAction.

  3. Enter the following parameters in your Step.

  4. Click on Action #2 to change the name of the action to Print hello world using Python.

  5. Enter the following code:

    • print("hello" + context.inputs.name)
    • print(context.steps.s1.output)
  6. Test the Step by clicking Test run.

  7. Enter the input parameter ""Name": Jon. In the Output field you will see:

    hello Jon
    Hello Jon
  8. "COMPLETED" appears on the right-hand side of the Step, indicating the Step has succeeded. The Step took the input parameter and the output from the previous Step to produce the output.

Thumbnail

Running the Workflow

The Workflow can be run in several ways:

  • Manually in an interactive session: While creating a Workflow we start a session and run steps or sections one by one, so we can edit them and rerun them in the same session.
  • Manually in a non-interactive session: This is when you run the entire workflow. This can be triggered from the Workflow page by clicking on Run All button or from the Workflow page.