KosmoKrator

communication

RingCentral Lua API for KosmoKrator Agents

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

6 functions 5 read 1 write Manual OAuth token auth

Lua Namespace

Agents call this integration through app.integrations.ringcentral.*. Use lua_read_doc("integrations.ringcentral") inside KosmoKrator to discover the same reference at runtime.

Agent-Facing Lua Docs

This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.

RingCentral — Lua API Reference

list_messages

List messages from the RingCentral message store. Supports filtering by type, date range, read status, and direction.

Parameters

NameTypeRequiredDescription
messageTypestringnoFilter by type: Sms, Fax, VoiceMail, Pager, or All (default: All)
dateFromstringnoStart date (ISO 8601, e.g., "2025-01-01T00:00:00Z")
dateTostringnoEnd date (ISO 8601, e.g., "2025-01-31T23:59:59Z")
directionstringnoInbound, Outbound, or All
readStatusstringnoRead, Unread, or All
perPageintegernoRecords per page (default: 100, max: 1000)
pageintegernoPage number (default: 1)

Example

local result = app.integrations.ringcentral.list_messages({
  messageType = "Sms",
  dateFrom = "2025-01-01T00:00:00Z",
  perPage = 25
})

for _, msg in ipairs(result.records) do
  print(msg.from.phoneNumber .. " -> " .. msg.to[1].phoneNumber .. ": " .. msg.subject)
end

get_message

Get detailed information about a specific message by its ID.

Parameters

NameTypeRequiredDescription
messageIdstringyesThe unique message record ID

Example

local result = app.integrations.ringcentral.get_message({
  messageId = "1234567890"
})

print("From: " .. result.from.phoneNumber)
print("Subject: " .. result.subject)
print("Status: " .. result.readStatus)

send_sms

Send an SMS message via RingCentral.

Parameters

NameTypeRequiredDescription
fromstringyesSender phone number (must be a RingCentral number, e.g., "+16505551234")
tostringyesDestination phone number (e.g., "+16505559876")
textstringyesMessage body (max 160 chars per segment; longer messages are concatenated)

Example

local result = app.integrations.ringcentral.send_sms({
  from = "+16505551234",
  to = "+16505559876",
  text = "Hello from RingCentral!"
})

print("Message sent! ID: " .. result.id)
print("Status: " .. result.messageStatus)

list_calls

List call log records for the authenticated extension.

Parameters

NameTypeRequiredDescription
dateFromstringnoStart date (ISO 8601)
dateTostringnoEnd date (ISO 8601)
directionstringnoInbound, Outbound, or All
typestringnoVoice, Fax, or All
phoneNumberstringnoFilter by phone number (caller or receiver)
perPageintegernoRecords per page (default: 100, max: 1000)
pageintegernoPage number (default: 1)

Example

local result = app.integrations.ringcentral.list_calls({
  dateFrom = "2025-01-01T00:00:00Z",
  dateTo = "2025-01-31T23:59:59Z",
  direction = "Inbound",
  perPage = 50
})

for _, call in ipairs(result.records) do
  print(call.from.phoneNumber .. " called " .. call.to.phoneNumber .. " (" .. call.duration .. "s)")
end

list_contacts

List contacts from the RingCentral personal address book.

Parameters

NameTypeRequiredDescription
startsWithstringnoFilter by name/company prefix
perPageintegernoRecords per page (default: 100, max: 1000)
pageintegernoPage number (default: 1)

Example

local result = app.integrations.ringcentral.list_contacts({
  startsWith = "John",
  perPage = 25
})

for _, contact in ipairs(result.records) do
  print(contact.firstName .. " " .. contact.lastName)
  if contact.phoneNumbers then
    for _, phone in ipairs(contact.phoneNumbers) do
      print("  " .. phone.phoneType .. ": " .. phone.phoneNumber)
    end
  end
end

get_current_user

Get information about the currently authenticated RingCentral extension. No parameters required.

Example

local result = app.integrations.ringcentral.get_current_user({})

print("Extension: " .. result.name)
print("Status: " .. result.status)
print("Login: " .. result.loginName)

if result.contact then
  print("Email: " .. (result.contact.email or "N/A"))
