KosmoKrator

productivity

Lasso CRM Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the Lasso CRM KosmoKrator integration.

Lua Namespace

Agents call this integration through app.integrations.lasso.*. Use lua_read_doc("integrations.lasso") 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 Lasso CRM workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.lasso.list_contacts({project_id = "example_project_id", limit = 1, page = 1}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("lasso"))' --json
kosmo integrations:lua --eval 'print(docs.read("lasso.list_contacts"))' --json

Workflow file

Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.

workflow.lua
local lasso = app.integrations.lasso
local result = lasso.list_contacts({project_id = "example_project_id", limit = 1, page = 1})

dump(result)
Run the workflow
kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json
Namespace note. integrations:lua exposes app.integrations.lasso, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.lasso.default.* or app.integrations.lasso.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Lasso CRM, use the narrower mcp:lua command.

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.

Lasso CRM — Lua API Reference

list_contacts

List contacts (registrants) in Lasso CRM. Supports filtering by project and pagination.

Parameters

NameTypeRequiredDescription
project_idstringnoFilter contacts by project ID
limitintegernoMax results (default: 25)
pageintegernoPage number for pagination

Example

local result = app.integrations.lasso.list_contacts({
  project_id = "proj_abc123",
  limit = 10
})

for _, contact in ipairs(result.contacts) do
  print(contact.id .. ": " .. (contact.first_name or "") .. " " .. (contact.last_name or ""))
end

get_contact

Get full details for a single contact by ID.

Parameters

NameTypeRequiredDescription
idstringyesThe contact ID

Example

local contact = app.integrations.lasso.get_contact({
  id = "contact_abc123"
})

print(contact.first_name .. " " .. contact.last_name)
print("Email: " .. (contact.email or "N/A"))
print("Phone: " .. (contact.phone or "N/A"))

create_contact

Create a new contact (registrant) in Lasso CRM.

Parameters

NameTypeRequiredDescription
first_namestringnoContact first name
last_namestringnoContact last name
emailstringnoPrimary email address
phonestringnoPrimary phone number
project_idstringnoProject ID to associate with
sourcestringnoLead source (e.g., “Website”, “Referral”)
notesstringnoNotes about the contact

At least a first_name or last_name is required.

Example

local contact = app.integrations.lasso.create_contact({
  first_name = "Jane",
  last_name = "Smith",
  email = "jane@example.com",
  phone = "+1234567890",
  project_id = "proj_abc123",
  source = "Website"
})

print("Created contact: " .. contact.id)

list_deals

List deals (sales) in Lasso CRM with optional filters.

Parameters

NameTypeRequiredDescription
project_idstringnoFilter deals by project ID
statusstringnoFilter by deal status
limitintegernoMax results (default: 25)
pageintegernoPage number for pagination

Example

local result = app.integrations.lasso.list_deals({
  project_id = "proj_abc123",
  status = "Active",
  limit = 10
})

for _, deal in ipairs(result.deals) do
  print(deal.id .. ": " .. (deal.name or deal.id))
end

get_deal

Get full details for a single deal by ID.

Parameters

NameTypeRequiredDescription
idstringyesThe deal ID

Example

local deal = app.integrations.lasso.get_deal({
  id = "deal_abc123"
})

print("Deal: " .. (deal.name or deal.id))
print("Price: " .. (deal.price or "N/A"))
print("Status: " .. (deal.status or "N/A"))

list_inventory

List available inventory (units/lots) in Lasso CRM.

Parameters

NameTypeRequiredDescription
project_idstringnoFilter inventory by project ID
statusstringnoFilter by status (e.g., “Available”, “Sold”, “Reserved”)
limitintegernoMax results (default: 25)
pageintegernoPage number for pagination

Example

local result = app.integrations.lasso.list_inventory({
  project_id = "proj_abc123",
  status = "Available",
  limit = 10
})

for _, item in ipairs(result.inventory) do
  print(item.id .. ": " .. (item.name or item.unit_number or item.id))
end

get_current_user

Get the authenticated user’s profile.

Parameters

None.

Example

local user = app.integrations.lasso.get_current_user({})

print("Logged in as: " .. (user.first_name or "") .. " " .. (user.last_name or ""))
print("Email: " .. (user.email or "N/A"))

if user.organization then
  print("Organization: " .. (user.organization.name or "N/A"))
end

Multi-Account Usage

If you have multiple Lasso CRM accounts configured, use account-specific namespaces:

-- Default account (always works)
app.integrations.lasso.function_name({...})

-- Explicit default (portable across setups)
app.integrations.lasso.default.function_name({...})

-- Named accounts
app.integrations.lasso.downtown_project.function_name({...})
app.integrations.lasso.suburb_project.function_name({...})

All functions are identical across accounts — only the credentials differ.

Raw agent markdown
# Lasso CRM — Lua API Reference

## list_contacts

List contacts (registrants) in Lasso CRM. Supports filtering by project and pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project_id` | string | no | Filter contacts by project ID |
| `limit` | integer | no | Max results (default: 25) |
| `page` | integer | no | Page number for pagination |

### Example

```lua
local result = app.integrations.lasso.list_contacts({
  project_id = "proj_abc123",
  limit = 10
})

for _, contact in ipairs(result.contacts) do
  print(contact.id .. ": " .. (contact.first_name or "") .. " " .. (contact.last_name or ""))
end
```

---

## get_contact

Get full details for a single contact by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The contact ID |

### Example

```lua
local contact = app.integrations.lasso.get_contact({
  id = "contact_abc123"
})

