Close
    logoCloudomation Docs

    Running Flow Scripts Remotely

    You can run a flow script from your local machine by using a helper script:

    flow-runner.bash:

    #!/usr/bin/env bash
    echo "Running flow..."
    DIR=$(dirname $0)
    TOKEN_FILE="${DIR}/token"
    TOKEN=$(cat "${TOKEN_FILE}")
    if [ -z "${TOKEN}" ]; then
    ${DIR}/auth.bash
    fi
    FLOW=$1
    if [ -z "${FLOW}" ]; then
    echo "missing parameter " 1>&2
    exit 1
    fi
    if [ ! -f "${FLOW}" ]; then
    echo "flow ${FLOW} does not exist" 1>&2
    exit 1
    fi
    echo "Flow: ${FLOW}"
    NAME=$(basename "${FLOW}")
    SCRIPT=$(cat "${FLOW}" | base64 -w0)
    EXECUTION="{\"script\":\"${SCRIPT}\",\"name\":\"${NAME}\"}"
    curl -H "Authorization: $TOKEN" -d "${EXECUTION}" https://<my-workspace-name>.cloudomation.com/api/latest/execution
    echo ""

    This helper script requires auth.bash to be in the same directory. Please find more information in the article about Authentication.

    You can execute the helper script and pass the path to a local flow script as first parameter:

    bash:

    $ ./flow-runner.bash hello.py
    Running flow...
    Flow: hello.py
    {"id": 1234}

    You can also use the helper script as shebang  in your script and directly execute it:

    hello.py:

    #!/path/to/your/flow-runner.bash
    import flow_api
    def handler(system: flow_api.System, this: flow_api.Execution):
    return this.success('hello world')

    bash:

    $ chmod +x hello.py
    $ ./hello.py
    Running flow...
    Flow: ./hello.py
    {"id": 1235}
    Knowledge Base — Previous
    Messages and Forms
    Next — Knowledge Base
    Savepoints