Skip to main content
Actions are the core building blocks of Kwala workflows. They define what your workflow actually does. This could be deploying smart contracts, calling contract functions, sending tokens, or invoking external APIs. Each workflow can contain multiple actions that are executed either sequentially or in parallel.

Action types

Kwala supports three primary action types:
  • Deploy: Deploy new smart contracts to blockchain networks
  • Call: Interact with existing smart contracts
  • API: Invoke external Web2 APIs
Action types apply to every workflow regardless of trigger. A workflow started by an API trigger runs the same actions — up to 10 per workflow, sequential or parallel.

Deploy actions

Deploy actions are used to deploy new smart contracts to a blockchain network. You can also use deploy actions to deploy Kwala Functions, which enable custom on-chain decision logic. In the following example, we deploy an NFT contract to Ethereum mainnet. The initialization parameters are contract name (“MyNFT”), symbol (“NFT”), and initial supply (1000 tokens).
Required fields for deploy: Optional fields:

Call actions

Call actions interact with already deployed smart contracts by calling their functions. The following example calls the transfer function on an ERC-20 token contract to send 1 token to a recipient address:
Required fields for call: Optional fields:

API actions

API actions allow you to integrate Web2 services into your Web3 workflows. The following example action sends a Discord notification using a webhook to announce that a new NFT has been minted, including an embedded message with the token ID.
Required fields for API: Optional fields:

Complete field reference

Here’s a comprehensive reference of all action fields:

Retry logic

The retriesUntilSuccess field allows actions to automatically retry on failure. The following example configures a critical contract call to automatically retry up to 5 times if it fails, ensuring higher reliability for important operations.
Each retry attempt consumes credits. Use retries carefully and consider setting appropriate limits. Retry behavior:
  • Retries happen automatically on failure
  • A delay is applied between retries
  • Total attempts = 1 (initial) + retriesUntilSuccess
  • Failed retries still consume credits

Best practices for workflow actions

  • Use descriptive action names - Choose clear, descriptive names that explain what each action does. It’s easier to understand and debug a workflow called Deploy NFT Marketplace Contract as opposed to Action1.
  • Validate parameters - Double-check all parameters, especially addresses and amounts, before deploying workflows
  • Set appropriate retries - Use retries for critical operations, but avoid excessive retries that waste credits
    • Network calls: 2-3 retries
    • Contract deployments: 1-2 retries
    • Simple reads: 0-1 retries
  • Add metadata - Use the metadata field to document why an action exists and any important context

Combining Web2 and Web3 actions

One of Kwala’s key features is the ability to combine Web2 and Web3 actions in a single workflow. The following example demonstrates a complete workflow that mints an NFT on-chain, sends an email notification to the user via SendGrid API, and logs the transaction to a database via a custom API endpoint.

Using trigger data in actions

When a workflow is started by an API trigger, its actions can read values from the incoming request body using re.object(\"<field>\"), written wherever an action expects a value. Kwala substitutes the matching field at run time. Forward fields into an outbound API action:
Pass fields as contract-call arguments, in the order the function expects:
Good to know:
  • Types survive — a number arrives as a number, a boolean as a boolean.
  • Nested objects and arrays come through whole; reference them once.
  • The left-hand key is yours to rename; the argument inside re.object() is the field in the incoming body.
  • References are not validated before deploy — a misspelled field resolves empty or fails at run time. Check the Console Logs after your first test run.
  • GET and DELETE carry no body, so there is nothing for re.object() to read.
re.object() reads a named field from a JSON body (API trigger); event triggers use re.event() for positional event data — different helpers for different input shapes.

Next steps

Working with Triggers

Learn how to trigger your workflows

Workflow Execution

Understand workflow execution modes

YAML Basics

Master Kwala’s YAML syntax

Use Cases

Explore real-world examples