KosmoKrator

productivity

Sinch Lua API for KosmoKrator Agents

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

Lua Namespace

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

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.sinch.get_group({group_id = "example_group_id"}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("sinch"))' --json
kosmo integrations:lua --eval 'print(docs.read("sinch.get_group"))' --json

Workflow file

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

workflow.lua
local sinch = app.integrations.sinch
local result = sinch.get_group({group_id = "example_group_id"})

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

MCP-only Lua

If the script only needs configured MCP servers and does not need Sinch, 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 Sinch SMS API — Lua API Reference

sinch_list_messages

List inbound and outbound SMS messages from Sinch. Supports filtering by direction, recipient, sender, and date range.

Parameters

NameTypeRequiredDescription
directionstringnoFilter by direction: “mt” (mobile terminated / outbound) or “mo” (mobile originated / inbound).
tostringnoFilter by destination phone number (E.164 format).
fromstringnoFilter by originating phone number or sender (E.164 format).
start_datestringnoStart date for filtering (ISO 8601 format, e.g. 2024-01-01T00:00:00Z).
end_datestringnoEnd date for filtering (ISO 8601 format, e.g. 2024-12-31T23:59:59Z).
pageintegernoPage number for pagination (default 0).
page_sizeintegernoNumber of results per page (default 30, max 100).

Example

local result = app.integrations.sinch.sinch_list_messages({
  direction = "mt"
  page = 0
  page_size = 30
})

sinch_send_sms

Send an SMS message to one or more recipients via Sinch. Requires sender phone number, recipient(s), and message body.

Parameters

NameTypeRequiredDescription
fromstringyesSender phone number or alphanumeric sender ID (E.164 format for numbers).
toarrayyesArray of recipient phone numbers in E.164 format (e.g. [“+1234567890”]).
bodystringyesThe SMS message body text.
delivery_reportstringnoDelivery report type: “none”, “summary”, or “full” (default “none”).
expire_atstringnoMessage expiration time in ISO 8601 format.
send_atstringnoScheduled send time in ISO 8601 format.

Example

local result = app.integrations.sinch.sinch_send_sms({
  from = "+1234567890"
  to = {"+1987654321"}
  body = "Hello from Sinch!"
})

sinch_list_phone_numbers

List all rented phone numbers in your Sinch account with pagination.

Parameters

NameTypeRequiredDescription
pageintegernoPage number for pagination (default 0).
page_sizeintegernoNumber of results per page (default 30, max 100).

Example

local result = app.integrations.sinch.sinch_list_phone_numbers({
  page = 0
  page_size = 30
})

sinch_get_phone_number

Get details for a specific phone number in your Sinch account.

Parameters

NameTypeRequiredDescription
phone_numberstringyesThe phone number to look up (E.164 format, e.g. “+1234567890”).

Example

local result = app.integrations.sinch.sinch_get_phone_number({
  phone_number = "+1234567890"
})

sinch_list_groups

List all groups in your Sinch account with pagination.

Parameters

NameTypeRequiredDescription
pageintegernoPage number for pagination (default 0).
page_sizeintegernoNumber of results per page (default 30, max 100).

Example

local result = app.integrations.sinch.sinch_list_groups({
  page = 0
  page_size = 30
})

sinch_get_group

Get details for a specific group in your Sinch account.

Parameters

NameTypeRequiredDescription
group_idstringyesThe unique identifier of the group.

Example

local result = app.integrations.sinch.sinch_get_group({
  group_id = "group_abc123"
})

sinch_list_batches

List all message batches in your Sinch account with pagination.

Parameters

NameTypeRequiredDescription
pageintegernoPage number for pagination (default 0).
page_sizeintegernoNumber of results per page (default 30, max 100).

Example

local result = app.integrations.sinch.sinch_list_batches({
  page = 0
  page_size = 30
})

Multi-Account Usage

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

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

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

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

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

Raw agent markdown
# Client for the Sinch SMS API — Lua API Reference

## sinch_list_messages

List inbound and outbound SMS messages from Sinch. Supports filtering by direction, recipient, sender, and date range.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `direction` | string | no | Filter by direction: "mt" (mobile terminated / outbound) or "mo" (mobile originated / inbound). |
| `to` | string | no | Filter by destination phone number (E.164 format). |
| `from` | string | no | Filter by originating phone number or sender (E.164 format). |
| `start_date` | string | no | Start date for filtering (ISO 8601 format, e.g. 2024-01-01T00:00:00Z). |
| `end_date` | string | no | End date for filtering (ISO 8601 format, e.g. 2024-12-31T23:59:59Z). |
| `page` | integer | no | Page number for pagination (default 0). |
| `page_size` | integer | no | Number of results per page (default 30, max 100). |

### Example

```lua
local result = app.integrations.sinch.sinch_list_messages({
  direction = "mt"
  page = 0
  page_size = 30
})
```

## sinch_send_sms

