KosmoKrator

productivity

Actively Lua API for KosmoKrator Agents

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

Lua Namespace

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

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

Workflow file

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

workflow.lua
local actively = app.integrations.actively
local result = actively.list_organizations({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.actively, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.actively.default.* or app.integrations.actively.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Actively, 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.

Actively CRM - Lua API Reference

list_organizations

List organizations you have access to in Actively.

Parameters

NameTypeRequiredDescription
limitintegernoMax organizations to return (default: 25)
pageintegernoPage number for pagination (default: 1)

Example

local result = app.integrations.actively.list_organizations({
  limit = 10,
  page = 1
})

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

get_current_user

Get the authenticated user’s profile from Actively.

Parameters

None.

Example

local user = app.integrations.actively.get_current_user({})
print("Logged in as: " .. user.name .. " (" .. user.email .. ")")

list_campaigns

List campaigns for an organization in Actively.

Parameters

NameTypeRequiredDescription
org_idstringyesThe organization UUID
limitintegernoMax campaigns to return (default: 25)
pageintegernoPage number for pagination (default: 1)

Example

local result = app.integrations.actively.list_campaigns({
  org_id = "org_abc123",
  limit = 10,
  page = 1
})

for _, campaign in ipairs(result.data) do
  print(campaign.title .. " (" .. campaign.type .. ") - " .. campaign.status)
end

get_campaign

Get details of a specific campaign in Actively.

Parameters

NameTypeRequiredDescription
org_idstringyesThe organization UUID
campaign_idstringyesThe campaign UUID

Example

local campaign = app.integrations.actively.get_campaign({
  org_id = "org_abc123",
  campaign_id = "camp_xyz789"
})

print(campaign.title)
print("Type: " .. campaign.type)
print("Period: " .. campaign.start_date .. " to " .. campaign.end_date)

create_campaign

Create a new campaign for an organization in Actively.

Parameters

NameTypeRequiredDescription
org_idstringyesThe organization UUID
titlestringyesThe campaign title
typestringyesCampaign type (e.g., "email", "social", "ads")
start_datestringyesStart date in ISO 8601 format (e.g., "2026-01-01")
end_datestringyesEnd date in ISO 8601 format (e.g., "2026-03-31")

Example

local campaign = app.integrations.actively.create_campaign({
  org_id = "org_abc123",
  title = "Q1 Product Launch",
  type = "email",
  start_date = "2026-01-15",
  end_date = "2026-03-31"
})

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

list_contacts

List contacts for an organization in Actively.

Parameters

NameTypeRequiredDescription
org_idstringyesThe organization UUID
limitintegernoMax contacts to return (default: 25)
pageintegernoPage number for pagination (default: 1)

Example

local result = app.integrations.actively.list_contacts({
  org_id = "org_abc123",
  limit = 50,
  page = 1
})

for _, contact in ipairs(result.data) do
  print(contact.name .. " - " .. contact.email)
end

get_contact

Get details of a specific contact in Actively.

Parameters

NameTypeRequiredDescription
org_idstringyesThe organization UUID
contact_idstringyesThe contact UUID

Example

local contact = app.integrations.actively.get_contact({
  org_id = "org_abc123",
  contact_id = "cont_def456"
})

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

Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.actively.work.function_name({...})
app.integrations.actively.personal.function_name({...})

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

Raw agent markdown
# Actively CRM - Lua API Reference

## list_organizations

List organizations you have access to in Actively.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Max organizations to return (default: 25) |
| `page` | integer | no | Page number for pagination (default: 1) |

### Example

```lua
local result = app.integrations.actively.list_organizations({
  limit = 10,
  page = 1
})

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

---

## get_current_user

Get the authenticated user's profile from Actively.

### Parameters

None.

### Example

```lua
local user = app.integrations.actively.get_current_user({})
print("Logged in as: " .. user.name .. " (" .. user.email .. ")")
```

---

## list_campaigns

List campaigns for an organization in Actively.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `org_id` | string | yes | The organization UUID |
| `limit` | integer | no | Max campaigns to return (default: 25) |
| `page` | integer | no | Page number for pagination (default: 1) |

### Example

```lua
local result = app.integrations.actively.list_campaigns({
  org_id = "org_abc123",
  limit = 10,
  page = 1
})

for _, campaign in ipairs(result.data) do
  print(campaign.title .. " (" .. campaign.type .. ") - " .. campaign.status)
end
```

---

## get_campaign

Get details of a specific campaign in Actively.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `org_id` | string | yes | The organization UUID |
| `campaign_id` | string | yes | The campaign UUID |

### Example

```lua
local campaign = app.integrations.actively.get_campaign({
  org_id = "org_abc123",
  campaign_id = "camp_xyz789"
})

print(campaign.title)
print("Type: " .. campaign.type)
print("Period: " .. campaign.start_date .. " to " .. campaign.end_date)
```

---

## create_campaign

Create a new campaign for an organization in Actively.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `org_id` | string | yes | The organization UUID |
| `title` | string | yes | The campaign title |
| `type` | string | yes | Campaign type (e.g., `"email"`, `"social"`, `"ads"`) |
| `start_date` | string | yes | Start date in ISO 8601 format (e.g., `"2026-01-01"`) |
| `end_date` | string | yes | End date in ISO 8601 format (e.g., `"2026-03-31"`) |

### Example

```lua
local campaign = app.integrations.actively.create_campaign({
  org_id = "org_abc123",
  title = "Q1 Product Launch",
  type = "email",
  start_date = "2026-01-15",
  end_date = "2026-03-31"
})

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

---

## list_contacts

List contacts for an organization in Actively.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `org_id` | string | yes | The organization UUID |
| `limit` | integer | no | Max contacts to return (default: 25) |
| `page` | integer | no | Page number for pagination (default: 1) |

### Example

```lua
local result = app.integrations.actively.list_contacts({
  org_id = "org_abc123",
  limit = 50,
  page = 1
})

for _, contact in ipairs(result.data) do
  print(contact.name .. " - " .. contact.email)
end
```

---

## get_contact

Get details of a specific contact in Actively.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `org_id` | string | yes | The organization UUID |
| `contact_id` | string | yes | The contact UUID |

### Example

```lua
local contact = app.integrations.actively.get_contact({
  org_id = "org_abc123",
  contact_id = "cont_def456"
})

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

---

## Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.actively.work.function_name({...})
app.integrations.actively.personal.function_name({...})
```

All functions are identical across accounts - only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.actively.list_organizations({limit = 1, page = 1})
print(result)

Functions

list_organizations Read

List organizations you have access to in Actively. Returns organization names and UUIDs needed for campaign and contact operations. Paginate with limit and page parameters.

Lua path
app.integrations.actively.list_organizations
Full name
actively.actively_list_organizations
ParameterTypeRequiredDescription
limit integer no Maximum number of organizations to return (default: 25).
page integer no Page number for pagination (default: 1).
get_current_user Read

Get the authenticated user's profile from Actively. Returns user name, email, role, and organization memberships.

Lua path
app.integrations.actively.get_current_user
Full name
actively.actively_get_current_user
ParameterTypeRequiredDescription
No parameters.
list_campaigns Read

List campaigns for an organization in Actively. Returns campaign details including title, type, status, and date range. Paginate with limit and page parameters.

Lua path
app.integrations.actively.list_campaigns
Full name
actively.actively_list_campaigns
ParameterTypeRequiredDescription
org_id string yes The organization UUID.
limit integer no Maximum number of campaigns to return (default: 25).
page integer no Page number for pagination (default: 1).
get_campaign Read

Get details of a specific campaign in Actively. Returns the campaign title, type, status, date range, and all associated metadata.

Lua path
app.integrations.actively.get_campaign
Full name
actively.actively_get_campaign
ParameterTypeRequiredDescription
org_id string yes The organization UUID.
campaign_id string yes The campaign UUID.
create_campaign Write

Create a new campaign for an organization in Actively. Specify the campaign title, type (e.g., "email", "social", "ads"), and the start and end dates.

Lua path
app.integrations.actively.create_campaign
Full name
actively.actively_create_campaign
ParameterTypeRequiredDescription
org_id string yes The organization UUID.
title string yes The campaign title.
type string yes The campaign type (e.g., "email", "social", "ads").
start_date string yes Campaign start date in ISO 8601 format (e.g., "2026-01-01").
end_date string yes Campaign end date in ISO 8601 format (e.g., "2026-03-31").
list_contacts Read

List contacts for an organization in Actively. Returns contact details including name, email, phone, and any associated metadata. Paginate with limit and page parameters.

Lua path
app.integrations.actively.list_contacts
Full name
actively.actively_list_contacts
ParameterTypeRequiredDescription
org_id string yes The organization UUID.
limit integer no Maximum number of contacts to return (default: 25).
page integer no Page number for pagination (default: 1).
get_contact Read

Get details of a specific contact in Actively. Returns the contact's name, email, phone, and all associated metadata.

Lua path
app.integrations.actively.get_contact
Full name
actively.actively_get_contact
ParameterTypeRequiredDescription
org_id string yes The organization UUID.
contact_id string yes The contact UUID.