productivity
Zendesk Marketing Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Zendesk Marketing KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.zend.*.
Use lua_read_doc("integrations.zend") 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
Zendesk Marketing workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.zend.list_campaigns({}))' --json kosmo integrations:lua --eval 'print(docs.read("zend"))' --json
kosmo integrations:lua --eval 'print(docs.read("zend.list_campaigns"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local zend = app.integrations.zend
local result = zend.list_campaigns({})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.zend, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.zend.default.* or app.integrations.zend.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Zendesk Marketing, 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.
Zendesk Marketing — Lua API Reference
list_campaigns
List all email marketing campaigns in your Zendesk account.
Parameters
None.
Example
local result = app.integrations["zend"].list_campaigns()
for _, campaign in ipairs(result) do
print(campaign.subject .. " (" .. campaign.status .. ")")
end
get_campaign
Get detailed information about a specific email marketing campaign.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
campaign_id | string | yes | The campaign ID |
Example
local result = app.integrations["zend"].get_campaign({
campaign_id = "abc123"
})
print("Subject: " .. result.subject)
print("Status: " .. result.status)
create_campaign
Create a new email marketing campaign.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
subject | string | yes | The campaign email subject line |
content | string | no | The HTML content of the campaign email |
list_ids | array | no | Array of subscriber list IDs to target |
from_name | string | no | The sender name for the campaign |
from_email | string | no | The sender email address for the campaign |
Example
local result = app.integrations["zend"].create_campaign({
subject = "Monthly Newsletter",
content = "<h1>Hello!</h1>",
list_ids = { "list_abc", "list_def" },
from_name = "Marketing Team",
from_email = "marketing@example.com"
})
print("Created campaign: " .. result.id)
list_lists
List all subscriber lists in your Zendesk account.
Parameters
None.
Example
local result = app.integrations["zend"].list_lists()
for _, list in ipairs(result) do
print(list.name .. " (" .. list.id .. ")")
end
get_list
Get detailed information about a specific subscriber list.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
list_id | string | yes | The subscriber list ID |
Example
local result = app.integrations["zend"].get_list({
list_id = "abc123"
})
print("List: " .. result.name)
print("Subscribers: " .. result.subscriber_count)
list_subscribers
List subscribers on a Zendesk list.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
list_id | string | no | The subscriber list ID to filter by |
page | integer | no | Page number for pagination (default: 1) |
page_size | integer | no | Number of subscribers per page (default: 100) |
Example
local result = app.integrations["zend"].list_subscribers({
list_id = "abc123",
page = 1,
page_size = 50
})
for _, sub in ipairs(result.data) do
print(sub.email .. " - " .. sub.name)
end
get_subscribers
Get detailed information about a specific subscriber.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
subscriber_id | string | yes | The subscriber ID |
Example
local result = app.integrations["zend"].get_subscribers({
subscriber_id = "sub_abc123"
})
print("Email: " .. result.email)
print("Name: " .. result.name)
print("Status: " .. result.status)
get_current_user
Get the authenticated user’s Zendesk account details.
Parameters
None.
Example
local result = app.integrations["zend"].get_current_user()
print("Account: " .. result.email)
print("Name: " .. result.name)
Multi-Account Usage
If you have multiple Zendesk accounts configured, use account-specific namespaces:
-- Default account (always works)
app.integrations["zend"].list_lists({})
-- Explicit default (portable across setups)
app.integrations["zend"].default.list_lists({})
-- Named accounts
app.integrations["zend"].marketing.list_lists({})
app.integrations["zend"].transactional.list_lists({})
All functions are identical across accounts — only the credentials differ.
Raw agent markdown
# Zendesk Marketing — Lua API Reference
## list_campaigns
List all email marketing campaigns in your Zendesk account.
### Parameters
None.
### Example
```lua
local result = app.integrations["zend"].list_campaigns()
for _, campaign in ipairs(result) do
print(campaign.subject .. " (" .. campaign.status .. ")")
end
```
---
## get_campaign
Get detailed information about a specific email marketing campaign.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `campaign_id` | string | yes | The campaign ID |
### Example
```lua
local result = app.integrations["zend"].get_campaign({
campaign_id = "abc123"
})
print("Subject: " .. result.subject)
print("Status: " .. result.status)
```
---
## create_campaign
Create a new email marketing campaign.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `subject` | string | yes | The campaign email subject line |
| `content` | string | no | The HTML content of the campaign email |
| `list_ids` | array | no | Array of subscriber list IDs to target |
| `from_name` | string | no | The sender name for the campaign |
| `from_email` | string | no | The sender email address for the campaign |
### Example
```lua
local result = app.integrations["zend"].create_campaign({
subject = "Monthly Newsletter",
content = "<h1>Hello!</h1>",
list_ids = { "list_abc", "list_def" },
from_name = "Marketing Team",
from_email = "marketing@example.com"
})
print("Created campaign: " .. result.id)
```
---
## list_lists
List all subscriber lists in your Zendesk account.
### Parameters
None.
### Example
```lua
local result = app.integrations["zend"].list_lists()
for _, list in ipairs(result) do
print(list.name .. " (" .. list.id .. ")")
end
```
---
## get_list
Get detailed information about a specific subscriber list.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `list_id` | string | yes | The subscriber list ID |
### Example
```lua
local result = app.integrations["zend"].get_list({
list_id = "abc123"
})
print("List: " .. result.name)
print("Subscribers: " .. result.subscriber_count)
```
---
## list_subscribers
List subscribers on a Zendesk list.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `list_id` | string | no | The subscriber list ID to filter by |
| `page` | integer | no | Page number for pagination (default: 1) |
| `page_size` | integer | no | Number of subscribers per page (default: 100) |
### Example
```lua
local result = app.integrations["zend"].list_subscribers({
list_id = "abc123",
page = 1,
page_size = 50
})
for _, sub in ipairs(result.data) do
print(sub.email .. " - " .. sub.name)
end
```
---
## get_subscribers
Get detailed information about a specific subscriber.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `subscriber_id` | string | yes | The subscriber ID |
### Example
```lua
local result = app.integrations["zend"].get_subscribers({
subscriber_id = "sub_abc123"
})
print("Email: " .. result.email)
print("Name: " .. result.name)
print("Status: " .. result.status)
```
---
## get_current_user
Get the authenticated user's Zendesk account details.
### Parameters
None.
### Example
```lua
local result = app.integrations["zend"].get_current_user()
print("Account: " .. result.email)
print("Name: " .. result.name)
```
---
## Multi-Account Usage
If you have multiple Zendesk accounts configured, use account-specific namespaces:
```lua
-- Default account (always works)
app.integrations["zend"].list_lists({})
-- Explicit default (portable across setups)
app.integrations["zend"].default.list_lists({})
-- Named accounts
app.integrations["zend"].marketing.list_lists({})
app.integrations["zend"].transactional.list_lists({})
```
All functions are identical across accounts — only the credentials differ. local result = app.integrations.zend.list_campaigns({})
print(result) Functions
list_campaigns Read
List all email marketing campaigns in your Zendesk account. Returns campaign IDs, subjects, and status.
- Lua path
app.integrations.zend.list_campaigns- Full name
zend.zend_list_campaigns
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_campaign Read
Get detailed information about a specific email marketing campaign, including subject, content, and delivery stats.
- Lua path
app.integrations.zend.get_campaign- Full name
zend.zend_get_campaign
| Parameter | Type | Required | Description |
|---|---|---|---|
campaign_id | string | yes | The campaign ID. |
create_campaign Write
Create a new email marketing campaign with subject, content, and target lists.
- Lua path
app.integrations.zend.create_campaign- Full name
zend.zend_create_campaign
| Parameter | Type | Required | Description |
|---|---|---|---|
subject | string | yes | The campaign email subject line. |
content | string | no | The HTML content of the campaign email. |
list_ids | array | no | Array of subscriber list IDs to target. |
from_name | string | no | The sender name for the campaign. |
from_email | string | no | The sender email address for the campaign. |
list_subscriber_lists Read
List all subscriber lists in your Zendesk account. Returns list IDs and names.
- Lua path
app.integrations.zend.list_subscriber_lists- Full name
zend.zend_list_lists
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_subscriber_list Read
Get detailed information about a specific subscriber list, including subscriber counts and custom fields.
- Lua path
app.integrations.zend.get_subscriber_list- Full name
zend.zend_get_list
| Parameter | Type | Required | Description |
|---|---|---|---|
list_id | string | yes | The subscriber list ID. |
list_subscribers Read
List subscribers on a Zendesk list. Returns email addresses, names, and subscription dates.
- Lua path
app.integrations.zend.list_subscribers- Full name
zend.zend_list_subscribers
| Parameter | Type | Required | Description |
|---|---|---|---|
list_id | string | no | The subscriber list ID to filter by. |
page | integer | no | Page number for pagination (default: 1). |
page_size | integer | no | Number of subscribers per page (default: 100). |
get_subscriber Read
Get detailed information about a specific subscriber, including email, name, and subscription status.
- Lua path
app.integrations.zend.get_subscriber- Full name
zend.zend_get_subscribers
| Parameter | Type | Required | Description |
|---|---|---|---|
subscriber_id | string | yes | The subscriber ID. |
get_current_user Read
Get the authenticated user's Zendesk account details, including name and email.
- Lua path
app.integrations.zend.get_current_user- Full name
zend.zend_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||