Skip to content

My first flow

You will write a flow that fetches a list from an internal API and writes the rows to a CSV file, validate it with the same validator as publication, and start it.

  1. Write the flow in rates.flow.yaml:

    schema: automatrpa/flow/v1
    id: rates
    params:
    currency: { type: string, default: BRL }
    steps:
    - id: fetch
    uses: std.http.request@1.0.0
    with:
    method: GET
    url: https://rates.example.internal/api/v1/rates
    query: { currency: "${{ params.currency }}" }
    auth: token
    credentials:
    auth: rates_api_token
    timeout: 30s
    retry: { max: 3, backoff: exponential, initial: 1s, on: [transient, timeout] }
    - id: write
    uses: std.table.write@1.0.0
    with:
    rows: ${{ steps.fetch.outputs.items }}
    path: rates.csv
    outputs:
    file: ${{ steps.write.outputs.file }}

    The secret rates_api_token is named only: its value stays in the vault and reaches the step on standard input, never in a log or an argument.

  2. Validate locally.

    Janela do terminal
    automatrpa validate rates.flow.yaml
    automatrpa validate --format json rates.flow.yaml # file, line, column and message

    Exit code 0 means valid; 1 means invalid.

  3. Publish and start it.

    Janela do terminal
    automatrpa login
    automatrpa flow publish rates.flow.yaml --folder <folder id> --message "first version"
    automatrpa run trigger --flow rates --param currency=BRL
    automatrpa run show <run id>
  4. Follow it in the UI. On Runs, open the run: each step shows its attempts, live logs, outputs and the rates.csv artifact.