productivity
Plivo Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Plivo KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.plivo.*.
Use lua_read_doc("integrations.plivo") 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
Plivo workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.plivo.list_messages({limit = 1, offset = 1, message_direction = "example_message_direction", message_state = "example_message_state", src = "example_src", dst = "example_dst", start_time = "example_start_time", end_time = "example_end_time"}))' --json kosmo integrations:lua --eval 'print(docs.read("plivo"))' --json
kosmo integrations:lua --eval 'print(docs.read("plivo.list_messages"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local plivo = app.integrations.plivo
local result = plivo.list_messages({limit = 1, offset = 1, message_direction = "example_message_direction", message_state = "example_message_state", src = "example_src", dst = "example_dst", start_time = "example_start_time", end_time = "example_end_time"})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.plivo, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.plivo.default.* or app.integrations.plivo.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Plivo, use the narrower 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.
Plivo — Lua API Reference
list_messages
List SMS messages from Plivo with optional filters and pagination.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of results (default: 20, max: 100) |
offset | integer | no | Offset for pagination (default: 0) |
message_direction | string | no | Filter by direction: "inbound" or "outbound" |
message_state | string | no | Filter by state: "queued", "sent", "delivered", "undelivered", "failed" |
src | string | no | Filter by source phone number (sender) |
dst | string | no | Filter by destination phone number (recipient) |
start_time | string | no | Filter messages after this datetime (ISO 8601) |
end_time | string | no | Filter messages before this datetime (ISO 8601) |
Example
local result = app.integrations.plivo.list_messages({
limit = 10,
message_direction = "outbound"
})
for _, msg in ipairs(result.objects) do
print(msg.message_uuid .. ": " .. msg.from .. " -> " .. msg.to .. " [" .. msg.message_state .. "]")
end
send_sms
Send an SMS message via Plivo.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
src | string | yes | Source phone number (must be a Plivo-hosted number, e.g., "+14155552671") |
dst | string | yes | Destination number(s). Single number or multiple separated by "<" |
text | string | yes | The SMS message text content |
type | string | no | Message type: "sms" (default) or "mms" |
url | string | no | Webhook URL for delivery status callbacks |
log | boolean | no | Whether to log the message (default: true) |
Example
local result = app.integrations.plivo.send_sms({
src = "+14155552671",
dst = "+14155552672",
text = "Hello from Plivo!"
})
print("Message UUID: " .. tostring(result.message_uuid))
print("API ID: " .. tostring(result.api_id))
list_numbers
List phone numbers on your Plivo account.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of results (default: 20, max: 100) |
offset | integer | no | Offset for pagination (default: 0) |
number_type | string | no | Filter by type: "local", "tollfree", or "national" |
service | string | no | Filter by service: "voice", "sms", or "voice,sms" |
Example
local result = app.integrations.plivo.list_numbers({
limit = 20
})
for _, num in ipairs(result.objects) do
print(num.number .. " (" .. (num.alias or "no alias") .. ")")
end
get_number
Retrieve details of a specific phone number.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
number | string | yes | The phone number to retrieve (e.g., "+14155552671") |
Example
local result = app.integrations.plivo.get_number({
number = "+14155552671"
})
print("Number: " .. result.number)
print("Alias: " .. (result.alias or "none"))
print("Application: " .. (result.app_id or "none"))
list_calls
List calls from Plivo with optional filters and pagination.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of results (default: 20, max: 100) |
offset | integer | no | Offset for pagination (default: 0) |
call_direction | string | no | Filter by direction: "inbound" or "outbound" |
call_state | string | no | Filter by state: "ringing", "in-progress", "ended", etc. |
from_number | string | no | Filter by caller phone number |
to_number | string | no | Filter by callee phone number |
start_time | string | no | Filter calls after this datetime (ISO 8601) |
end_time | string | no | Filter calls before this datetime (ISO 8601) |
Example
local result = app.integrations.plivo.list_calls({
limit = 10,
call_direction = "inbound"
})
for _, call in ipairs(result.objects) do
print(call.call_uuid .. ": " .. call.from .. " -> " .. call.to .. " [" .. call.call_status .. "]")
end
get_call
Retrieve detailed information about a specific call.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
call_id | string | yes | The unique call UUID |
Example
local result = app.integrations.plivo.get_call({
call_id = "abc123-def456-789"
})
print("From: " .. result.from .. " -> To: " .. result.to)
print("Duration: " .. tostring(result.duration) .. "s")
print("Status: " .. result.call_status)
list_applications
List Plivo voice applications on the account.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of results (default: 20, max: 100) |
offset | integer | no | Offset for pagination (default: 0) |
Example
local result = app.integrations.plivo.list_applications({})
for _, app in ipairs(result.objects) do
print(app.app_id .. ": " .. app.app_name)
print(" Answer URL: " .. app.answer_url)
end
Multi-Account Usage
If you have multiple Plivo accounts configured, use account-specific namespaces:
-- Default account (always works)
app.integrations.plivo.function_name({...})
-- Explicit default (portable across setups)
app.integrations.plivo.default.function_name({...})
-- Named accounts
app.integrations.plivo.us.function_name({...})
app.integrations.plivo.uk.function_name({...})
All functions are identical across accounts — only the credentials differ.
Raw agent markdown
# Plivo — Lua API Reference
## list_messages
List SMS messages from Plivo with optional filters and pagination.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of results (default: 20, max: 100) |
| `offset` | integer | no | Offset for pagination (default: 0) |
| `message_direction` | string | no | Filter by direction: `"inbound"` or `"outbound"` |
| `message_state` | string | no | Filter by state: `"queued"`, `"sent"`, `"delivered"`, `"undelivered"`, `"failed"` |
| `src` | string | no | Filter by source phone number (sender) |
| `dst` | string | no | Filter by destination phone number (recipient) |
| `start_time` | string | no | Filter messages after this datetime (ISO 8601) |
| `end_time` | string | no | Filter messages before this datetime (ISO 8601) |
### Example
```lua
local result = app.integrations.plivo.list_messages({
limit = 10,
message_direction = "outbound"
})
for _, msg in ipairs(result.objects) do
print(msg.message_uuid .. ": " .. msg.from .. " -> " .. msg.to .. " [" .. msg.message_state .. "]")
end
```
---
## send_sms
Send an SMS message via Plivo.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `src` | string | yes | Source phone number (must be a Plivo-hosted number, e.g., `"+14155552671"`) |
| `dst` | string | yes | Destination number(s). Single number or multiple separated by `"<"` |
| `text` | string | yes | The SMS message text content |
| `type` | string | no | Message type: `"sms"` (default) or `"mms"` |
| `url` | string | no | Webhook URL for delivery status callbacks |
| `log` | boolean | no | Whether to log the message (default: true) |
### Example
```lua
local result = app.integrations.plivo.send_sms({
src = "+14155552671",
dst = "+14155552672",
text = "Hello from Plivo!"
})
print("Message UUID: " .. tostring(result.message_uuid))
print("API ID: " .. tostring(result.api_id))
```
---
## list_numbers
List phone numbers on your Plivo account.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of results (default: 20, max: 100) |
| `offset` | integer | no | Offset for pagination (default: 0) |
| `number_type` | string | no | Filter by type: `"local"`, `"tollfree"`, or `"national"` |
| `service` | string | no | Filter by service: `"voice"`, `"sms"`, or `"voice,sms"` |
### Example
```lua
local result = app.integrations.plivo.list_numbers({
limit = 20
})
for _, num in ipairs(result.objects) do
print(num.number .. " (" .. (num.alias or "no alias") .. ")")
end
```
---
## get_number
Retrieve details of a specific phone number.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `number` | string | yes | The phone number to retrieve (e.g., `"+14155552671"`) |
### Example
```lua
local result = app.integrations.plivo.get_number({
number = "+14155552671"
})
print("Number: " .. result.number)
print("Alias: " .. (result.alias or "none"))
print("Application: " .. (result.app_id or "none"))
```
---
## list_calls
List calls from Plivo with optional filters and pagination.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of results (default: 20, max: 100) |
| `offset` | integer | no | Offset for pagination (default: 0) |
| `call_direction` | string | no | Filter by direction: `"inbound"` or `"outbound"` |
| `call_state` | string | no | Filter by state: `"ringing"`, `"in-progress"`, `"ended"`, etc. |
| `from_number` | string | no | Filter by caller phone number |
| `to_number` | string | no | Filter by callee phone number |
| `start_time` | string | no | Filter calls after this datetime (ISO 8601) |
| `end_time` | string | no | Filter calls before this datetime (ISO 8601) |
### Example
```lua
local result = app.integrations.plivo.list_calls({
limit = 10,
call_direction = "inbound"
})
for _, call in ipairs(result.objects) do
print(call.call_uuid .. ": " .. call.from .. " -> " .. call.to .. " [" .. call.call_status .. "]")
end
```
---
## get_call
Retrieve detailed information about a specific call.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `call_id` | string | yes | The unique call UUID |
### Example
```lua
local result = app.integrations.plivo.get_call({
call_id = "abc123-def456-789"
})
print("From: " .. result.from .. " -> To: " .. result.to)
print("Duration: " .. tostring(result.duration) .. "s")
print("Status: " .. result.call_status)
```
---
## list_applications
List Plivo voice applications on the account.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of results (default: 20, max: 100) |
| `offset` | integer | no | Offset for pagination (default: 0) |
### Example
```lua
local result = app.integrations.plivo.list_applications({})
for _, app in ipairs(result.objects) do
print(app.app_id .. ": " .. app.app_name)
print(" Answer URL: " .. app.answer_url)
end
```
---
## Multi-Account Usage
If you have multiple Plivo accounts configured, use account-specific namespaces:
```lua
-- Default account (always works)
app.integrations.plivo.function_name({...})
-- Explicit default (portable across setups)
app.integrations.plivo.default.function_name({...})
-- Named accounts
app.integrations.plivo.us.function_name({...})
app.integrations.plivo.uk.function_name({...})
```
All functions are identical across accounts — only the credentials differ. local result = app.integrations.plivo.list_messages({limit = 1, offset = 1, message_direction = "example_message_direction", message_state = "example_message_state", src = "example_src", dst = "example_dst", start_time = "example_start_time", end_time = "example_end_time"})
print(result) Functions
list_messages Read
List SMS messages from Plivo with optional filters. Supports filtering by direction (inbound/outbound), message state, date range, sender, and recipient. Returns paginated message records.
- Lua path
app.integrations.plivo.list_messages- Full name
plivo.plivo_list_messages
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of results to return (default: 20, max: 100). |
offset | integer | no | Offset for pagination (default: 0). |
message_direction | string | no | Filter by direction: "inbound" or "outbound". |
message_state | string | no | Filter by state: "queued", "sent", "delivered", "undelivered", or "failed". |
src | string | no | Filter by source phone number (sender). |
dst | string | no | Filter by destination phone number (recipient). |
start_time | string | no | Filter messages after this datetime (ISO 8601, e.g., "2026-01-01T00:00:00Z"). |
end_time | string | no | Filter messages before this datetime (ISO 8601, e.g., "2026-01-31T23:59:59Z"). |
send_sms Write
Send an SMS message via Plivo. Specify a source phone number (must be a Plivo number), one or more destination numbers, and the message text. Returns the message UUID and details.
- Lua path
app.integrations.plivo.send_sms- Full name
plivo.plivo_send_sms
| Parameter | Type | Required | Description |
|---|---|---|---|
src | string | yes | The source phone number (must be a Plivo-hosted number, e.g., "+14155552671"). |
dst | string | yes | Destination phone number(s). Use a single number or multiple numbers separated by "<" (e.g., "+14155552671" or "+14155552671<+14155552672"). |
text | string | yes | The SMS message text content. |
type | string | no | Message type: "sms" (default) or "mms". |
url | string | no | Webhook URL to receive delivery status callbacks. |
log | boolean | no | Whether to log the message in Plivo (default: true). |
list_numbers Read
List phone numbers on your Plivo account. Supports filtering by number type, service, and pagination.
- Lua path
app.integrations.plivo.list_numbers- Full name
plivo.plivo_list_numbers
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of results to return (default: 20, max: 100). |
offset | integer | no | Offset for pagination (default: 0). |
number_type | string | no | Filter by number type: "local", "tollfree", or "national". |
service | string | no | Filter by service: "voice", "sms", or "voice,sms". |
get_number Read
Retrieve details of a specific phone number on your Plivo account by its number (e.g., "+14155552671"). Returns alias, application, service type, and other number properties.
- Lua path
app.integrations.plivo.get_number- Full name
plivo.plivo_get_number
| Parameter | Type | Required | Description |
|---|---|---|---|
number | string | yes | The phone number to retrieve (e.g., "+14155552671"). |
list_calls Read
List calls from Plivo with optional filters. Supports filtering by direction (inbound/outbound), call state, date range, and phone numbers. Returns paginated call records.
- Lua path
app.integrations.plivo.list_calls- Full name
plivo.plivo_list_calls
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of results to return (default: 20, max: 100). |
offset | integer | no | Offset for pagination (default: 0). |
call_direction | string | no | Filter by direction: "inbound" or "outbound". |
call_state | string | no | Filter by state: "ringing", "in-progress", "ended", etc. |
from_number | string | no | Filter by caller phone number. |
to_number | string | no | Filter by callee phone number. |
start_time | string | no | Filter calls after this datetime (ISO 8601). |
end_time | string | no | Filter calls before this datetime (ISO 8601). |
get_call Read
Retrieve detailed information about a specific Plivo call by its call UUID. Returns call details including duration, direction, status, and recording information.
- Lua path
app.integrations.plivo.get_call- Full name
plivo.plivo_get_call
| Parameter | Type | Required | Description |
|---|---|---|---|
call_id | string | yes | The unique call UUID to retrieve. |
list_applications Read
List Plivo voice applications on the account. Returns application IDs, names, answer/hangup URLs, and associated number counts.
- Lua path
app.integrations.plivo.list_applications- Full name
plivo.plivo_list_applications
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of results to return (default: 20, max: 100). |
offset | integer | no | Offset for pagination (default: 0). |