Skip to main content

Every path you can put in uses

Goal

Know every source a block can read from, and which ones Save accepts in each position. Time: 10 minutes.

PathSourceValid when
inputs.<name>Workflow input, such as an HTTP request body field or a value you enter when you run the workflow<name> is declared under the root inputs: key
trigger.textText from an HTTP or Telegram triggerAlways accepted by Save. Present at run time only if the trigger supplies it
trigger.argsThe text after a Telegram commandTelegram trigger with a command
trigger.chat_id, trigger.message_id, trigger.from_usernameTelegram message metadataTelegram trigger
trigger.path, trigger.received_atThe changed fileFile trigger
steps.<id>.<prop>A property published by an earlier block<prop> is declared in that block’s outputs, or is always published (status, exit, duration_ms)
steps.<loop id>.resultsEvery pass of a loopAfter the loop
loop.item, loop.index, loop.countThe current loop pass. loop.index starts at 1Only inside a loop body
secrets.<name>The secret store, resolved at run time<name> is listed under the root secrets: key

Declaring inputs and secrets

schema: 1
name: Greet a city
id: greet-city
secrets:
  - WEATHER_API_KEY
inputs:
  city:
    type: string
blocks:
  - id: greet
    kind: code
    language: python
    uses: [inputs.city, secrets.WEATHER_API_KEY]
    body: |
      import json, os
      data = json.load(open(os.environ["TERMORQ_INPUT"], encoding="utf-8"))
      key_present = bool(data["secrets"]["WEATHER_API_KEY"])
      print(json.dumps({"line": f"Hello {data['inputs']['city']}", "has_key": key_present}))
    outputs:
      type: object
      properties:
        line:
          type: string
        has_key:
          type: boolean
Warning

Never print a secret. Termorq redacts known secret values from logs and masks them in the run record, but the safest secret is one that never reaches stdout. Keep secrets out of input_sample too.

Check your run

Delete secrets: and click Save. Save reports 'secrets.WEATHER_API_KEY' is not a property this block can use. Put it back and the workflow saves.

Exercise

Move uses: [loop.item] onto a top-level block (one that isn’t in a loop). What does Save say?

Details

'loop.item' is not a property this block can use. loop.* paths are only valid inside a loop’s body. See Stage 5.