KosmoKrator

productivity

ClickSend Lua API for KosmoKrator Agents

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

Lua Namespace

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

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.clicksend.get_account_balance({}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("clicksend"))' --json
kosmo integrations:lua --eval 'print(docs.read("clicksend.get_account_balance"))' --json

Workflow file

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

workflow.lua
local clicksend = app.integrations.clicksend
local result = clicksend.get_account_balance({})

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.clicksend, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.clicksend.default.* or app.integrations.clicksend.work.* when you configured named credential accounts.

MCP-only Lua

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

Client for the ClickSend REST API — Lua API Reference

clicksend_get_account_balance

Get the current ClickSend account balance..

Example

local result = app.integrations.clicksend.clicksend_get_account_balance({
})

clicksend_get_email_history

Get email message history from ClickSend with pagination..

Parameters

NameTypeRequiredDescription
limitintegernoNumber of records per page (default 15).
pageintegernoPage number for pagination (default 1).

Example

local result = app.integrations.clicksend.clicksend_get_email_history({
  limit = 0
  page = 0
})

clicksend_get_sms_history

Get SMS message history from ClickSend. Supports date range filtering and pagination..

Parameters

NameTypeRequiredDescription
date_fromstringnoStart date for history (YYYY-MM-DD or Unix timestamp).
date_tostringnoEnd date for history (YYYY-MM-DD or Unix timestamp).
limitintegernoNumber of records per page (default 15).
pageintegernoPage number for pagination (default 1).

Example

local result = app.integrations.clicksend.clicksend_get_sms_history({
  date_from = ""
  date_to = ""
  limit = 0
})

clicksend_get_sms_price

Get pricing for SMS messages before sending. Uses the same message format as send SMS but returns cost estimates only..

Parameters

NameTypeRequiredDescription
messagesarrayyesArray of message objects. Each object must have

Example

local result = app.integrations.clicksend.clicksend_get_sms_price({
  messages = {}
})

clicksend_get_voice_history

Get voice message history from ClickSend with pagination..

Parameters

NameTypeRequiredDescription
limitintegernoNumber of records per page (default 15).
pageintegernoPage number for pagination (default 1).

Example

local result = app.integrations.clicksend.clicksend_get_voice_history({
  limit = 0
  page = 0
})

clicksend_list_contact_lists

List all contact lists from ClickSend with pagination..

Parameters

NameTypeRequiredDescription
limitintegernoNumber of records per page (default 15).
pageintegernoPage number for pagination (default 1).

Example

local result = app.integrations.clicksend.clicksend_list_contact_lists({
  limit = 0
  page = 0
})

clicksend_send_email

Send an email message via ClickSend. Requires recipient, subject, and body..

Parameters

NameTypeRequiredDescription
tostringyesRecipient email address.
subjectstringyesEmail subject line.
bodystringyesEmail body content (HTML supported).
from_email_addressstringnoSender email address.
from_namestringnoSender display name.

Example

local result = app.integrations.clicksend.clicksend_send_email({
  to = ""
  subject = ""
  body = ""
})

clicksend_send_post_letter

Send a post letter via ClickSend. Provide a file URL or template ID with recipient details..

Parameters

NameTypeRequiredDescription
file_urlstringnoURL to the PDF file to send as a letter.
template_idintegernoClickSend template ID to use instead of a file URL.
recipientsarrayyesArray of recipient objects with name, address, city, state, postal_code, country.
duplexintegernoPrint on both sides: 0 for simplex, 1 for duplex (default 0).

Example

local result = app.integrations.clicksend.clicksend_send_post_letter({
  file_url = ""
  template_id = 0
  recipients = {}
})

clicksend_send_sms

Send one or more SMS messages via ClickSend. Each message requires a.

Parameters

NameTypeRequiredDescription
messagesarrayyesArray of message objects. Each object must have

Example

local result = app.integrations.clicksend.clicksend_send_sms({
  messages = {}
})

