Use this file to discover all available pages before exploring further.
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.
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).
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:
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.
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.
actions: - name: "Critical Contract Call" type: "call" retriesUntilSuccess: 5 # Will retry up to 5 times # ... other config
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
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
Test in the Playground - Always test your actions in the Kwala Playground before deploying to production
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.
name: "NFT Mint with Notification"execution: sequentialactions: # Web3 Action - name: "Mint NFT" type: "call" targetContract: "0x..." targetFunction: "mint" targetParams: - "0xUserAddress..." chainID: 1 # Web2 Action - name: "Send Email Notification" type: "api" APIEndpoint: "https://api.sendgrid.com/v3/mail/send" APIPayload: personalizations: - to: - email: "user@example.com" subject: "Your NFT has been minted!" content: - type: "text/plain" value: "Congratulations! Your NFT is ready." # Another Web2 Action - name: "Log to Database" type: "api" APIEndpoint: "https://api.example.com/logs" APIPayload: action: "nft_minted" user: "0xUserAddress..." timestamp: "{{now}}"