data
Freshservice Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Freshservice KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.freshservice.*.
Use lua_read_doc("integrations.freshservice") 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
Freshservice workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.freshservice.list_tickets({page = 1, per_page = 1, filter = "example_filter"}))' --json kosmo integrations:lua --eval 'print(docs.read("freshservice"))' --json
kosmo integrations:lua --eval 'print(docs.read("freshservice.list_tickets"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local freshservice = app.integrations.freshservice
local result = freshservice.list_tickets({page = 1, per_page = 1, filter = "example_filter"})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.freshservice, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.freshservice.default.* or app.integrations.freshservice.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Freshservice, 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.
Freshservice — Lua API Reference
list_tickets
List support tickets with optional pagination and filtering.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number for pagination (1-based) |
per_page | integer | no | Number of tickets per page (max 100) |
filter | string | no | Predefined filter: "new_and_my_open", "watching", "spam", or "deleted" |
Examples
-- List open tickets (first page)
local result = app.integrations.freshservice.list_tickets({
filter = "new_and_my_open",
per_page = 25
})
for _, ticket in ipairs(result.tickets) do
print(ticket.id .. ": " .. ticket.subject .. " [Priority: " .. ticket.priority .. "]")
end
-- Paginate through tickets
local result = app.integrations.freshservice.list_tickets({
page = 2,
per_page = 50
})
get_ticket
Get full details of a specific ticket.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ticket_id | integer | yes | The ticket display ID |
Example
local result = app.integrations.freshservice.get_ticket({
ticket_id = 42
})
local ticket = result.ticket
print("Subject: " .. ticket.subject)
print("Status: " .. ticket.status)
print("Priority: " .. ticket.priority)
print("Requester: " .. ticket.requester.email)
create_ticket
Create a new support ticket.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
subject | string | yes | The ticket subject / title |
description | string | yes | Ticket description (supports HTML) |
email | string | no | Email address of the requester |
priority | integer | no | Priority: 1=Low, 2=Medium, 3=High, 4=Urgent |
Priority Values
| Value | Level |
|---|---|
| 1 | Low |
| 2 | Medium (default) |
| 3 | High |
| 4 | Urgent |
Example
local result = app.integrations.freshservice.create_ticket({
subject = "VPN connection issue",
description = "<p>Cannot connect to the company VPN since this morning. Getting error code 691.</p>",
email = "john@example.com",
priority = 3
})
print("Created ticket #" .. result.ticket.id)
update_ticket
Update an existing ticket.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ticket_id | integer | yes | The ticket display ID |
subject | string | no | Updated ticket subject |
description | string | no | Updated ticket description |
priority | integer | no | Priority: 1=Low, 2=Medium, 3=High, 4=Urgent |
status | integer | no | Status: 2=Open, 3=Pending, 4=Resolved, 5=Closed |
responder_id | integer | no | ID of the agent to assign |
tags | array | no | Array of tag strings |
Status Values
| Value | Status |
|---|---|
| 2 | Open |
| 3 | Pending |
| 4 | Resolved |
| 5 | Closed |
Examples
-- Assign and prioritize a ticket
local result = app.integrations.freshservice.update_ticket({
ticket_id = 42,
responder_id = 5,
priority = 4
})
-- Resolve a ticket
local result = app.integrations.freshservice.update_ticket({
ticket_id = 42,
status = 4
})
-- Add tags
local result = app.integrations.freshservice.update_ticket({
ticket_id = 42,
tags = {"vpn", "urgent", "networking"}
})
delete_ticket
Delete a ticket permanently.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ticket_id | integer | yes | The ticket display ID to delete |
Example
local result = app.integrations.freshservice.delete_ticket({
ticket_id = 42
})
print(result) -- "Ticket 42 has been deleted."
list_agents
List all agents (support staff) in the Freshservice account.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page | string | no | Page cursor for pagination |
Example
local result = app.integrations.freshservice.list_agents({})
for _, agent in ipairs(result.agents) do
print(agent.id .. ": " .. agent.first_name .. " " .. agent.last_name .. " (" .. agent.email .. ")")
end
get_agent
Get details of a specific agent.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | integer | yes | The agent ID |
Example
local result = app.integrations.freshservice.get_agent({
agent_id = 5
})
local agent = result.agent
print(agent.first_name .. " " .. agent.last_name)
print("Email: " .. agent.email)
print("Available: " .. tostring(agent.available))
list_assets
List IT assets with optional pagination.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number for pagination (1-based) |
Example
local result = app.integrations.freshservice.list_assets({
page = 1
})
for _, asset in ipairs(result.assets) do
print(asset.display_id .. ": " .. asset.name .. " [" .. asset.asset_type .. "]")
end
get_asset
Get details of a specific asset.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
asset_id | integer | yes | The asset display ID |
Example
local result = app.integrations.freshservice.get_asset({
asset_id = 15
})
local asset = result.asset
print("Name: " .. asset.name)
print("Type: " .. asset.asset_type)
print("State: " .. asset.state_name)
get_current_user
Get the profile of the currently authenticated agent. Takes no parameters.
Example
local result = app.integrations.freshservice.get_current_user({})
local agent = result.agent
print("Authenticated as: " .. agent.first_name .. " " .. agent.last_name)
print("Email: " .. agent.email)
Multi-Account Usage
If you have multiple Freshservice accounts configured, use account-specific namespaces:
-- Default account (always works)
app.integrations.freshservice.list_tickets({})
-- Explicit default (portable across setups)
app.integrations.freshservice.default.list_tickets({})
-- Named accounts
app.integrations.freshservice.production.list_tickets({})
app.integrations.freshservice.staging.list_tickets({})
All functions are identical across accounts — only the credentials differ.
Raw agent markdown
# Freshservice — Lua API Reference
## list_tickets
List support tickets with optional pagination and filtering.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number for pagination (1-based) |
| `per_page` | integer | no | Number of tickets per page (max 100) |
| `filter` | string | no | Predefined filter: `"new_and_my_open"`, `"watching"`, `"spam"`, or `"deleted"` |
### Examples
```lua
-- List open tickets (first page)
local result = app.integrations.freshservice.list_tickets({
filter = "new_and_my_open",
per_page = 25
})
for _, ticket in ipairs(result.tickets) do
print(ticket.id .. ": " .. ticket.subject .. " [Priority: " .. ticket.priority .. "]")
end
```
```lua
-- Paginate through tickets
local result = app.integrations.freshservice.list_tickets({
page = 2,
per_page = 50
})
```
---
## get_ticket
Get full details of a specific ticket.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `ticket_id` | integer | yes | The ticket display ID |
### Example
```lua
local result = app.integrations.freshservice.get_ticket({
ticket_id = 42
})
local ticket = result.ticket
print("Subject: " .. ticket.subject)
print("Status: " .. ticket.status)
print("Priority: " .. ticket.priority)
print("Requester: " .. ticket.requester.email)
```
---
## create_ticket
Create a new support ticket.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `subject` | string | yes | The ticket subject / title |
| `description` | string | yes | Ticket description (supports HTML) |
| `email` | string | no | Email address of the requester |
| `priority` | integer | no | Priority: 1=Low, 2=Medium, 3=High, 4=Urgent |
### Priority Values
| Value | Level |
|-------|-------|
| 1 | Low |
| 2 | Medium (default) |
| 3 | High |
| 4 | Urgent |
### Example
```lua
local result = app.integrations.freshservice.create_ticket({
subject = "VPN connection issue",
description = "<p>Cannot connect to the company VPN since this morning. Getting error code 691.</p>",
email = "john@example.com",
priority = 3
})
print("Created ticket #" .. result.ticket.id)
```
---
## update_ticket
Update an existing ticket.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `ticket_id` | integer | yes | The ticket display ID |
| `subject` | string | no | Updated ticket subject |
| `description` | string | no | Updated ticket description |
| `priority` | integer | no | Priority: 1=Low, 2=Medium, 3=High, 4=Urgent |
| `status` | integer | no | Status: 2=Open, 3=Pending, 4=Resolved, 5=Closed |
| `responder_id` | integer | no | ID of the agent to assign |
| `tags` | array | no | Array of tag strings |
### Status Values
| Value | Status |
|-------|--------|
| 2 | Open |
| 3 | Pending |
| 4 | Resolved |
| 5 | Closed |
### Examples
```lua
-- Assign and prioritize a ticket
local result = app.integrations.freshservice.update_ticket({
ticket_id = 42,
responder_id = 5,
priority = 4
})
-- Resolve a ticket
local result = app.integrations.freshservice.update_ticket({
ticket_id = 42,
status = 4
})
-- Add tags
local result = app.integrations.freshservice.update_ticket({
ticket_id = 42,
tags = {"vpn", "urgent", "networking"}
})
```
---
## delete_ticket
Delete a ticket permanently.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `ticket_id` | integer | yes | The ticket display ID to delete |
### Example
```lua
local result = app.integrations.freshservice.delete_ticket({
ticket_id = 42
})
print(result) -- "Ticket 42 has been deleted."
```
---
## list_agents
List all agents (support staff) in the Freshservice account.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | string | no | Page cursor for pagination |
### Example
```lua
local result = app.integrations.freshservice.list_agents({})
for _, agent in ipairs(result.agents) do
print(agent.id .. ": " .. agent.first_name .. " " .. agent.last_name .. " (" .. agent.email .. ")")
end
```
---
## get_agent
Get details of a specific agent.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `agent_id` | integer | yes | The agent ID |
### Example
```lua
local result = app.integrations.freshservice.get_agent({
agent_id = 5
})
local agent = result.agent
print(agent.first_name .. " " .. agent.last_name)
print("Email: " .. agent.email)
print("Available: " .. tostring(agent.available))
```
---
## list_assets
List IT assets with optional pagination.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number for pagination (1-based) |
### Example
```lua
local result = app.integrations.freshservice.list_assets({
page = 1
})
for _, asset in ipairs(result.assets) do
print(asset.display_id .. ": " .. asset.name .. " [" .. asset.asset_type .. "]")
end
```
---
## get_asset
Get details of a specific asset.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `asset_id` | integer | yes | The asset display ID |
### Example
```lua
local result = app.integrations.freshservice.get_asset({
asset_id = 15
})
local asset = result.asset
print("Name: " .. asset.name)
print("Type: " .. asset.asset_type)
print("State: " .. asset.state_name)
```
---
## get_current_user
Get the profile of the currently authenticated agent. Takes no parameters.
### Example
```lua
local result = app.integrations.freshservice.get_current_user({})
local agent = result.agent
print("Authenticated as: " .. agent.first_name .. " " .. agent.last_name)
print("Email: " .. agent.email)
```
---
## Multi-Account Usage
If you have multiple Freshservice accounts configured, use account-specific namespaces:
```lua
-- Default account (always works)
app.integrations.freshservice.list_tickets({})
-- Explicit default (portable across setups)
app.integrations.freshservice.default.list_tickets({})
-- Named accounts
app.integrations.freshservice.production.list_tickets({})
app.integrations.freshservice.staging.list_tickets({})
```
All functions are identical across accounts — only the credentials differ. local result = app.integrations.freshservice.list_tickets({page = 1, per_page = 1, filter = "example_filter"})
print(result) Functions
list_tickets Read
List support tickets from Freshservice. Supports pagination and predefined filters (e.g., new_and_my_open, watching, spam, deleted). Returns ticket summaries including subject, status, priority, and requester.
- Lua path
app.integrations.freshservice.list_tickets- Full name
freshservice.freshservice_list_tickets
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number for pagination (1-based). |
per_page | integer | no | Number of tickets per page (max 100). |
filter | string | no | Predefined filter: "new_and_my_open", "watching", "spam", or "deleted". |
get_ticket Read
Get full details of a specific Freshservice ticket by its ID, including description, status, priority, requester, assigned agent, and custom fields.
- Lua path
app.integrations.freshservice.get_ticket- Full name
freshservice.freshservice_get_ticket
| Parameter | Type | Required | Description |
|---|---|---|---|
ticket_id | integer | yes | The ticket display ID. |
create_ticket Write
Create a new support ticket in Freshservice. Requires a subject and description. Optionally specify the requester email and priority (1=Low, 2=Medium, 3=High, 4=Urgent).
- Lua path
app.integrations.freshservice.create_ticket- Full name
freshservice.freshservice_create_ticket
| Parameter | Type | Required | Description |
|---|---|---|---|
subject | string | yes | The ticket subject / title. |
description | string | yes | The ticket description (supports HTML). |
email | string | no | Email address of the requester. |
priority | integer | no | Priority level: 1=Low, 2=Medium, 3=High, 4=Urgent. |
update_ticket Write
Update an existing Freshservice ticket. You can change status, priority, assigned agent, add tags, or modify any writable field.
- Lua path
app.integrations.freshservice.update_ticket- Full name
freshservice.freshservice_update_ticket
| Parameter | Type | Required | Description |
|---|---|---|---|
ticket_id | integer | yes | The ticket display ID. |
subject | string | no | Updated ticket subject. |
description | string | no | Updated ticket description (supports HTML). |
priority | integer | no | Priority level: 1=Low, 2=Medium, 3=High, 4=Urgent. |
status | integer | no | Status: 2=Open, 3=Pending, 4=Resolved, 5=Closed. |
responder_id | integer | no | ID of the agent to assign the ticket to. |
tags | array | no | Array of tag strings to set on the ticket. |
delete_ticket Write
Delete a support ticket from Freshservice. This action permanently removes the ticket and its conversations.
- Lua path
app.integrations.freshservice.delete_ticket- Full name
freshservice.freshservice_delete_ticket
| Parameter | Type | Required | Description |
|---|---|---|---|
ticket_id | integer | yes | The ticket display ID to delete. |
list_agents Read
List all agents (support staff) in the Freshservice account. Returns agent profiles including name, email, and availability.
- Lua path
app.integrations.freshservice.list_agents- Full name
freshservice.freshservice_list_agents
| Parameter | Type | Required | Description |
|---|---|---|---|
page | string | no | Page cursor for pagination — pass the value from a previous response to get the next page. |
get_agent Read
Get details of a specific Freshservice agent by their ID, including name, email, role, and availability status.
- Lua path
app.integrations.freshservice.get_agent- Full name
freshservice.freshservice_get_agent
| Parameter | Type | Required | Description |
|---|---|---|---|
agent_id | integer | yes | The agent ID. |
list_assets Read
List IT assets from Freshservice. Supports pagination. Returns asset summaries including name, asset type, and state.
- Lua path
app.integrations.freshservice.list_assets- Full name
freshservice.freshservice_list_assets
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number for pagination (1-based). |
get_asset Read
Get full details of a specific Freshservice asset by its display ID, including name, type, state, location, and custom fields.
- Lua path
app.integrations.freshservice.get_asset- Full name
freshservice.freshservice_get_asset
| Parameter | Type | Required | Description |
|---|---|---|---|
asset_id | integer | yes | The asset display ID. |
get_current_user Read
Get the profile of the currently authenticated Freshservice agent. Useful for identifying which agent is performing actions.
- Lua path
app.integrations.freshservice.get_current_user- Full name
freshservice.freshservice_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||