KosmoKrator

sales

ChurnZero Lua API for KosmoKrator Agents

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

7 functions 7 read 0 write API key auth

Lua Namespace

Agents call this integration through app.integrations.churnzero.*. Use lua_read_doc("integrations.churnzero") inside KosmoKrator to discover the same reference at runtime.

Agent-Facing Lua Docs

This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.

ChurnZero — Lua API Reference

list_accounts

Search and list accounts in ChurnZero. Supports filtering by search term and pagination.

Parameters

NameTypeRequiredDescription
searchstringnoSearch term to filter accounts by name or other attributes
pageintegernoPage number for pagination (default: 1)
perPageintegernoResults per page (default: 25, max: 100)

Example

local result = app.integrations.churnzero.list_accounts({
  search = "Acme",
  perPage = 10
})

for _, account in ipairs(result.accounts) do
  print(account.id .. ": " .. account.name)
end

get_account

Get full details for a single account by ID.

Parameters

NameTypeRequiredDescription
idstringyesThe account ID to retrieve

Example

local account = app.integrations.churnzero.get_account({
  id = "acc_abc123"
})

print(account.name)
print("Health Score: " .. (account.healthScore or "N/A"))
print("License Count: " .. (account.licenseCount or "0"))

list_contacts

List contacts, optionally filtered by account or search term.

Parameters

NameTypeRequiredDescription
account_idstringnoFilter contacts by account ID
searchstringnoSearch term to filter contacts by name or email
pageintegernoPage number for pagination (default: 1)
perPageintegernoResults per page (default: 25, max: 100)

Example

local result = app.integrations.churnzero.list_contacts({
  account_id = "acc_abc123",
  perPage = 50
})

for _, contact in ipairs(result.contacts) do
  print(contact.firstName .. " " .. contact.lastName .. " (" .. (contact.email or "") .. ")")
end

get_contact

Get full details for a single contact by ID.

Parameters

NameTypeRequiredDescription
idstringyesThe contact ID to retrieve

Example

local contact = app.integrations.churnzero.get_contact({
  id = "con_abc123"
})

print(contact.firstName .. " " .. contact.lastName)
print("Email: " .. (contact.email or "N/A"))
print("Role: " .. (contact.role or "N/A"))

list_alerts

List alerts — risk signals, usage drops, renewal reminders, and other notifications.

Parameters

NameTypeRequiredDescription
account_idstringnoFilter alerts by account ID
statusstringnoAlert status: "open", "dismissed", "snoozed"
pageintegernoPage number for pagination (default: 1)
perPageintegernoResults per page (default: 25, max: 100)

Example

local result = app.integrations.churnzero.list_alerts({
  status = "open",
  perPage = 10
})

for _, alert in ipairs(result.alerts) do
  print(alert.type .. ": " .. (alert.title or alert.message or ""))
end

list_usage

List usage data — track how customers engage with your product features.

Parameters

NameTypeRequiredDescription
account_idstringnoFilter usage data by account ID
featurestringnoFilter by feature or module name
pageintegernoPage number for pagination (default: 1)
perPageintegernoResults per page (default: 25, max: 100)

Example

local result = app.integrations.churnzero.list_usage({
  account_id = "acc_abc123",
  feature = "Reporting"
})

for _, entry in ipairs(result.usage) do
  print(entry.feature .. ": " .. entry.value)
end

get_current_user

Get the authenticated user’s profile.

Parameters

None.

Example

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

print("Logged in as: " .. (user.firstName or "") .. " " .. (user.lastName or ""))
print("Email: " .. (user.email or "N/A"))
print("Tenant: " .. (user.tenantName or "N/A"))

Multi-Account Usage

If you have multiple ChurnZero instances configured, use account-specific namespaces:

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

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

-- Named accounts
app.integrations.churnzero.us_team.function_name({...})
app.integrations.churnzero.eu_team.function_name({...})

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

Raw agent markdown
# ChurnZero — Lua API Reference

## list_accounts

Search and list accounts in ChurnZero. Supports filtering by search term and pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `search` | string | no | Search term to filter accounts by name or other attributes |
| `page` | integer | no | Page number for pagination (default: 1) |
| `perPage` | integer | no | Results per page (default: 25, max: 100) |

### Example

```lua
local result = app.integrations.churnzero.list_accounts({
  search = "Acme",
  perPage = 10
})

for _, account in ipairs(result.accounts) do
  print(account.id .. ": " .. account.name)
end
```

---

## get_account

Get full details for a single account by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The account ID to retrieve |

### Example

```lua
local account = app.integrations.churnzero.get_account({
  id = "acc_abc123"
})

print(account.name)
print("Health Score: " .. (account.healthScore or "N/A"))
print("License Count: " .. (account.licenseCount or "0"))
```

---

## list_contacts

List contacts, optionally filtered by account or search term.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `account_id` | string | no | Filter contacts by account ID |
| `search` | string | no | Search term to filter contacts by name or email |
| `page` | integer | no | Page number for pagination (default: 1) |
| `perPage` | integer | no | Results per page (default: 25, max: 100) |

### Example