clicksend_send_voice

Send one or more voice messages via ClickSend. Each message requires a.

Parameters

NameTypeRequiredDescription
messagesarrayyesArray of voice message objects. Each object must have

Example

local result = app.integrations.clicksend.clicksend_send_voice({
  messages = {}
})

Multi-Account Usage

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

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

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

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

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

Raw agent markdown
# Client for the ClickSend REST API — Lua API Reference

## clicksend_get_account_balance

Get the current ClickSend account balance..

### Example

```lua
local result = app.integrations.clicksend.clicksend_get_account_balance({
})
```

## clicksend_get_email_history

Get email message history from ClickSend with pagination..

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Number of records per page (default 15). |
| `page` | integer | no | Page number for pagination (default 1). |

### Example

```lua
local result = app.integrations.clicksend.clicksend_get_email_history({
  limit = 0
  page = 0
})
```

## clicksend_get_sms_history

Get SMS message history from ClickSend. Supports date range filtering and pagination..

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `date_from` | string | no | Start date for history (YYYY-MM-DD or Unix timestamp). |
| `date_to` | string | no | End date for history (YYYY-MM-DD or Unix timestamp). |
| `limit` | integer | no | Number of records per page (default 15). |
| `page` | integer | no | Page number for pagination (default 1). |

### Example

```lua
local result = app.integrations.clicksend.clicksend_get_sms_history({
  date_from = ""
  date_to = ""
  limit = 0
})
```

## clicksend_get_sms_price

Get pricing for SMS messages before sending. Uses the same message format as send SMS but returns cost estimates only..

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `messages` | array | yes | Array of message objects. Each object must have  |

### Example

```lua
local result = app.integrations.clicksend.clicksend_get_sms_price({
  messages = {}
})
```

## clicksend_get_voice_history

Get voice message history from ClickSend with pagination..

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Number of records per page (default 15). |
| `page` | integer | no | Page number for pagination (default 1). |

### Example

```lua
local result = app.integrations.clicksend.clicksend_get_voice_history({
  limit = 0
  page = 0
})
```

## clicksend_list_contact_lists

List all contact lists from ClickSend with pagination..

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Number of records per page (default 15). |
| `page` | integer | no | Page number for pagination (default 1). |

### Example

```lua
local result = app.integrations.clicksend.clicksend_list_contact_lists({
  limit = 0
  page = 0
})
```

## clicksend_send_email

Send an email message via ClickSend. Requires recipient, subject, and body..

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `to` | string | yes | Recipient email address. |
| `subject` | string | yes | Email subject line. |
| `body` | string | yes | Email body content (HTML supported). |
| `from_email_address` | string | no | Sender email address. |
| `from_name` | string | no | Sender display name. |

### Example

```lua
local result = app.integrations.clicksend.clicksend_send_email({
  to = ""
  subject = ""
  body = ""
})
```

## clicksend_send_post_letter

Send a post letter via ClickSend. Provide a file URL or template ID with recipient details..

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `file_url` | string | no | URL to the PDF file to send as a letter. |
| `template_id` | integer | no | ClickSend template ID to use instead of a file URL. |
| `recipients` | array | yes | Array of recipient objects with name, address, city, state, postal_code, country. |
| `duplex` | integer | no | Print on both sides: 0 for simplex, 1 for duplex (default 0). |

### Example

```lua
local result = app.integrations.clicksend.clicksend_send_post_letter({
  file_url = ""
  template_id = 0
  recipients = {}
})
```

## clicksend_send_sms

Send one or more SMS messages via ClickSend. Each message requires a.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `messages` | array | yes | Array of message objects. Each object must have  |

### Example

```lua
local result = app.integrations.clicksend.clicksend_send_sms({
  messages = {}
})
```

## clicksend_send_voice

Send one or more voice messages via ClickSend. Each message requires a.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `messages` | array | yes | Array of voice message objects. Each object must have  |

