productivity
Bubble Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Bubble KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.bubble.*.
Use lua_read_doc("integrations.bubble") inside KosmoKrator to discover the same reference at runtime.
Call Lua from the Headless CLI
Use kosmo integrations:lua when a shell script, CI job, cron job, or another coding CLI should run a deterministic
Bubble workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.bubble.get_swagger({}))' --json kosmo integrations:lua --eval 'print(docs.read("bubble"))' --json
kosmo integrations:lua --eval 'print(docs.read("bubble.get_swagger"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local bubble = app.integrations.bubble
local result = bubble.get_swagger({})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.bubble, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.bubble.default.* or app.integrations.bubble.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Bubble, use the narrower mcp:lua command.
# Use mcp:lua for MCP-only scripts; use integrations:lua for this integration namespace.
kosmo mcp:lua --eval 'dump(mcp.servers())' --json Agent-Facing Lua Docs
This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.
Bubble - Lua API Reference
Namespace: app.integrations.bubble
This integration wraps Bubble’s built-in API. The normal production API root is /api/1.1; use /version-test/api/1.1 for development mode. Bubble exposes two API surfaces: the Data API for database records and the Workflow API for exposed backend workflows. Privacy rules and API settings still apply.
Discovery
Use the Swagger specification to discover the exact Data API data types and Workflow API paths enabled for the app:
local swagger = app.integrations.bubble.get_swagger({})
Data API
List records with Bubble constraints, pagination, and sorting:
local result = app.integrations.bubble.list_records({
type = "User",
constraints = {
{ key = "email", constraint_type = "contains", value = "@example.test" }
},
limit = 50,
cursor = 0,
sort_field = "Created Date",
descending = true
})
Record operations:
local record = app.integrations.bubble.get_record({
type = "Product",
id = "1704982345123x456789"
})
local created = app.integrations.bubble.create_record({
type = "Product",
fields = { name = "Example", price = 100 }
})
local patched = app.integrations.bubble.update_record({
type = "Product",
id = "1704982345123x456789",
fields = { price = 120 }
})
local replaced = app.integrations.bubble.replace_record({
type = "Product",
id = "1704982345123x456789",
fields = { name = "Example", price = 120 }
})
app.integrations.bubble.delete_record({
type = "Product",
id = "1704982345123x456789"
})
update_record uses PATCH and changes only supplied fields. replace_record uses PUT and should be treated as a full replacement payload.
Workflow API
Trigger a Bubble backend API workflow with POST:
local response = app.integrations.bubble.trigger_workflow({
workflow = "sync_order",
payload = {
order_id = "ord_123",
status = "paid"
}
})
Initialize a POST workflow while Bubble’s Detect data popup is open:
app.integrations.bubble.trigger_workflow({
workflow = "sync_order",
initialize = true,
payload = {
order_id = "ord_123",
status = "paid"
}
})
Trigger a workflow configured for GET/querystring parameters:
local response = app.integrations.bubble.trigger_workflow_get({
workflow = "status_check",
params = {
order_id = "ord_123"
}
})
Workflow API endpoint names and parameters are app-specific. Use get_swagger or the Bubble editor’s backend workflow settings to confirm the endpoint name before calling it.
Multi-Account Usage
app.integrations.bubble.list_records({ type = "User" })
app.integrations.bubble.default.list_records({ type = "User" })
app.integrations.bubble.production.trigger_workflow({ workflow = "sync_order", payload = {} })
Named account namespaces use the same tools with different stored credentials.
Raw agent markdown
# Bubble - Lua API Reference
Namespace: `app.integrations.bubble`
This integration wraps Bubble's built-in API. The normal production API root is `/api/1.1`; use `/version-test/api/1.1` for development mode. Bubble exposes two API surfaces: the Data API for database records and the Workflow API for exposed backend workflows. Privacy rules and API settings still apply.
## Discovery
Use the Swagger specification to discover the exact Data API data types and Workflow API paths enabled for the app:
```lua
local swagger = app.integrations.bubble.get_swagger({})
```
## Data API
List records with Bubble constraints, pagination, and sorting:
```lua
local result = app.integrations.bubble.list_records({
type = "User",
constraints = {
{ key = "email", constraint_type = "contains", value = "@example.test" }
},
limit = 50,
cursor = 0,
sort_field = "Created Date",
descending = true
})
```
Record operations:
```lua
local record = app.integrations.bubble.get_record({
type = "Product",
id = "1704982345123x456789"
})
local created = app.integrations.bubble.create_record({
type = "Product",
fields = { name = "Example", price = 100 }
})
local patched = app.integrations.bubble.update_record({
type = "Product",
id = "1704982345123x456789",
fields = { price = 120 }
})
local replaced = app.integrations.bubble.replace_record({
type = "Product",
id = "1704982345123x456789",
fields = { name = "Example", price = 120 }
})
app.integrations.bubble.delete_record({
type = "Product",
id = "1704982345123x456789"
})
```
`update_record` uses PATCH and changes only supplied fields. `replace_record` uses PUT and should be treated as a full replacement payload.
## Workflow API
Trigger a Bubble backend API workflow with POST:
```lua
local response = app.integrations.bubble.trigger_workflow({
workflow = "sync_order",
payload = {
order_id = "ord_123",
status = "paid"
}
})
```
Initialize a POST workflow while Bubble's Detect data popup is open:
```lua
app.integrations.bubble.trigger_workflow({
workflow = "sync_order",
initialize = true,
payload = {
order_id = "ord_123",
status = "paid"
}
})
```
Trigger a workflow configured for GET/querystring parameters:
```lua
local response = app.integrations.bubble.trigger_workflow_get({
workflow = "status_check",
params = {
order_id = "ord_123"
}
})
```
Workflow API endpoint names and parameters are app-specific. Use `get_swagger` or the Bubble editor's backend workflow settings to confirm the endpoint name before calling it.
## Multi-Account Usage
```lua
app.integrations.bubble.list_records({ type = "User" })
app.integrations.bubble.default.list_records({ type = "User" })
app.integrations.bubble.production.trigger_workflow({ workflow = "sync_order", payload = {} })
```
Named account namespaces use the same tools with different stored credentials. local result = app.integrations.bubble.get_swagger({})
print(result) Functions
get_swagger Read
Get the Bubble app Swagger specification for enabled Data API and Workflow API endpoints.
- Lua path
app.integrations.bubble.get_swagger- Full name
bubble.bubble_get_swagger
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_records Read
List records from a Bubble data type. Supports filtering with constraints, pagination with limit and cursor. Returns matching records and a remaining count for further pagination.
- Lua path
app.integrations.bubble.list_records- Full name
bubble.bubble_list_records
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | yes | The Bubble data type name (case-sensitive, e.g. "User", "Product", "Order"). |
constraints | string | no | JSON-encoded array of Bubble constraint objects for filtering. Each constraint is {"key": "field_name", "constraint_type": "equals", "value": "some_value"}. Pass as a JSON string. |
limit | integer | no | Maximum number of records to return (1–100, default: 100). |
cursor | integer | no | Offset for pagination (0-based). Use the "remaining" count from the previous response to determine if more pages exist. |
sort_field | string | no | Optional field to sort the list on. |
descending | boolean | no | Sort descending when true. |
get_record Read
Get a single record from Bubble by its data type and unique ID. Returns all fields of the record.
- Lua path
app.integrations.bubble.get_record- Full name
bubble.bubble_get_record
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | yes | The Bubble data type name (case-sensitive, e.g. "User", "Product", "Order"). |
id | string | yes | The unique identifier of the record (Bubble-generated UUID). |
create_record Write
Create a new record in a Bubble data type. Provide field names and values as a JSON object. Returns the created record including its generated ID.
- Lua path
app.integrations.bubble.create_record- Full name
bubble.bubble_create_record
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | yes | The Bubble data type name (case-sensitive, e.g. "User", "Product", "Order"). |
fields | string | yes | JSON object of field names and values for the new record. Example: {"name": "John", "email": "john@example.com", "age": 30}. Pass as a JSON string. |
update_record Write
Update an existing record in Bubble by its data type and unique ID. Only the fields provided will be changed; other fields remain unchanged. Returns the updated record.
- Lua path
app.integrations.bubble.update_record- Full name
bubble.bubble_update_record
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | yes | The Bubble data type name (case-sensitive, e.g. "User", "Product", "Order"). |
id | string | yes | The unique identifier of the record to update (Bubble-generated UUID). |
fields | string | yes | JSON object of field names and values to update. Only the provided fields will be changed. Example: {"name": "Jane", "status": "active"}. Pass as a JSON string. |
replace_record Write
Replace a Bubble record by data type and ID using the Data API PUT endpoint.
- Lua path
app.integrations.bubble.replace_record- Full name
bubble.bubble_replace_record
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | yes | Bubble data type name. |
id | string | yes | Bubble unique ID. |
fields | object | yes | Full field payload for the record. |
delete_record Write
Delete a record from Bubble by its data type and unique ID. This action is permanent and cannot be undone.
- Lua path
app.integrations.bubble.delete_record- Full name
bubble.bubble_delete_record
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | yes | The Bubble data type name (case-sensitive, e.g. "User", "Product", "Order"). |
id | string | yes | The unique identifier of the record to delete (Bubble-generated UUID). |
trigger_workflow Write
Trigger an exposed Bubble API workflow using POST.
- Lua path
app.integrations.bubble.trigger_workflow- Full name
bubble.bubble_trigger_workflow
| Parameter | Type | Required | Description |
|---|---|---|---|
workflow | string | yes | API workflow name. |
payload | object | no | JSON body sent to the workflow. |
initialize | boolean | no | Append /initialize for Bubble Detect data mode. |
trigger_workflow_get Write
Trigger an exposed Bubble API workflow using GET query parameters.
- Lua path
app.integrations.bubble.trigger_workflow_get- Full name
bubble.bubble_trigger_workflow_get
| Parameter | Type | Required | Description |
|---|---|---|---|
workflow | string | yes | API workflow name. |
params | object | no | Query parameters sent to the workflow. |