```lua
local result = app.integrations.churnzero.list_contacts({
  account_id = "acc_abc123",
  perPage = 50
})

for _, contact in ipairs(result.contacts) do
  print(contact.firstName .. " " .. contact.lastName .. " (" .. (contact.email or "") .. ")")
end
```

---

## get_contact

Get full details for a single contact by ID.

### Parameters

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

### Example

```lua
local contact = app.integrations.churnzero.get_contact({
  id = "con_abc123"
})

print(contact.firstName .. " " .. contact.lastName)
print("Email: " .. (contact.email or "N/A"))
print("Role: " .. (contact.role or "N/A"))
```

---

## list_alerts

List alerts — risk signals, usage drops, renewal reminders, and other notifications.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `account_id` | string | no | Filter alerts by account ID |
| `status` | string | no | Alert status: `"open"`, `"dismissed"`, `"snoozed"` |
| `page` | integer | no | Page number for pagination (default: 1) |
| `perPage` | integer | no | Results per page (default: 25, max: 100) |

### Example

```lua
local result = app.integrations.churnzero.list_alerts({
  status = "open",
  perPage = 10
})

for _, alert in ipairs(result.alerts) do
  print(alert.type .. ": " .. (alert.title or alert.message or ""))
end
```

---

## list_usage

List usage data — track how customers engage with your product features.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `account_id` | string | no | Filter usage data by account ID |
| `feature` | string | no | Filter by feature or module name |
| `page` | integer | no | Page number for pagination (default: 1) |
| `perPage` | integer | no | Results per page (default: 25, max: 100) |

### Example

```lua
local result = app.integrations.churnzero.list_usage({
  account_id = "acc_abc123",
  feature = "Reporting"
})

for _, entry in ipairs(result.usage) do
  print(entry.feature .. ": " .. entry.value)
end
```

---

## get_current_user

Get the authenticated user's profile.

### Parameters

None.

### Example

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

print("Logged in as: " .. (user.firstName or "") .. " " .. (user.lastName or ""))
print("Email: " .. (user.email or "N/A"))
print("Tenant: " .. (user.tenantName or "N/A"))
```

---

## Multi-Account Usage

If you have multiple ChurnZero instances configured, use account-specific namespaces:

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

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

-- Named accounts
app.integrations.churnzero.us_team.function_name({...})
app.integrations.churnzero.eu_team.function_name({...})
```

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

Metadata-Derived Lua Example

local result = app.integrations.churnzero.churnzero_list_accounts({
  search = "example_search",
  page = 1,
  perPage = 1
})
print(result)

Functions

churnzero_list_accounts

Search and list accounts in ChurnZero. Use the search parameter to filter accounts by name or other attributes. Returns a paginated list of accounts with their details.

Operation
Read read
Full name
churnzero.churnzero_list_accounts
ParameterTypeRequiredDescription
search string no Search term to filter accounts by name or other attributes.
page integer no Page number for pagination (default: 1).
perPage integer no Number of results per page (default: 25, max: 100).

churnzero_get_account

Get full details for a single account in ChurnZero, including health score, license information, custom fields, and associated data.

Operation
Read read
Full name
churnzero.churnzero_get_account
ParameterTypeRequiredDescription
id string yes The account ID to retrieve.

churnzero_list_contacts

List contacts in ChurnZero. Optionally filter by account ID to get contacts for a specific account, or use search to find contacts by name or email. Supports pagination.

Operation
Read read
Full name
churnzero.churnzero_list_contacts
ParameterTypeRequiredDescription
account_id string no Filter contacts by account ID.
search string no Search term to filter contacts by name or email.
page integer no Page number for pagination (default: 1).
perPage integer no Number of results per page (default: 25, max: 100).

churnzero_get_contact

Get full details for a single contact in ChurnZero, including email, phone, role, account association, and custom fields.

Operation
Read read
Full name
churnzero.churnzero_get_contact
ParameterTypeRequiredDescription
id string yes The contact ID to retrieve.

churnzero_list_alerts

List alerts in ChurnZero — risk signals, usage drops, renewal reminders, and other notifications. Filter by account ID or alert status. Supports pagination.

Operation
Read read
Full name
churnzero.churnzero_list_alerts
ParameterTypeRequiredDescription
account_id string no Filter alerts by account ID.
status string no Filter by alert status. Common values: "open", "dismissed", "snoozed".
page integer no Page number for pagination (default: 1).
perPage integer no Number of results per page (default: 25, max: 100).

churnzero_list_usage

List usage data in ChurnZero — track how customers engage with your product features. Filter by account ID or specific feature/module name. Supports pagination.

Operation
Read read
Full name
churnzero.churnzero_list_usage
ParameterTypeRequiredDescription
account_id string no Filter usage data by account ID.
feature string no Filter by feature or module name.
page integer no Page number for pagination (default: 1).
perPage integer no Number of results per page (default: 25, max: 100).

churnzero_get_current_user

Get the profile of the currently authenticated ChurnZero user — name, email, role, tenant, and other account details.

Operation
Read read
Full name
churnzero.churnzero_get_current_user
ParameterTypeRequiredDescription
No parameters.