end

Multi-Account Usage

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

-- Default account (always works)
app.integrations.ringcentral.list_messages({...})

-- Explicit default (portable across setups)
app.integrations.ringcentral.default.list_messages({...})

-- Named accounts
app.integrations.ringcentral.work.list_messages({...})
app.integrations.ringcentral.support.list_messages({...})

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

Raw agent markdown
# RingCentral — Lua API Reference

## list_messages

List messages from the RingCentral message store. Supports filtering by type, date range, read status, and direction.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `messageType` | string | no | Filter by type: `Sms`, `Fax`, `VoiceMail`, `Pager`, or `All` (default: All) |
| `dateFrom` | string | no | Start date (ISO 8601, e.g., `"2025-01-01T00:00:00Z"`) |
| `dateTo` | string | no | End date (ISO 8601, e.g., `"2025-01-31T23:59:59Z"`) |
| `direction` | string | no | `Inbound`, `Outbound`, or `All` |
| `readStatus` | string | no | `Read`, `Unread`, or `All` |
| `perPage` | integer | no | Records per page (default: 100, max: 1000) |
| `page` | integer | no | Page number (default: 1) |

### Example

```lua
local result = app.integrations.ringcentral.list_messages({
  messageType = "Sms",
  dateFrom = "2025-01-01T00:00:00Z",
  perPage = 25
})

for _, msg in ipairs(result.records) do
  print(msg.from.phoneNumber .. " -> " .. msg.to[1].phoneNumber .. ": " .. msg.subject)
end
```

---

## get_message

Get detailed information about a specific message by its ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `messageId` | string | yes | The unique message record ID |

### Example

```lua
local result = app.integrations.ringcentral.get_message({
  messageId = "1234567890"
})

print("From: " .. result.from.phoneNumber)
print("Subject: " .. result.subject)
print("Status: " .. result.readStatus)
```

---

## send_sms

Send an SMS message via RingCentral.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `from` | string | yes | Sender phone number (must be a RingCentral number, e.g., `"+16505551234"`) |
| `to` | string | yes | Destination phone number (e.g., `"+16505559876"`) |
| `text` | string | yes | Message body (max 160 chars per segment; longer messages are concatenated) |

### Example

```lua
local result = app.integrations.ringcentral.send_sms({
  from = "+16505551234",
  to = "+16505559876",
  text = "Hello from RingCentral!"
})

print("Message sent! ID: " .. result.id)
print("Status: " .. result.messageStatus)
```

---

## list_calls

List call log records for the authenticated extension.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `dateFrom` | string | no | Start date (ISO 8601) |
| `dateTo` | string | no | End date (ISO 8601) |
| `direction` | string | no | `Inbound`, `Outbound`, or `All` |
| `type` | string | no | `Voice`, `Fax`, or `All` |
| `phoneNumber` | string | no | Filter by phone number (caller or receiver) |
| `perPage` | integer | no | Records per page (default: 100, max: 1000) |
| `page` | integer | no | Page number (default: 1) |

### Example

```lua
local result = app.integrations.ringcentral.list_calls({
  dateFrom = "2025-01-01T00:00:00Z",
  dateTo = "2025-01-31T23:59:59Z",
  direction = "Inbound",
  perPage = 50
})

for _, call in ipairs(result.records) do
  print(call.from.phoneNumber .. " called " .. call.to.phoneNumber .. " (" .. call.duration .. "s)")
end
```

---

## list_contacts

List contacts from the RingCentral personal address book.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `startsWith` | string | no | Filter by name/company prefix |
| `perPage` | integer | no | Records per page (default: 100, max: 1000) |
| `page` | integer | no | Page number (default: 1) |

### Example

```lua
local result = app.integrations.ringcentral.list_contacts({
  startsWith = "John",
  perPage = 25
})

for _, contact in ipairs(result.records) do
  print(contact.firstName .. " " .. contact.lastName)
  if contact.phoneNumbers then
    for _, phone in ipairs(contact.phoneNumbers) do
      print("  " .. phone.phoneType .. ": " .. phone.phoneNumber)
    end
  end
end
```

---