print(contact.first_name .. " " .. contact.last_name)
print("Email: " .. (contact.email or "N/A"))
print("Phone: " .. (contact.phone or "N/A"))
```

---

## create_contact

Create a new contact (registrant) in Lasso CRM.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `first_name` | string | no | Contact first name |
| `last_name` | string | no | Contact last name |
| `email` | string | no | Primary email address |
| `phone` | string | no | Primary phone number |
| `project_id` | string | no | Project ID to associate with |
| `source` | string | no | Lead source (e.g., "Website", "Referral") |
| `notes` | string | no | Notes about the contact |

At least a `first_name` or `last_name` is required.

### Example

```lua
local contact = app.integrations.lasso.create_contact({
  first_name = "Jane",
  last_name = "Smith",
  email = "jane@example.com",
  phone = "+1234567890",
  project_id = "proj_abc123",
  source = "Website"
})

print("Created contact: " .. contact.id)
```

---

## list_deals

List deals (sales) in Lasso CRM with optional filters.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project_id` | string | no | Filter deals by project ID |
| `status` | string | no | Filter by deal status |
| `limit` | integer | no | Max results (default: 25) |
| `page` | integer | no | Page number for pagination |

### Example

```lua
local result = app.integrations.lasso.list_deals({
  project_id = "proj_abc123",
  status = "Active",
  limit = 10
})

for _, deal in ipairs(result.deals) do
  print(deal.id .. ": " .. (deal.name or deal.id))
end
```

---

## get_deal

Get full details for a single deal by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The deal ID |

### Example

```lua
local deal = app.integrations.lasso.get_deal({
  id = "deal_abc123"
})

print("Deal: " .. (deal.name or deal.id))
print("Price: " .. (deal.price or "N/A"))
print("Status: " .. (deal.status or "N/A"))
```

---

## list_inventory

List available inventory (units/lots) in Lasso CRM.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project_id` | string | no | Filter inventory by project ID |
| `status` | string | no | Filter by status (e.g., "Available", "Sold", "Reserved") |
| `limit` | integer | no | Max results (default: 25) |
| `page` | integer | no | Page number for pagination |

### Example

```lua
local result = app.integrations.lasso.list_inventory({
  project_id = "proj_abc123",
  status = "Available",
  limit = 10
})

for _, item in ipairs(result.inventory) do
  print(item.id .. ": " .. (item.name or item.unit_number or item.id))
end
```

---

## get_current_user

Get the authenticated user's profile.

### Parameters

None.

### Example

```lua
local user = app.integrations.lasso.get_current_user({})

print("Logged in as: " .. (user.first_name or "") .. " " .. (user.last_name or ""))
print("Email: " .. (user.email or "N/A"))

if user.organization then
  print("Organization: " .. (user.organization.name or "N/A"))
end
```

---

## Multi-Account Usage

If you have multiple Lasso CRM accounts configured, use account-specific namespaces:

```lua
-- Default account (always works)
app.integrations.lasso.function_name({...})

-- Explicit default (portable across setups)
app.integrations.lasso.default.function_name({...})

-- Named accounts
app.integrations.lasso.downtown_project.function_name({...})
app.integrations.lasso.suburb_project.function_name({...})
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.lasso.list_contacts({project_id = "example_project_id", limit = 1, page = 1})
print(result)

Functions

list_contacts Read

List contacts (registrants) in Lasso CRM. Optionally filter by project ID or other criteria. Supports pagination.

Lua path
app.integrations.lasso.list_contacts
Full name
lasso.lasso_list_contacts
ParameterTypeRequiredDescription
project_id string no Filter contacts by project ID.
limit integer no Maximum number of contacts to return (default: 25).
page integer no Page number for pagination.
get_contact Read

Get full details for a single contact (registrant) in Lasso CRM, including emails, phone numbers, and associated information.

Lua path
app.integrations.lasso.get_contact
Full name
lasso.lasso_get_contact
ParameterTypeRequiredDescription
id string yes The contact ID.
create_contact Write

Create a new contact (registrant) in Lasso CRM. Provide at least a first name or last name, and optionally email, phone, and other details.

Lua path
app.integrations.lasso.create_contact
Full name
lasso.lasso_create_contact
ParameterTypeRequiredDescription
first_name string no Contact first name.
last_name string no Contact last name.
email string no Primary email address.
phone string no Primary phone number.
project_id string no Project ID to associate the contact with.
source string no Lead source (e.g., "Website", "Referral").
notes string no Notes about the contact.
list_deals Read

List deals (sales) in Lasso CRM. Optionally filter by project ID or status. Supports pagination.

Lua path
app.integrations.lasso.list_deals
Full name
lasso.lasso_list_deals
ParameterTypeRequiredDescription
project_id string no Filter deals by project ID.
status string no Filter by deal status.
limit integer no Maximum number of deals to return (default: 25).
page integer no Page number for pagination.
get_deal Read

Get full details for a single deal (sale) in Lasso CRM, including pricing, unit details, and associated contacts.

Lua path
app.integrations.lasso.get_deal
Full name
lasso.lasso_get_deal
ParameterTypeRequiredDescription
id string yes The deal ID.
list_inventory Read

List available inventory (units/lots) in Lasso CRM. Optionally filter by project ID or status. Supports pagination.

Lua path
app.integrations.lasso.list_inventory
Full name
lasso.lasso_list_inventory
ParameterTypeRequiredDescription
project_id string no Filter inventory by project ID.
status string no Filter by inventory status (e.g., "Available", "Sold", "Reserved").
limit integer no Maximum number of inventory items to return (default: 25).
page integer no Page number for pagination.
get_current_user Read

Get the profile of the currently authenticated Lasso CRM user — name, email, organization, and other account details.

Lua path
app.integrations.lasso.get_current_user
Full name
lasso.lasso_get_current_user
ParameterTypeRequiredDescription
No parameters.