KosmoKrator

productivity

Gotify Lua API for KosmoKrator Agents

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

Lua Namespace

Agents call this integration through app.integrations.gotify.*. Use lua_read_doc("integrations.gotify") 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 Gotify workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.gotify.create_application({name = "example_name", description = "example_description"}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("gotify"))' --json
kosmo integrations:lua --eval 'print(docs.read("gotify.create_application"))' --json

Workflow file

Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.

workflow.lua
local gotify = app.integrations.gotify
local result = gotify.create_application({name = "example_name", description = "example_description"})

dump(result)
Run the workflow
kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json
Namespace note. integrations:lua exposes app.integrations.gotify, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.gotify.default.* or app.integrations.gotify.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Gotify, use the narrower mcp:lua command.

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.

Gotify Lua API Reference

Namespace: app.integrations.gotify

Gotify has two token types:

  • app_token: application token; can only send messages with create_message.
  • client_token: client token; required for listing/deleting messages and managing applications, clients, or current user data.

The public get_health and get_version tools only need the Gotify server URL.

Messages

create_message

Send a notification through Gotify. Requires app_token.

Required: message

Optional: title, priority, extras

local sent = app.integrations.gotify.create_message({
  title = "Deploy Complete",
  message = "Version 2.1.0 deployed successfully.",
  priority = 5,
})

print(sent.id)

Use extras for Gotify client display hints such as markdown rendering:

app.integrations.gotify.create_message({
  title = "Weekly Report",
  message = "## Summary\n\n- Pageviews: 12450",
  extras = {
    ["client::display"] = {
      contentType = "text/markdown",
    },
  },
})

list_messages

List messages visible to the configured client_token.

Optional: limit (default 100, max 200), since

Gotify’s since parameter returns messages with an ID less than the supplied value.

local result = app.integrations.gotify.list_messages({ limit = 25 })

for _, msg in ipairs(result.messages or {}) do
  print("[" .. msg.id .. "] " .. msg.title)
end

delete_message

Delete one message by ID. Requires client_token.

app.integrations.gotify.delete_message({ id = 42 })

delete_messages

Delete all messages visible to the configured client_token.

app.integrations.gotify.delete_messages()

list_application_messages

List messages sent by one application. Requires client_token.

Required: application_id

Optional: limit, since

local result = app.integrations.gotify.list_application_messages({
  application_id = 7,
  limit = 50,
})

delete_application_messages

Delete all messages sent by one application. Requires client_token.

app.integrations.gotify.delete_application_messages({
  application_id = 7,
})

Applications

list_applications

List Gotify applications visible to the configured client_token.

local apps = app.integrations.gotify.list_applications()

create_application

Create a Gotify application and receive its generated application token. Requires client_token.

Required: name

Optional: description

local app = app.integrations.gotify.create_application({
  name = "CI",
  description = "Build notifications",
})

print(app.token)

update_application

Update an application name and description. Requires client_token.

app.integrations.gotify.update_application({
  id = 7,
  name = "CI Alerts",
  description = "Build and deploy notifications",
})

delete_application

Delete an application. Requires client_token; Gotify servers may also require elevated authentication for this endpoint.

app.integrations.gotify.delete_application({ id = 7 })

Clients

list_clients

List Gotify clients visible to the configured client_token.

local clients = app.integrations.gotify.list_clients()

create_client

Create a Gotify client and receive its generated client token. Requires client_token.

local client = app.integrations.gotify.create_client({
  name = "Automation",
})

print(client.token)

update_client

Update a client name. Requires client_token.

app.integrations.gotify.update_client({
  id = 12,
  name = "Automation Worker",
})

delete_client

Delete a client. Requires client_token; Gotify servers may also require elevated authentication for this endpoint.

app.integrations.gotify.delete_client({ id = 12 })

Server And User

get_health

Check Gotify server health.

local health = app.integrations.gotify.get_health()
print(health.health)

get_version

Get Gotify server version metadata.

local version = app.integrations.gotify.get_version()
print(version.version)

get_current_user

Get the current user for the configured client_token.

local user = app.integrations.gotify.get_current_user()
print(user.name)

Scope Notes

This package covers Gotify’s core server-side REST API for messages, applications, clients, health, version, and current-user lookup. Browser OIDC flows, password changes, admin user management, plugin configuration, image upload, and websocket streaming are intentionally not exposed as ordinary request/response tools because they require browser sessions, elevated authentication, multipart file handling, plugin-specific schemas, or long-lived streaming behavior.

Multi-Account Usage

app.integrations.gotify.create_message({ message = "Default account" })
app.integrations.gotify.default.create_message({ message = "Explicit default" })
app.integrations.gotify.ops.create_message({ message = "Named account" })

