Quickstart

Quickstart

Bootstrap an admin, create a small workflow from a JSON file, validate it and run it with the CLI.

Flow Current 2 min read Updated

Prerequisites

  • A running Kiwi Flow server and its URL
  • The kiwi command-line shell with the Kiwi Flow CLI registered

This quickstart creates a two-step workflow and runs it from the command line. The same steps can be done in Studio.

1. Connect and create the first admin#

bash
kiwi flow connect --url https://localhost:5000
kiwi flow setup --user admin --password "<choose-a-strong-password>" --email admin@example.com
kiwi flow login --user admin --password "<your-password>"

setup is a one-time bootstrap: it creates the first admin user, requires an email address, and prints an initial API key (shown once, so save it). It fails if any user already exists.

2. Write a workflow#

Save this as hello.json:

json
{
  "workflowId": "wf_hello",
  "name": "Hello workflow",
  "version": 1,
  "inputs": [
    { "name": "customerName", "type": "string", "required": true }
  ],
  "activities": [
    {
      "id": "a1",
      "name": "Build greeting",
      "type": "js_script",
      "inputs": [
        { "name": "customerName", "from": "inputs.customerName" }
      ],
      "script": {
        "timeoutSeconds": 10,
        "body": "output.greeting = 'Hello, ' + customerName + '!';"
      },
      "outputs": [
        { "name": "greeting", "from": "output.greeting" }
      ],
      "next": "a2"
    },
    {
      "id": "a2",
      "name": "Write to the run log",
      "type": "log",
      "inputs": [
        { "name": "message", "from": "a1.output.greeting" }
      ]
    }
  ]
}

Step a1 runs a sandboxed JavaScript snippet; its input customerName is injected as a variable and results are written to output. Step a2 writes a log entry that uses the greeting from a1.

3. Validate, create and run#

bash
kiwi flow workflow-validate --file hello.json
kiwi flow workflow-create --name "Hello workflow" --file hello.json
kiwi flow workflow-run --id <workflow-id> --input-json '{"customerName":"Ada"}'

workflow-create prints the new workflow's id. workflow-run executes the workflow and waits for the run to finish. Inspect it afterwards:

bash
kiwi flow runs --workflow-id <workflow-id>
kiwi flow run-get --id <run-id>

run-get shows the inputs, outputs and log of the run, including per-activity detail.

Next steps#

Expected result

  • The workflow validates, runs and reports a greeting built from your input