Send an SMS message to one or more recipients via Sinch. Requires sender phone number, recipient(s), and message body.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `from` | string | yes | Sender phone number or alphanumeric sender ID (E.164 format for numbers). |
| `to` | array | yes | Array of recipient phone numbers in E.164 format (e.g. ["+1234567890"]). |
| `body` | string | yes | The SMS message body text. |
| `delivery_report` | string | no | Delivery report type: "none", "summary", or "full" (default "none"). |
| `expire_at` | string | no | Message expiration time in ISO 8601 format. |
| `send_at` | string | no | Scheduled send time in ISO 8601 format. |

### Example

```lua
local result = app.integrations.sinch.sinch_send_sms({
  from = "+1234567890"
  to = {"+1987654321"}
  body = "Hello from Sinch!"
})
```

## sinch_list_phone_numbers

List all rented phone numbers in your Sinch account with pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number for pagination (default 0). |
| `page_size` | integer | no | Number of results per page (default 30, max 100). |

### Example

```lua
local result = app.integrations.sinch.sinch_list_phone_numbers({
  page = 0
  page_size = 30
})
```

## sinch_get_phone_number

Get details for a specific phone number in your Sinch account.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `phone_number` | string | yes | The phone number to look up (E.164 format, e.g. "+1234567890"). |

### Example

```lua
local result = app.integrations.sinch.sinch_get_phone_number({
  phone_number = "+1234567890"
})
```

## sinch_list_groups

List all groups in your Sinch account with pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number for pagination (default 0). |
| `page_size` | integer | no | Number of results per page (default 30, max 100). |

### Example

```lua
local result = app.integrations.sinch.sinch_list_groups({
  page = 0
  page_size = 30
})
```

## sinch_get_group

Get details for a specific group in your Sinch account.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `group_id` | string | yes | The unique identifier of the group. |

### Example

```lua
local result = app.integrations.sinch.sinch_get_group({
  group_id = "group_abc123"
})
```

## sinch_list_batches

List all message batches in your Sinch account with pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number for pagination (default 0). |
| `page_size` | integer | no | Number of results per page (default 30, max 100). |

### Example

```lua
local result = app.integrations.sinch.sinch_list_batches({
  page = 0
  page_size = 30
})
```

---

## Multi-Account Usage

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

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

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

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

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.sinch.get_group({group_id = "example_group_id"})
print(result)

Functions

get_group Read

Get details for a specific group in your Sinch account.

Lua path
app.integrations.sinch.get_group
Full name
sinch.sinch_get_group
ParameterTypeRequiredDescription
group_id string yes The unique identifier of the group.
get_phone_number Read

Get details for a specific phone number in your Sinch account.

Lua path
app.integrations.sinch.get_phone_number
Full name
sinch.sinch_get_phone_number
ParameterTypeRequiredDescription
phone_number string yes The phone number to look up (E.164 format, e.g. "+1234567890").
list_batches Read

List all message batches in your Sinch account with pagination.

Lua path
app.integrations.sinch.list_batches
Full name
sinch.sinch_list_batches
ParameterTypeRequiredDescription
page integer no Page number for pagination (default 0).
page_size integer no Number of results per page (default 30, max 100).
list_groups Read

List all groups in your Sinch account with pagination.

Lua path
app.integrations.sinch.list_groups
Full name
sinch.sinch_list_groups
ParameterTypeRequiredDescription
page integer no Page number for pagination (default 0).
page_size integer no Number of results per page (default 30, max 100).
list_messages Read

List inbound and outbound SMS messages from Sinch. Supports filtering by direction, recipient, sender, and date range.

Lua path
app.integrations.sinch.list_messages
Full name
sinch.sinch_list_messages
ParameterTypeRequiredDescription
direction string no Filter by direction: "mt" (mobile terminated / outbound) or "mo" (mobile originated / inbound).
to string no Filter by destination phone number (E.164 format).
from string no Filter by originating phone number or sender (E.164 format).
start_date string no Start date for filtering (ISO 8601 format, e.g. 2024-01-01T00:00:00Z).
end_date string no End date for filtering (ISO 8601 format, e.g. 2024-12-31T23:59:59Z).
page integer no Page number for pagination (default 0).
page_size integer no Number of results per page (default 30, max 100).
list_phone_numbers Read

List all rented phone numbers in your Sinch account with pagination.

Lua path
app.integrations.sinch.list_phone_numbers
Full name
sinch.sinch_list_phone_numbers
ParameterTypeRequiredDescription
page integer no Page number for pagination (default 0).
page_size integer no Number of results per page (default 30, max 100).
send_sms Write

Send an SMS message to one or more recipients via Sinch. Requires sender phone number, recipient(s), and message body.

Lua path
app.integrations.sinch.send_sms
Full name
sinch.sinch_send_sms
ParameterTypeRequiredDescription
from string yes Sender phone number or alphanumeric sender ID (E.164 format for numbers).
to array yes Array of recipient phone numbers in E.164 format (e.g. ["+1234567890"]).
body string yes The SMS message body text.
delivery_report string no Delivery report type: "none", "summary", or "full" (default "none").
expire_at string no Message expiration time in ISO 8601 format.
send_at string no Scheduled send time in ISO 8601 format.