All account namespaces expose the same functions. Only credentials and server URL change.

Raw agent markdown
# Gotify Lua API Reference

Namespace: `app.integrations.gotify`

Gotify has two token types:

- `app_token`: application token; can only send messages with `create_message`.
- `client_token`: client token; required for listing/deleting messages and managing applications, clients, or current user data.

The public `get_health` and `get_version` tools only need the Gotify server URL.

## Messages

### create_message

Send a notification through Gotify. Requires `app_token`.

Required: `message`

Optional: `title`, `priority`, `extras`

```lua
local sent = app.integrations.gotify.create_message({
  title = "Deploy Complete",
  message = "Version 2.1.0 deployed successfully.",
  priority = 5,
})

print(sent.id)
```

Use `extras` for Gotify client display hints such as markdown rendering:

```lua
app.integrations.gotify.create_message({
  title = "Weekly Report",
  message = "## Summary\n\n- Pageviews: 12450",
  extras = {
    ["client::display"] = {
      contentType = "text/markdown",
    },
  },
})
```

### list_messages

List messages visible to the configured `client_token`.

Optional: `limit` (default 100, max 200), `since`

Gotify's `since` parameter returns messages with an ID less than the supplied value.

```lua
local result = app.integrations.gotify.list_messages({ limit = 25 })

for _, msg in ipairs(result.messages or {}) do
  print("[" .. msg.id .. "] " .. msg.title)
end
```

### delete_message

Delete one message by ID. Requires `client_token`.

```lua
app.integrations.gotify.delete_message({ id = 42 })
```

### delete_messages

Delete all messages visible to the configured `client_token`.

```lua
app.integrations.gotify.delete_messages()
```

### list_application_messages

List messages sent by one application. Requires `client_token`.

Required: `application_id`

Optional: `limit`, `since`

```lua
local result = app.integrations.gotify.list_application_messages({
  application_id = 7,
  limit = 50,
})
```

### delete_application_messages

Delete all messages sent by one application. Requires `client_token`.

```lua
app.integrations.gotify.delete_application_messages({
  application_id = 7,
})
```

## Applications

### list_applications

List Gotify applications visible to the configured `client_token`.

```lua
local apps = app.integrations.gotify.list_applications()
```

### create_application

Create a Gotify application and receive its generated application token. Requires `client_token`.

Required: `name`

Optional: `description`

```lua
local app = app.integrations.gotify.create_application({
  name = "CI",
  description = "Build notifications",
})

print(app.token)
```

### update_application

Update an application name and description. Requires `client_token`.

```lua
app.integrations.gotify.update_application({
  id = 7,
  name = "CI Alerts",
  description = "Build and deploy notifications",
})
```

### delete_application

Delete an application. Requires `client_token`; Gotify servers may also require elevated authentication for this endpoint.

```lua
app.integrations.gotify.delete_application({ id = 7 })
```

## Clients

### list_clients

List Gotify clients visible to the configured `client_token`.

```lua
local clients = app.integrations.gotify.list_clients()
```

### create_client

Create a Gotify client and receive its generated client token. Requires `client_token`.

```lua
local client = app.integrations.gotify.create_client({
  name = "Automation",
})

print(client.token)
```

### update_client

Update a client name. Requires `client_token`.

```lua
app.integrations.gotify.update_client({
  id = 12,
  name = "Automation Worker",
})
```

### delete_client

Delete a client. Requires `client_token`; Gotify servers may also require elevated authentication for this endpoint.

```lua
app.integrations.gotify.delete_client({ id = 12 })
```

## Server And User

### get_health

Check Gotify server health.

```lua
local health = app.integrations.gotify.get_health()
print(health.health)
```

### get_version

Get Gotify server version metadata.

```lua
local version = app.integrations.gotify.get_version()
print(version.version)
```

### get_current_user

Get the current user for the configured `client_token`.

```lua
local user = app.integrations.gotify.get_current_user()
print(user.name)
```

## Scope Notes

This package covers Gotify's core server-side REST API for messages, applications, clients, health, version, and current-user lookup. Browser OIDC flows, password changes, admin user management, plugin configuration, image upload, and websocket streaming are intentionally not exposed as ordinary request/response tools because they require browser sessions, elevated authentication, multipart file handling, plugin-specific schemas, or long-lived streaming behavior.

## Multi-Account Usage

```lua
app.integrations.gotify.create_message({ message = "Default account" })
app.integrations.gotify.default.create_message({ message = "Explicit default" })
app.integrations.gotify.ops.create_message({ message = "Named account" })
```

All account namespaces expose the same functions. Only credentials and server URL change.
Metadata-derived Lua example
local result = app.integrations.gotify.create_application({name = "example_name", description = "example_description"})
print(result)

