Create and deploy
- Open Functions in your project
- Create or edit a function
- Deploy it
- Attach it to a workflow node, an agent tool, or call its endpoint directly
The Kapso CLI does not manage functions yet. Use the dashboard or API for function create/update/deploy.
Invoke endpoints
Deployed Cloudflare functions expose a Kapso-hosted invoke URL:public_endpoint: false(default) keeps the invoke URL private. SendX-API-Keywith the request.public_endpoint: trueallows invoke requests without an API key. This is only supported for Cloudflare functions.- Private and unknown functions both return
404from the invoke route. - Newly created functions use
invoke_response_mode: passthrough. Successful invoke responses preserve the function body, success status code, andContent-Type. - Older wrapped functions can be updated to
passthroughif you need to remove the legacy{ data: ... }wrapper.
Runtime contract
Kapso Cloudflare Worker functions must define:handler(request, env). Do not use export default.
Bindings and env
fetch()- Make HTTP requestsRequest/Response- Handle HTTPURL/URLSearchParams- Parse URLscrypto.randomUUID()- Generate IDsTextEncoder/TextDecoder- Text encodingenv.KV- Persistent key-value storageenv.DB- Project database bound as Cloudflare D1env.YOUR_SECRET- Access encrypted secrets set in the function page- Standard JavaScript APIs
Secrets
Secrets are available as string keys onenv:
- Secrets must be set in the Kapso web app (function page → Secrets tab)
- Secret names should use UPPERCASE_WITH_UNDERSCORES
- Values are encrypted and never exposed after creation
- Functions must be deployed before adding secrets
KV storage
Each project has its own KV namespace for persistent data storage:Functions in flows
Kapso sends workflow data in the JSON request body. Parse it withawait request.json().
Function node
execution_contextflow_infoflow_eventswhatsapp_contextwhen the run comes from WhatsApp
Decide node
next_edge is only used by decide nodes.
Agent function tools
Agent tool arguments are insidebody.input, not at the root:
input- tool arguments chosen by the agentexecution_contextflow_infoflow_eventswhatsapp_contextwhen the run comes from WhatsApp