### Example

```lua
local result = app.integrations.clicksend.clicksend_send_voice({
  messages = {}
})
```

---

## Multi-Account Usage

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

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

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

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

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.clicksend.get_account_balance({})
print(result)

Functions

get_account_balance Read

Get the current ClickSend account balance.

Lua path
app.integrations.clicksend.get_account_balance
Full name
clicksend.clicksend_get_account_balance
ParameterTypeRequiredDescription
No parameters.
get_email_history Read

Get email message history from ClickSend with pagination.

Lua path
app.integrations.clicksend.get_email_history
Full name
clicksend.clicksend_get_email_history
ParameterTypeRequiredDescription
limit integer no Number of records per page (default 15).
page integer no Page number for pagination (default 1).
get_sms_history Read

Get SMS message history from ClickSend. Supports date range filtering and pagination.

Lua path
app.integrations.clicksend.get_sms_history
Full name
clicksend.clicksend_get_sms_history
ParameterTypeRequiredDescription
date_from string no Start date for history (YYYY-MM-DD or Unix timestamp).
date_to string no End date for history (YYYY-MM-DD or Unix timestamp).
limit integer no Number of records per page (default 15).
page integer no Page number for pagination (default 1).
get_sms_price Read

Get pricing for SMS messages before sending. Uses the same message format as send SMS but returns cost estimates only.

Lua path
app.integrations.clicksend.get_sms_price
Full name
clicksend.clicksend_get_sms_price
ParameterTypeRequiredDescription
messages array yes Array of message objects. Each object must have "to" (phone number) and "body" (text). Optional: "from" (sender ID).
get_voice_history Read

Get voice message history from ClickSend with pagination.

Lua path
app.integrations.clicksend.get_voice_history
Full name
clicksend.clicksend_get_voice_history
ParameterTypeRequiredDescription
limit integer no Number of records per page (default 15).
page integer no Page number for pagination (default 1).
list_contact_lists Read

List all contact lists from ClickSend with pagination.

Lua path
app.integrations.clicksend.list_contact_lists
Full name
clicksend.clicksend_list_contact_lists
ParameterTypeRequiredDescription
limit integer no Number of records per page (default 15).
page integer no Page number for pagination (default 1).
email Write

Send an email message via ClickSend. Requires recipient, subject, and body.

Lua path
app.integrations.clicksend.email
Full name
clicksend.clicksend_send_email
ParameterTypeRequiredDescription
to string yes Recipient email address.
subject string yes Email subject line.
body string yes Email body content (HTML supported).
from_email_address string no Sender email address.
from_name string no Sender display name.
post_letter Write

Send a post letter via ClickSend. Provide a file URL or template ID with recipient details.

Lua path
app.integrations.clicksend.post_letter
Full name
clicksend.clicksend_send_post_letter
ParameterTypeRequiredDescription
file_url string no URL to the PDF file to send as a letter.
template_id integer no ClickSend template ID to use instead of a file URL.
recipients array yes Array of recipient objects with name, address, city, state, postal_code, country.
duplex integer no Print on both sides: 0 for simplex, 1 for duplex (default 0).
sms Write

Send one or more SMS messages via ClickSend. Each message requires a "to" phone number and "body" text.

Lua path
app.integrations.clicksend.sms
Full name
clicksend.clicksend_send_sms
ParameterTypeRequiredDescription
messages array yes Array of message objects. Each object must have "to" (phone number) and "body" (text). Optional: "from" (sender ID).
voice Write

Send one or more voice messages via ClickSend. Each message requires a "to" phone number and "body" text.

Lua path
app.integrations.clicksend.voice
Full name
clicksend.clicksend_send_voice
ParameterTypeRequiredDescription
messages array yes Array of voice message objects. Each object must have "to" (phone number) and "body" (text). Optional: "voice" (voice type), "lang" (language code).