KosmoKrator

communication

Zoho Mail Lua API for KosmoKrator Agents

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

6 functions 5 read 1 write Manual OAuth token auth

Lua Namespace

Agents call this integration through app.integrations.zoho_mail.*. Use lua_read_doc("integrations.zoho-mail") 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.

Zoho Mail — Lua API Reference

get_current_user

Get the current user’s account information. Returns account IDs needed for all other operations.

Parameters

None.

Example

local result = app.integrations["zoho-mail"].get_current_user({})

for _, account in ipairs(result.data.accounts) do
  print(account.accountId .. ": " .. account.primaryEmailAddress)
end

list_messages

List email messages in a folder.

Parameters

NameTypeRequiredDescription
accountIdstringyesZoho Mail account ID
folderIdstringnoFolder ID (default: Inbox)
startintegernoOffset for pagination (default: 0)
limitintegernoMax messages to return (default: 20, max: 100)
searchKeystringnoSearch query to filter messages

Example

local result = app.integrations["zoho-mail"].list_messages({
  accountId = "12345678",
  folderId = "INBOX",
  limit = 10
})

for _, msg in ipairs(result.data.list) do
  print(msg.from .. ": " .. msg.subject)
end

Search messages

local result = app.integrations["zoho-mail"].list_messages({
  accountId = "12345678",
  searchKey = "project update"
})

get_message

Get a single email message by ID with full content.

Parameters

NameTypeRequiredDescription
accountIdstringyesZoho Mail account ID
messageIdstringyesThe message ID to retrieve

Example

local result = app.integrations["zoho-mail"].get_message({
  accountId = "12345678",
  messageId = "9807654321"
})

print("From: " .. result.data.from)
print("Subject: " .. result.data.subject)
print("Content: " .. result.data.content)

send_message

Send a new email message.

Parameters

NameTypeRequiredDescription
accountIdstringyesAccount ID to send from
toAddressstringyesRecipient email(s), comma-separated
subjectstringyesEmail subject line
contentstringyesEmail body (HTML or plain text)
ccAddressstringnoCC recipients, comma-separated
bccAddressstringnoBCC recipients, comma-separated
inReplyTostringnoMessage ID to reply to (for threading)
mailFormatstringno”html” or “plaintext” (default: “html”)

Example

local result = app.integrations["zoho-mail"].send_message({
  accountId = "12345678",
  toAddress = "[email protected]",
  subject = "Meeting Follow-up",
  content = "<p>Thanks for the meeting today!</p>"
})

Reply to a message

local result = app.integrations["zoho-mail"].send_message({
  accountId = "12345678",
  toAddress = "[email protected]",
  subject = "Re: Project Update",
  content = "<p>Got it, thanks for the update.</p>",
  inReplyTo = "9807654321"
})

list_folders

List all email folders in an account.

Parameters

NameTypeRequiredDescription
accountIdstringyesZoho Mail account ID

Example

local result = app.integrations["zoho-mail"].list_folders({
  accountId = "12345678"
})

for _, folder in ipairs(result.data.list) do
  print(folder.folderId .. ": " .. folder.folderName)
end

list_tasks

List tasks from Zoho Mail.

Parameters

NameTypeRequiredDescription
accountIdstringyesZoho Mail account ID
startintegernoOffset for pagination (default: 0)
limitintegernoMax tasks to return (default: 20)

Example

local result = app.integrations["zoho-mail"].list_tasks({
  accountId = "12345678",
  limit = 10
})

for _, task in ipairs(result.data.list) do
  print(task.title .. " - " .. task.status)
end

Multi-Account Usage

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

-- Default account (always works)
app.integrations["zoho-mail"].list_messages({accountId = "12345678"})

-- Explicit default (portable across setups)
app.integrations["zoho-mail"].default.list_messages({accountId = "12345678"})

-- Named accounts
app.integrations["zoho-mail"].work.list_messages({accountId = "12345678"})
app.integrations["zoho-mail"].personal.list_messages({accountId = "12345678"})

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

Raw agent markdown
# Zoho Mail — Lua API Reference

## get_current_user

Get the current user's account information. Returns account IDs needed for all other operations.

### Parameters

None.

### Example

```lua
local result = app.integrations["zoho-mail"].get_current_user({})

for _, account in ipairs(result.data.accounts) do
  print(account.accountId .. ": " .. account.primaryEmailAddress)
end
```

---

## list_messages

List email messages in a folder.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `accountId` | string | yes | Zoho Mail account ID |
| `folderId` | string | no | Folder ID (default: Inbox) |
| `start` | integer | no | Offset for pagination (default: 0) |
| `limit` | integer | no | Max messages to return (default: 20, max: 100) |
| `searchKey` | string | no | Search query to filter messages |

### Example

```lua
local result = app.integrations["zoho-mail"].list_messages({
  accountId = "12345678",
  folderId = "INBOX",
  limit = 10
})

for _, msg in ipairs(result.data.list) do
  print(msg.from .. ": " .. msg.subject)
end
```

### Search messages

```lua
local result = app.integrations["zoho-mail"].list_messages({
  accountId = "12345678",
  searchKey = "project update"
})
```

---

## get_message

