<approval>

<approval> persists a waiting node and opaque decision capability, optionally delivers notifications, and continues through approved or rejected arms.

Why use it

Use it when a business process requires an explicit human decision that must survive restarts and settle exactly once.

Common use cases

  • Approve a refund before issuing it.
  • Review a deployment or content publication.
  • Reject or fail automatically after a durable timeout.

Syntax

WOML
<approval id="managerApproval" timeout="24h" on-timeout="reject">
  <notify>
    <telegram
      chats="123456789"
      bot-token="{{secrets.TELEGRAM_BOT_TOKEN}}"
    />
  </notify>
  <when-approved>
    <step id="sendRefund"><script>return issueRefund();</script></step>
  </when-approved>
  <when-rejected />
</approval>

Rules and behavior

  • id is required; name, description, and timeout are optional.
  • on-timeout is reject or fail, defaults to fail, and requires timeout.
  • Child order is optional <notify>, required <when-approved>, then required <when-rejected>.
  • The first valid decision wins; matching repeats are idempotent and an opposing later decision conflicts.
  • The result is published at context.steps.<approvalId>.
  • There is no npm decision API or woml.resume() function.