Functions

create_application Write

Create a Gotify application and return its generated application token. Requires a client token.

Lua path
app.integrations.gotify.create_application
Full name
gotify.gotify_create_application
ParameterTypeRequiredDescription
name string yes Application name.
description string no Application description.
create_client Write

Create a Gotify client and return its generated client token. Requires a client token.

Lua path
app.integrations.gotify.create_client
Full name
gotify.gotify_create_client
ParameterTypeRequiredDescription
name string yes Client name.
create_message Write

Send a notification message via Gotify. The message body supports Markdown formatting. Use priority 0–4 for low, 5 for normal, and 6–10 for high priority.

Lua path
app.integrations.gotify.create_message
Full name
gotify.gotify_create_message
ParameterTypeRequiredDescription
title string yes Message title.
message string yes Message body (supports Markdown).
priority integer no Message priority from 0 (lowest) to 10 (highest). Default is 5 (normal).
extras object no Optional Gotify message extras, such as client::display contentType.
delete_application Write

Delete a Gotify application. Gotify requires elevated authentication for this endpoint.

Lua path
app.integrations.gotify.delete_application
Full name
gotify.gotify_delete_application
ParameterTypeRequiredDescription
id integer yes Application ID.
delete_application_messages Write

Delete all messages sent by a specific Gotify application. Requires a client token.

Lua path
app.integrations.gotify.delete_application_messages
Full name
gotify.gotify_delete_application_messages
ParameterTypeRequiredDescription
application_id integer yes Gotify application ID.
delete_client Write

Delete a Gotify client. Gotify requires elevated authentication for this endpoint.

Lua path
app.integrations.gotify.delete_client
Full name
gotify.gotify_delete_client
ParameterTypeRequiredDescription
id integer yes Client ID.
delete_message Write

Delete a message from Gotify by its ID. Use the list_messages tool to find message IDs.

Lua path
app.integrations.gotify.delete_message
Full name
gotify.gotify_delete_message
ParameterTypeRequiredDescription
id integer yes The ID of the message to delete.
delete_messages Write

Delete all Gotify messages visible to the configured client token.

Lua path
app.integrations.gotify.delete_messages
Full name
gotify.gotify_delete_messages
ParameterTypeRequiredDescription
No parameters.
get_current_user Read

Get information about the currently authenticated Gotify user, including username and admin status.

Lua path
app.integrations.gotify.get_current_user
Full name
gotify.gotify_get_current_user
ParameterTypeRequiredDescription
No parameters.
get_health Read

Check the health status of the Gotify server. Returns server health information including database status.

Lua path
app.integrations.gotify.get_health
Full name
gotify.gotify_get_health
ParameterTypeRequiredDescription
No parameters.
get_version Read

Get Gotify server version information from the public /version endpoint.

Lua path
app.integrations.gotify.get_version
Full name
gotify.gotify_get_version
ParameterTypeRequiredDescription
No parameters.
list_application_messages Read

List messages sent by a specific Gotify application. Requires a client token.

Lua path
app.integrations.gotify.list_application_messages
Full name
gotify.gotify_list_application_messages
ParameterTypeRequiredDescription
application_id integer yes Gotify application ID.
limit integer no Maximum number of messages to return (default: 100, max: 200).
since integer no Return messages with ID less than this value.
list_applications Read

List Gotify applications visible to the configured client token.

Lua path
app.integrations.gotify.list_applications
Full name
gotify.gotify_list_applications
ParameterTypeRequiredDescription
No parameters.
list_clients Read

List Gotify clients visible to the configured client token.

Lua path
app.integrations.gotify.list_clients
Full name
gotify.gotify_list_clients
ParameterTypeRequiredDescription
No parameters.
list_messages Read

List messages from the Gotify application. Returns the most recent messages, with optional pagination using "since" to fetch messages newer than a given ID.

Lua path
app.integrations.gotify.list_messages
Full name
gotify.gotify_list_messages
ParameterTypeRequiredDescription
limit integer no Maximum number of messages to return (default: 100, max: 200).
since integer no Return messages with ID greater than this value. Useful for polling new messages.
update_application Write

Update a Gotify application name and description. Requires a client token.

Lua path
app.integrations.gotify.update_application
Full name
gotify.gotify_update_application
ParameterTypeRequiredDescription
id integer yes Application ID.
name string yes Application name.
description string no Application description.
update_client Write

Update a Gotify client name. Requires a client token.

Lua path
app.integrations.gotify.update_client
Full name
gotify.gotify_update_client
ParameterTypeRequiredDescription
id integer yes Client ID.
name string yes Client name.