data
Vonage Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Vonage KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.vonage.*.
Use lua_read_doc("integrations.vonage") 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
Vonage workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.vonage.get_account_balance({}))' --json kosmo integrations:lua --eval 'print(docs.read("vonage"))' --json
kosmo integrations:lua --eval 'print(docs.read("vonage.get_account_balance"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local vonage = app.integrations.vonage
local result = vonage.get_account_balance({})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.vonage, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.vonage.default.* or app.integrations.vonage.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Vonage, 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.
Vonage — Lua API Reference
send_sms
Send an SMS message via Vonage. Provide sender, recipient, and message text. The recipient number must be in E.164 format.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
from | string | yes | Sender ID or phone number (e.g. "VonageAPI" or a purchased number). |
to | string | yes | Recipient phone number in E.164 format (e.g. "14155552671"). |
text | string | yes | The SMS message body text. |
type | string | no | Message type: "text" (default), "unicode", or "binary". |
Examples
local result = app.integrations.vonage.send_sms({
from = "VonageAPI",
to = "14155552671",
text = "Hello from Vonage!"
})
print("Sent " .. result.message_count .. " message(s)")
for _, msg in ipairs(result.messages) do
print(" To: " .. msg.to .. " — ID: " .. msg.message_id)
end
list_messages
Search and list SMS messages from your Vonage account. Requires a date in YYYY-MM-DD format.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
date | string | yes | Date to search messages for, in YYYY-MM-DD format (e.g. "2025-01-15"). |
to | string | no | Recipient phone number to filter by (E.164 format). |
Examples
local result = app.integrations.vonage.list_messages({
date = "2025-06-15"
})
for _, msg in ipairs(result.messages or {}) do
print(msg.message_id .. ": " .. (msg.status or "unknown"))
end
-- Filter by recipient
local result = app.integrations.vonage.list_messages({
date = "2025-06-15",
to = "14155552671"
})
list_sms
Search and list SMS messages from your Vonage account. Alias for list_messages with the same parameters.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
date | string | yes | Date to search in ISO format (YYYY-MM-DD, e.g. "2025-01-15"). |
to | string | no | Filter by recipient phone number in E.164 format. |
Examples
local result = app.integrations.vonage.list_sms({
date = "2025-06-01"
})
list_numbers
List phone numbers purchased on your Vonage account. Optionally filter by pattern.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pattern | string | no | A pattern to search for in the phone numbers. |
search_pattern | integer | no | How to match the pattern: 0 = starts with, 1 = contains, 2 = ends with. |
size | integer | no | Number of results per page (default: 10). |
index | integer | no | Page index for pagination (1-based). |
Examples
local result = app.integrations.vonage.list_numbers()
for _, num in ipairs(result.numbers or {}) do
print(num.msisdn .. " (" .. num.country .. ")")
end
-- Find US numbers containing "555"
local result = app.integrations.vonage.list_numbers({
pattern = "555",
search_pattern = 1
})
get_account_balance
Get the current balance of your Vonage account.
Parameters
None.
Examples
local result = app.integrations.vonage.get_account_balance()
print("Balance: " .. result.value .. " " .. (result.currency or ""))
print("Auto-reload: " .. tostring(result.auto_reload))
list_applications
List Vonage applications configured on your account.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page_size | integer | no | Number of applications per page (default: 10). |
page | integer | no | Page number for pagination (1-based). |
Examples
local result = app.integrations.vonage.list_applications()
for _, app in ipairs(result._embedded.applications or {}) do
print(app.name .. " — " .. app.id)
end
verify_request
Send a verification code to a phone number via Vonage Verify. Returns a request_id used to check the code later.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
number | string | yes | Phone number to verify in E.164 format (e.g. "14155552671"). |
brand | string | yes | The name shown in the verification message (e.g. "MyApp"). |
Examples
local result = app.integrations.vonage.verify_request({
number = "14155552671",
brand = "MyApp"
})
print("Request ID: " .. result.request_id)
-- Store request_id for use with verify_check
verify_check
Check a verification code against a Vonage Verify request.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
request_id | string | yes | The request_id returned by the verify request. |
code | string | yes | The verification code entered by the user. |
Examples
local result = app.integrations.vonage.verify_check({
request_id = "abc123-request-id",
code = "4821"
})
if result.status == "0" then
print("Verification successful!")
else
print("Verification failed")
end
Multi-Account Usage
If you have multiple vonage accounts configured, use account-specific namespaces:
-- Default account (always works)
app.integrations.vonage.function_name({...})
-- Explicit default (portable across setups)
app.integrations.vonage.default.function_name({...})
-- Named accounts
app.integrations.vonage.us.function_name({...})
app.integrations.vonage.eu.function_name({...})
All functions are identical across accounts — only the credentials differ.
Raw agent markdown
# Vonage — Lua API Reference
## send_sms
Send an SMS message via Vonage. Provide sender, recipient, and message text. The recipient number must be in E.164 format.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `from` | string | yes | Sender ID or phone number (e.g. `"VonageAPI"` or a purchased number). |
| `to` | string | yes | Recipient phone number in E.164 format (e.g. `"14155552671"`). |
| `text` | string | yes | The SMS message body text. |
| `type` | string | no | Message type: `"text"` (default), `"unicode"`, or `"binary"`. |
### Examples
```lua
local result = app.integrations.vonage.send_sms({
from = "VonageAPI",
to = "14155552671",
text = "Hello from Vonage!"
})
print("Sent " .. result.message_count .. " message(s)")
for _, msg in ipairs(result.messages) do
print(" To: " .. msg.to .. " — ID: " .. msg.message_id)
end
```
---
## list_messages
Search and list SMS messages from your Vonage account. Requires a date in YYYY-MM-DD format.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `date` | string | yes | Date to search messages for, in YYYY-MM-DD format (e.g. `"2025-01-15"`). |
| `to` | string | no | Recipient phone number to filter by (E.164 format). |
### Examples
```lua
local result = app.integrations.vonage.list_messages({
date = "2025-06-15"
})
for _, msg in ipairs(result.messages or {}) do
print(msg.message_id .. ": " .. (msg.status or "unknown"))
end
```
```lua
-- Filter by recipient
local result = app.integrations.vonage.list_messages({
date = "2025-06-15",
to = "14155552671"
})
```
---
## list_sms
Search and list SMS messages from your Vonage account. Alias for list_messages with the same parameters.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `date` | string | yes | Date to search in ISO format (YYYY-MM-DD, e.g. `"2025-01-15"`). |
| `to` | string | no | Filter by recipient phone number in E.164 format. |
### Examples
```lua
local result = app.integrations.vonage.list_sms({
date = "2025-06-01"
})
```
---
## list_numbers
List phone numbers purchased on your Vonage account. Optionally filter by pattern.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `pattern` | string | no | A pattern to search for in the phone numbers. |
| `search_pattern` | integer | no | How to match the pattern: `0` = starts with, `1` = contains, `2` = ends with. |
| `size` | integer | no | Number of results per page (default: 10). |
| `index` | integer | no | Page index for pagination (1-based). |
### Examples
```lua
local result = app.integrations.vonage.list_numbers()
for _, num in ipairs(result.numbers or {}) do
print(num.msisdn .. " (" .. num.country .. ")")
end
```
```lua
-- Find US numbers containing "555"
local result = app.integrations.vonage.list_numbers({
pattern = "555",
search_pattern = 1
})
```
---
## get_account_balance
Get the current balance of your Vonage account.
### Parameters
None.
### Examples
```lua
local result = app.integrations.vonage.get_account_balance()
print("Balance: " .. result.value .. " " .. (result.currency or ""))
print("Auto-reload: " .. tostring(result.auto_reload))
```
---
## list_applications
List Vonage applications configured on your account.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_size` | integer | no | Number of applications per page (default: 10). |
| `page` | integer | no | Page number for pagination (1-based). |
### Examples
```lua
local result = app.integrations.vonage.list_applications()
for _, app in ipairs(result._embedded.applications or {}) do
print(app.name .. " — " .. app.id)
end
```
---
## verify_request
Send a verification code to a phone number via Vonage Verify. Returns a request_id used to check the code later.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `number` | string | yes | Phone number to verify in E.164 format (e.g. `"14155552671"`). |
| `brand` | string | yes | The name shown in the verification message (e.g. `"MyApp"`). |
### Examples
```lua
local result = app.integrations.vonage.verify_request({
number = "14155552671",
brand = "MyApp"
})
print("Request ID: " .. result.request_id)
-- Store request_id for use with verify_check
```
---
## verify_check
Check a verification code against a Vonage Verify request.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `request_id` | string | yes | The request_id returned by the verify request. |
| `code` | string | yes | The verification code entered by the user. |
### Examples
```lua
local result = app.integrations.vonage.verify_check({
request_id = "abc123-request-id",
code = "4821"
})
if result.status == "0" then
print("Verification successful!")
else
print("Verification failed")
end
```
---
## Multi-Account Usage
If you have multiple vonage accounts configured, use account-specific namespaces:
```lua
-- Default account (always works)
app.integrations.vonage.function_name({...})
-- Explicit default (portable across setups)
app.integrations.vonage.default.function_name({...})
-- Named accounts
app.integrations.vonage.us.function_name({...})
app.integrations.vonage.eu.function_name({...})
```
All functions are identical across accounts — only the credentials differ. local result = app.integrations.vonage.get_account_balance({})
print(result) Functions
get_account_balance Read
Get the current balance of your Vonage account.
- Lua path
app.integrations.vonage.get_account_balance- Full name
vonage.vonage_get_account_balance
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_applications Read
List Vonage applications configured on your account. Applications define how Vonage handles calls and messages.
- Lua path
app.integrations.vonage.list_applications- Full name
vonage.vonage_list_applications
| Parameter | Type | Required | Description |
|---|---|---|---|
page_size | integer | no | Number of applications per page (default: 10). |
page | integer | no | Page number for pagination (1-based). |
list_messages Read
Search and list SMS messages from your Vonage account. Requires a date in YYYY-MM-DD format. Optionally filter by recipient number.
- Lua path
app.integrations.vonage.list_messages- Full name
vonage.vonage_list_messages
| Parameter | Type | Required | Description |
|---|---|---|---|
date | string | yes | Date to search messages for, in YYYY-MM-DD format (e.g., "2025-01-15"). |
to | string | no | Recipient phone number to filter by (E.164 format). |
list_numbers Read
List phone numbers purchased on your Vonage account. Optionally filter by pattern.
- Lua path
app.integrations.vonage.list_numbers- Full name
vonage.vonage_list_numbers
| Parameter | Type | Required | Description |
|---|---|---|---|
pattern | string | no | A pattern to search for in the phone numbers. |
search_pattern | integer | no | How to match the pattern: 0 = starts with, 1 = contains, 2 = ends with. |
size | integer | no | Number of results per page (default: 10). |
index | integer | no | Page index for pagination (1-based). |
send_sms Write
Send an SMS message via Vonage. Provide sender, recipient, and message text. The recipient number must be in E.164 format (e.g., 14155552671).
- Lua path
app.integrations.vonage.send_sms- Full name
vonage.vonage_send_sms
| Parameter | Type | Required | Description |
|---|---|---|---|
from | string | yes | Sender ID or phone number (e.g., "VonageAPI" or a purchased number). |
to | string | yes | Recipient phone number in E.164 format (e.g., "14155552671"). |
text | string | yes | The SMS message body text. |
type | string | no | Message type: "text" (default), "unicode", or "binary". |
verify_check Read
Check a verification code against a Vonage Verify request. Provide the request_id from the verification and the code entered by the user.
- Lua path
app.integrations.vonage.verify_check- Full name
vonage.vonage_verify_check
| Parameter | Type | Required | Description |
|---|---|---|---|
request_id | string | yes | The request_id returned by the verify request. |
code | string | yes | The verification code entered by the user. |
verify_request Read
Send a verification code to a phone number via Vonage Verify. Returns a request_id used to check the code later.
- Lua path
app.integrations.vonage.verify_request- Full name
vonage.vonage_verify_request
| Parameter | Type | Required | Description |
|---|---|---|---|
number | string | yes | Phone number to verify in E.164 format (e.g., "14155552671"). |
brand | string | yes | The name of the company or app shown in the verification message (e.g., "MyApp"). |