## get_current_user

Get information about the currently authenticated RingCentral extension. No parameters required.

### Example

```lua
local result = app.integrations.ringcentral.get_current_user({})

print("Extension: " .. result.name)
print("Status: " .. result.status)
print("Login: " .. result.loginName)

if result.contact then
  print("Email: " .. (result.contact.email or "N/A"))
end
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.ringcentral.list_messages({...})

-- Explicit default (portable across setups)
app.integrations.ringcentral.default.list_messages({...})

-- Named accounts
app.integrations.ringcentral.work.list_messages({...})
app.integrations.ringcentral.support.list_messages({...})
```

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

Metadata-Derived Lua Example

local result = app.integrations.ringcentral.ringcentral_list_messages({
  messageType = "example_messageType",
  dateFrom = "example_dateFrom",
  dateTo = "example_dateTo",
  direction = "example_direction",
  readStatus = "example_readStatus",
  perPage = 1,
  page = 1
})
print(result)

Functions

ringcentral_list_messages

List messages from the RingCentral message store. Supports filtering by type (SMS, Fax, VoiceMail), date range, read status, and direction. Returns paginated message records.

Operation
Read read
Full name
ringcentral.ringcentral_list_messages
ParameterTypeRequiredDescription
messageType string no Filter by message type: Sms, Fax, VoiceMail, Pager, or All (default: All).
dateFrom string no Start date for filtering (ISO 8601, e.g., "2025-01-01T00:00:00Z").
dateTo string no End date for filtering (ISO 8601, e.g., "2025-01-31T23:59:59Z").
direction string no Filter by direction: Inbound, Outbound, or All.
readStatus string no Filter by read status: Read, Unread, or All.
perPage integer no Number of records per page (default: 100, max: 1000).
page integer no Page number for pagination (default: 1).

ringcentral_get_message

Get detailed information about a specific message in the RingCentral message store by its ID. Returns the full message record including sender, recipient, subject, and content.

Operation
Read read
Full name
ringcentral.ringcentral_get_message
ParameterTypeRequiredDescription
messageId string yes The unique identifier of the message record.

ringcentral_send_sms

Send an SMS message via RingCentral. The "from" number must be a phone number assigned to the authenticated extension. The "to" number is the destination phone number.

Operation
Write write
Full name
ringcentral.ringcentral_send_sms
ParameterTypeRequiredDescription
from string yes The phone number to send from (must be a RingCentral number assigned to the extension, e.g., "+16505551234").
to string yes The destination phone number (e.g., "+16505559876").
text string yes The SMS message body text. Maximum 160 characters per segment; longer messages are concatenated.

ringcentral_list_calls

List call log records for the authenticated RingCentral extension. Supports filtering by date range, direction, type, and phone number. Returns paginated call records with caller, receiver, duration, and result.

Operation
Read read
Full name
ringcentral.ringcentral_list_calls
ParameterTypeRequiredDescription
dateFrom string no Start date for filtering (ISO 8601, e.g., "2025-01-01T00:00:00Z").
dateTo string no End date for filtering (ISO 8601, e.g., "2025-01-31T23:59:59Z").
direction string no Filter by direction: Inbound, Outbound, or All.
type string no Filter by call type: Voice, Fax, or All.
phoneNumber string no Filter by phone number (caller or receiver).
perPage integer no Number of records per page (default: 100, max: 1000).
page integer no Page number for pagination (default: 1).

ringcentral_list_contacts

List contacts from the RingCentral personal address book. Supports filtering by name prefix and pagination. Returns contact records with names, phone numbers, and email addresses.

Operation
Read read
Full name
ringcentral.ringcentral_list_contacts
ParameterTypeRequiredDescription
startsWith string no Filter contacts whose first name, last name, or company name starts with this string.
perPage integer no Number of records per page (default: 100, max: 1000).
page integer no Page number for pagination (default: 1).

ringcentral_get_current_user

Get information about the currently authenticated RingCentral extension. Returns extension ID, name, status, phone numbers, and account details.

Operation
Read read
Full name
ringcentral.ringcentral_get_current_user
ParameterTypeRequiredDescription
No parameters.