Get a single email message by ID with full content.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `accountId` | string | yes | Zoho Mail account ID |
| `messageId` | string | yes | The message ID to retrieve |

### Example

```lua
local result = app.integrations["zoho-mail"].get_message({
  accountId = "12345678",
  messageId = "9807654321"
})

print("From: " .. result.data.from)
print("Subject: " .. result.data.subject)
print("Content: " .. result.data.content)
```

---

## send_message

Send a new email message.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `accountId` | string | yes | Account ID to send from |
| `toAddress` | string | yes | Recipient email(s), comma-separated |
| `subject` | string | yes | Email subject line |
| `content` | string | yes | Email body (HTML or plain text) |
| `ccAddress` | string | no | CC recipients, comma-separated |
| `bccAddress` | string | no | BCC recipients, comma-separated |
| `inReplyTo` | string | no | Message ID to reply to (for threading) |
| `mailFormat` | string | no | "html" or "plaintext" (default: "html") |

### Example

```lua
local result = app.integrations["zoho-mail"].send_message({
  accountId = "12345678",
  toAddress = "[email protected]",
  subject = "Meeting Follow-up",
  content = "<p>Thanks for the meeting today!</p>"
})
```

### Reply to a message

```lua
local result = app.integrations["zoho-mail"].send_message({
  accountId = "12345678",
  toAddress = "[email protected]",
  subject = "Re: Project Update",
  content = "<p>Got it, thanks for the update.</p>",
  inReplyTo = "9807654321"
})
```

---

## list_folders

List all email folders in an account.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `accountId` | string | yes | Zoho Mail account ID |

### Example

```lua
local result = app.integrations["zoho-mail"].list_folders({
  accountId = "12345678"
})

for _, folder in ipairs(result.data.list) do
  print(folder.folderId .. ": " .. folder.folderName)
end
```

---

## list_tasks

List tasks from Zoho Mail.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `accountId` | string | yes | Zoho Mail account ID |
| `start` | integer | no | Offset for pagination (default: 0) |
| `limit` | integer | no | Max tasks to return (default: 20) |

### Example

```lua
local result = app.integrations["zoho-mail"].list_tasks({
  accountId = "12345678",
  limit = 10
})

for _, task in ipairs(result.data.list) do
  print(task.title .. " - " .. task.status)
end
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations["zoho-mail"].list_messages({accountId = "12345678"})

-- Explicit default (portable across setups)
app.integrations["zoho-mail"].default.list_messages({accountId = "12345678"})

-- Named accounts
app.integrations["zoho-mail"].work.list_messages({accountId = "12345678"})
app.integrations["zoho-mail"].personal.list_messages({accountId = "12345678"})
```

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

Metadata-Derived Lua Example

local result = app.integrations.zoho_mail.zohomail_list_messages({
  accountId = "example_accountId",
  folderId = "example_folderId",
  start = 1,
  limit = 1,
  searchKey = "example_searchKey"
})
print(result)

Functions

zohomail_list_messages

List email messages in a Zoho Mail folder. Returns message summaries including sender, subject, and date.

Operation
Read read
Full name
zoho-mail.zohomail_list_messages
ParameterTypeRequiredDescription
accountId string yes The Zoho Mail account ID.
folderId string no Folder ID to list messages from (default: Inbox).
start integer no Offset for pagination (default: 0).
limit integer no Maximum number of messages to return (default: 20, max: 100).
searchKey string no Search query to filter messages.

zohomail_get_message

Get a single email message from Zoho Mail by ID. Returns full message content, headers, and attachment info.

Operation
Read read
Full name
zoho-mail.zohomail_get_message
ParameterTypeRequiredDescription
accountId string yes The Zoho Mail account ID.
messageId string yes The message ID to retrieve.

zohomail_send_message

Send a new email message via Zoho Mail. Supports to, cc, bcc, subject, and HTML or plain text content.

Operation
Write write
Full name
zoho-mail.zohomail_send_message
ParameterTypeRequiredDescription
accountId string yes The Zoho Mail account ID to send from.
toAddress string yes Recipient email address(es), comma-separated.
subject string yes Email subject line.
content string yes Email body content (HTML or plain text).
ccAddress string no CC recipients, comma-separated.
bccAddress string no BCC recipients, comma-separated.
inReplyTo string no Message ID to reply to (for threading).
mailFormat string no Format of the content: "html" or "plaintext" (default: "html").

zohomail_list_folders

List all email folders in a Zoho Mail account, including Inbox, Sent, Drafts, Trash, and custom folders.

Operation
Read read
Full name
zoho-mail.zohomail_list_folders
ParameterTypeRequiredDescription
accountId string yes The Zoho Mail account ID.

zohomail_list_tasks

List tasks from Zoho Mail. Returns task details including title, status, due date, and priority.

Operation
Read read
Full name
zoho-mail.zohomail_list_tasks
ParameterTypeRequiredDescription
accountId string yes The Zoho Mail account ID.
start integer no Offset for pagination (default: 0).
limit integer no Maximum number of tasks to return (default: 20).

zohomail_get_current_user

Get the current user's Zoho Mail account information. Returns account IDs needed for other Zoho Mail operations.

Operation
Read read
Full name
zoho-mail.zohomail_get_current_user
ParameterTypeRequiredDescription
No parameters.