Skip to main content

Automation YAML

Any Automation has a YAML format representation which looks like this:

YAML

The Automation YAML contains all the information about the Automation. Its name, description, runner, etc. It also includes a list of the Automation's Steps, and each step has a name, action, inputs, and a connection.

Viewing your Automation in YAML format

  1. In the Edit screen, click Code. Your Automation is presented in YAML format.

YAMLview

Automation YAML grammar

The Automation YAML is used to describe the Automation and is defined as YAML. These attributes are present in the Automation YAML file:
name - Name of the Automation.
type - Can be either a Flow or Subflow Automation.
automation_type - The Automation type represents how the Automation will be used. (on_demand, event or scheduled)
active - True while the Automation is running, false otherwise.
desc - Description of the Automation.
connections - The Automation's connection, in the following format: connection-type: connection-name.
runner - The name of the Automation's runner.
workflow - The workflow representation. Workflow is built by sections that contains name and steps steps - There are two types of steps: Action and Text. Each type contains different attributes:
Action
action - The full name of the action.
id - ID of the step.
name - Name of the step.
desc - Description of the step.
inputs - The Action's inputs, in the following format: input-field-name: value, Action inputs might be encapsulated, for example:

input-field-name:
sub-input-field: value
sub-input-field-2: value2

connections - The connection of the step, in the following format: connection-type: connection-name.
steps - Flow Control actions such as internal.for iterates over all the steps and executes them.
transitions - Flow control actions such as internal.if contains the transitions field built as following:

transitions:
- on: true
steps:
...
- on: false
steps:
...

One of the steps branches will execute depending on the evaluated condition, which is provided on the if action.

Text
text - Free text. (this is unrelated to the steps attribute.)
counting_steps - The number of steps in the Automation.

Example of input and output parameters

name: output parameters
type: Flow
automation_type: on_demand
inputs:
name:
default: Ofir
display_name: Name
name: name
placeholder: Enter your name
required: true
type: text
outputs:
Welcome Message: "{{ steps.S1.output }}"
runner: blink_cloud
workflow:
- section: Formatting
steps:
- action: core.bash
id: S1
name: Format welcome message
inputs:
code: echo "Welcome, {{inputs.name}}!"
counting_steps: 0

Example of an if condition with input parameters

name: if condition game
type: Flow
automation_type: on_demand
inputs:
number:
default: 111
display_name: Number
name: number
placeholder: Enter your best guess
required: true
type: number
runner: blink_cloud
workflow:
- section: Game with If Conditions
steps:
- action: core.bash
id: S1
name: "#Action #1"
inputs:
code: 'echo "Welcome, You provided the number: {{inputs.number}}"'
- action: internal.if
id: S2
name: Is it the winning number
inputs:
condition:
sentence:
- lvalue: "{{inputs.number}}"
op: Equals
rvalue: 7
transitions:
- on: true
steps:
- action: core.bash
id: S3
name: Winning Number
inputs:
code: echo "You Won, Our number is 7"
- on: false
steps:
- action: internal.if
id: S4
name: Below or Above
inputs:
condition:
sentence:
- lvalue: "{{inputs.number}}"
op: Greater than
rvalue: 7
transitions:
- on: true
steps:
- action: core.bash
id: S5
name: Above
inputs:
code: echo "You number is above our number!"
- on: false
steps:
- action: core.bash
id: S6
name: Below
inputs:
code: echo "Your number is below our number!"
- section: Finish
steps:
- action: core.bash
id: S7
name: Thanks for playing
inputs:
code: echo "Thanks for playing!"
counting_steps: 0

Example of a Connection

name: connections
type: Flow
automation_type: on_demand
workflow:
- section: Ask question using slack connection
steps:
- id: S1
name: Ask a question via Slack
action: system.AskQuestionViaSlack
connections:
slack: slack_connection
inputs:
To: test@test.com
Question: Hey how are you?
Answers: Fine how are you?, Sick :( and you?
counting_steps: 0

Example of a scheduled Automation

name: scheduled automation
type: Flow
automation_type: scheduled
runner: blink_cloud
triggers:
scheduled:
- id: UUID
active: true
trigger_type: schedule
cron: 0 * * * *
workflow:
- section: Every Hour Send A Report
steps:
- id: S1
name: Getting the number of EC2 instances
action: core.aws
inputs:
Command: aws ec2 describe-instances --query
'Reservations[*].Instances[*].[InstanceId]' --output text | wc -l
connections:
kubernetes: kubernetes
- id: S2
name: Send Report
action: core.email
inputs:
To: test@report.com
Subject: Number of pods in the cluster
Content: According to {{ Now() }} we have {{steps.S1.output}} running ec2
instances
counting_steps: 0

Example of event based Automation

name: event based
type: Flow
automation_type: event
runner: blink_cloud
triggers:
webhooks:
- id: UUID
active: true
token: WEBHOOK_TOKEN
name: my webhook
trigger_type: custom_webhook
condition:
sentence:
- lvalue: "{{event.status}}"
op: Equals
rvalue: Approved
workflow:
- section: Event Handling
steps:
- id: S1
name: Print out the event with its content
action: core.bash
inputs:
code: echo {{event}}
counting_steps: 0

Sharing your Automation in YAML format

You can share your Automation with someone who is not in your Workspace.

  1. In the Edit screen, click Code. Your Automation is presented in YAML format.
  2. Copy the Automation in YAML format and paste it into any platform to which you want to share. The receiver can copy/paste the Automation into the Blink platform and can use the Automation.

Allow value "default" for runner in yaml & test parameters

  1. Open your Automation Editor.
  2. Locate the three dots icon three dots in the top right corner and click on it.
  3. A dialogue box will appear, presenting four options. Select the edit YAML option.

Edit YAML

  1. The YAML format for your automation will be displayed. Towards the top of the format, you will find a key-value pair called "Runner".
  2. You have the option to set its value as "default", as demonstrated in the following example:

Edit YAML

  1. After making the desired changes, click on the Apply button. This will apply the default runner group to your automation.