Skip to content

Run a workflow

A workflow is something the site does by itself: when a trigger fires, its steps run in order, each one handed what the step before it gave. It can read a web page every night and keep what it found in a table, which a page then shows. Workflows come with the plans that include them; on any other site the workflow commands say so and change nothing. Topic workflows is the exact list of triggers and steps, with every setting each one takes.

The workflow commands run inside bash, like every other site command: list_workflows, get_workflow, save_workflow, activate_workflow, pause_workflow, run_workflow, get_workflow_run and delete_workflow.

A workflow is a file of the site, workflows/<handle>.json, and changes as any file does: save_workflow, activate_workflow, pause_workflow and delete_workflow write or remove that file on the branch you name, and nothing changes until merge_branch puts the branch live. list_workflows names each workflow’s handle.

  • A trigger: vizitka.schedule on a schedule, vizitka.table.new_record when a row is added to a table, vizitka.disk.file_uploaded when a file is stored, or vizitka.manual, which only a test run starts.
  • Steps, run in the order they are listed. http.get_page reads a web page and picks values out of it, http.get_json reads an API that answers with JSON, transform.map_fields renames and picks values, javascript.run runs a short script of your own, vizitka.create_record and vizitka.update_record write a row of one of the site’s tables, vizitka.ask_integration asks one of the site’s integrations a question, and vizitka.list_addresses lists the site’s addresses.

vizitka.list_addresses hands the next step { "addresses", "total", "more" }: every address the site answers at, each with its address, path, kind (page or row), file, language, indexed (whether search engines are told of it) and changed_at. "indexed_only": true keeps the indexed ones, "changed_since": "2026-11-01T00:00:00Z" the ones changed after that moment, and "limit" hands on that many, up to 500. total is how many match, and more says some were left out.

vizitka.ask_integration names the integration by its file’s name ("integration": "google_analytics"), or a package by its folder’s, and gives its on an event, or this step’s input where event is left out. Of a package with more than one job whose code exports on, "job" names the one to ask. It waits up to 30 seconds for the answer, and the next step gets { "integration", "run", "result" }, where result is what the job returned. The integration has to be switched on. google_analytics_property, which makes a property in the owner’s Google account, and meta_ads are the Vizitka app’s alone to ask: a workflow that is switched on and names either is refused as it is written, and a step that names one fails as integration.missing. Google Analytics answers { "question": "weekly", "report": "site", "days": 7 } (days are 7, 14, 28 or 90) with result.summary: visitors, visits, views and instagram_visits for the period, and the same under previous for the period before it. Name the question yourself, such as weekly: one that starts with site: or page:, or is live, is one the Vizitka app asks under too. Where Google did not answer, result is { "answered": false, "why": "refused" } (connect Google again) or "unreachable" (try later), with no summary.

A schedule is either every (15m, 30m, 1h, 6h or 1d, counted from midnight UTC) or cron, five crontab fields read in time_zone, such as "0 0 * * *" in "Europe/Kyiv" for every midnight there. Two runs are never closer than 15 minutes.

2. Read a page every night and keep what it says

Section titled “2. Read a page every night and keep what it says”

The owner asks: “check this page every day at midnight, take the price, save it, and show it on the prices page”.

  1. Look at the page yourself first, with your own web tools, and find a CSS selector for each value. http.get_page reads the page as the server sends it and runs none of its scripts, so a value a script draws after the page loads is not there to pick. The page is read as UTF-8. The address must be public HTTPS, answer without a redirect (give the address it moves to), and be at most 2 MB.

  2. Make the table the values go into with create_table, on a branch, and merge it. A table the public may read is one a page can show.

  3. Write the workflow on a branch (git switch -c agent/bread-price). Leave out every uuid and version: they are filled in. A new workflow is written paused.

    save_workflow --json '{
    "handle": "bread_price",
    "branch": "agent/bread-price",
    "name": "Bread price",
    "definition": {
    "trigger": { "key": "vizitka.schedule", "config": { "cron": "0 0 * * *", "time_zone": "Europe/Kyiv" } },
    "steps": [
    { "key": "http.get_page", "config": {
    "url": "https://shop.example.com/bread",
    "extract": {
    "price": { "selector": ".product .price" },
    "image": { "selector": "meta[property=\"og:image\"]", "attribute": "content" }
    } } },
    { "key": "transform.map_fields", "config": {
    "fields": { "price": { "path": "values.price" }, "image": { "path": "values.image" } } } },
    { "key": "vizitka.create_record", "config": { "table": "prices" } }
    ]
    }
    }'

    http.get_page hands on { "status": 200, "values": { ... } }. A value is the text of the first element its selector matches, with its spaces tidied, or with attribute the value of that attribute on the first match that has it; "all": true gives a list of every match. A selector that matches nothing gives null.

    A selector is a type or *, #id, .class, [name] or [name=value] (also ~=, |=, ^=, $= and *=, the value a word or in quotes), and :first-child, :last-child, :only-child, their -of-type twins, :nth-child(2) and :nth-of-type(2) with a number, odd or even. Join them with a space, >, + or ~, and list several with commas: at most 16 parts in all. Nothing else is read, so no :not(), :has(), ::before or escaped characters.

    To keep one row up to date instead of adding a row a day, end with vizitka.update_record and match on a field that names it. To add a row only when it is new, give it "if_missing": "create" as well: the newest post, say, matched on its link, is added the first day and only has set’s fields brought up to date after, so the table never holds it twice. Match on a text field such as the link, not a date or a number. A step that would add a row whose matched value is empty fails as record.invalid instead.

  4. Try it once: merge_branch puts the paused workflow on the site, where it starts nothing by itself, and run_workflow runs it. It really runs: it reads the page and writes the row. Read how it went with get_workflow_run, and look at the row with list_records. A step that failed says why, for example that its selector is not one it can read, or that the address answered with a redirect.

  5. Switch it on once the owner agrees: activate_workflow on a new branch, then merge_branch. list_workflows then says next_run_at, when it runs next, in UTC: say that to the owner in their own time.

  6. Show it on the page: write a listing of the table on a branch, as guide vzk/tables says (tables.prices.tail(30)), and merge it.

Some jobs the steps can’t express: a login that hands back a token, paging through an API, or adding many rows, or only the new ones, in one run. Then an integration does it (guide site-integrations), but first check list_feature_requests and file what the workflow lacks with request_feature, tag workflows. Tell the owner why it is an integration and what you filed. If they asked for a workflow, ask before you build the integration.

get_workflow gives the definition, which save_workflow takes back with your change on a branch; the file keeps whether it is on or paused. What is live keeps running until the branch is merged. pause_workflow writes the file paused, and delete_workflow removes the file: once merged, the workflow goes with its run history, and the rows it wrote stay.

What a run read and wrote is not said here: a row it wrote is read where it is, with the record tools. A signed webhook says the path it answers in its trigger’s settings, { "path": "new-lead" }, and every one of its steps is a JSON result. Only the owner makes and sees its signing secret and sends it a test run, and the Vizitka app cannot do either yet, so tell the owner.

A step that adds or changes a row names a table the branch has, and fields that table has. A workflow can’t start on or write the tables Payments keeps, or write a table with rules of its own.

A page behind a key or a login cookie can be read with a secret the owner has saved (the Vizitka app cannot save one yet): write it as {{secrets.NAME}} in a header’s value or in the address after its host. It is sent only to the host it was saved with.