KosmoKrator

productivity

Patreon Lua API for KosmoKrator Agents

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

Lua Namespace

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

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.patreon.list_campaigns({}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("patreon"))' --json
kosmo integrations:lua --eval 'print(docs.read("patreon.list_campaigns"))' --json

Workflow file

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

workflow.lua
local patreon = app.integrations.patreon
local result = patreon.list_campaigns({})

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.patreon, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.patreon.default.* or app.integrations.patreon.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Patreon, 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.

Patreon — Lua API Reference

list_campaigns

List all campaigns for the authenticated Patreon creator.

Parameters

None.

Examples

local result = app.integrations.patreon.list_campaigns()

for _, campaign in ipairs(result.campaigns) do
  print(campaign.attributes.creation_name .. " — Patrons: " .. campaign.attributes.patron_count)
end

get_campaign

Get detailed information about a single Patreon campaign.

Parameters

NameTypeRequiredDescription
campaign_idstringyesThe ID of the campaign to retrieve

Example

local result = app.integrations.patreon.get_campaign({
  campaign_id = "123456"
})

print(result.attributes.creation_name)
print(result.attributes.summary)
print(result.attributes.patron_count)

list_members

List members (patrons) for a Patreon campaign.

Parameters

NameTypeRequiredDescription
campaign_idstringyesThe ID of the campaign to list members for

Examples

All members

local result = app.integrations.patreon.list_members({
  campaign_id = "123456"
})

for _, member in ipairs(result.members) do
  print(member.attributes.full_name .. " — " .. member.attributes.patron_status)
end

get_member

Get details for a single Patreon member.

Parameters

NameTypeRequiredDescription
member_idstringyesThe ID of the member to retrieve

Example

local result = app.integrations.patreon.get_member({
  member_id = "789012"
})

print(result.attributes.full_name)
print(result.attributes.email)
print(result.attributes.patron_status)

list_posts

List posts for a Patreon campaign.

Parameters

NameTypeRequiredDescription
campaign_idstringyesThe ID of the campaign to list posts for

Examples

local result = app.integrations.patreon.list_posts({
  campaign_id = "123456"
})

for _, post in ipairs(result.posts) do
  print(post.attributes.title .. " — " .. post.attributes.published_at)
end

get_post

Get details for a single Patreon post.

Parameters

NameTypeRequiredDescription
post_idstringyesThe ID of the post to retrieve

Example

local result = app.integrations.patreon.get_post({
  post_id = "345678"
})

print(result.attributes.title)
print(result.attributes.content)
print(result.attributes.published_at)

get_current_user

Get the profile of the currently authenticated Patreon user.

Parameters

None.

Example

local result = app.integrations.patreon.get_current_user()

print("Connected as: " .. result.attributes.full_name)
print("Email: " .. result.attributes.email)

Multi-Account Usage

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

-- Default account (always works)
app.integrations.patreon.function_name({...})

-- Explicit default (portable across setups)
app.integrations.patreon.default.function_name({...})

-- Named accounts
app.integrations.patreon.main_creator.function_name({...})
app.integrations.patreon.side_project.function_name({...})

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

Raw agent markdown
# Patreon — Lua API Reference

## list_campaigns

List all campaigns for the authenticated Patreon creator.

### Parameters

None.

### Examples

```lua
local result = app.integrations.patreon.list_campaigns()

for _, campaign in ipairs(result.campaigns) do
  print(campaign.attributes.creation_name .. " — Patrons: " .. campaign.attributes.patron_count)
end
```

---

## get_campaign

Get detailed information about a single Patreon campaign.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `campaign_id` | string | yes | The ID of the campaign to retrieve |

### Example

```lua
local result = app.integrations.patreon.get_campaign({
  campaign_id = "123456"
})

print(result.attributes.creation_name)
print(result.attributes.summary)
print(result.attributes.patron_count)
```

---

## list_members

List members (patrons) for a Patreon campaign.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `campaign_id` | string | yes | The ID of the campaign to list members for |

### Examples

#### All members

```lua
local result = app.integrations.patreon.list_members({
  campaign_id = "123456"
})

for _, member in ipairs(result.members) do
  print(member.attributes.full_name .. " — " .. member.attributes.patron_status)
end
```

---

## get_member

Get details for a single Patreon member.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `member_id` | string | yes | The ID of the member to retrieve |

### Example

```lua
local result = app.integrations.patreon.get_member({
  member_id = "789012"
})

print(result.attributes.full_name)
print(result.attributes.email)
print(result.attributes.patron_status)
```

---

## list_posts

List posts for a Patreon campaign.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `campaign_id` | string | yes | The ID of the campaign to list posts for |

### Examples

```lua
local result = app.integrations.patreon.list_posts({
  campaign_id = "123456"
})

for _, post in ipairs(result.posts) do
  print(post.attributes.title .. " — " .. post.attributes.published_at)
end
```

---

## get_post

Get details for a single Patreon post.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `post_id` | string | yes | The ID of the post to retrieve |

### Example

```lua
local result = app.integrations.patreon.get_post({
  post_id = "345678"
})

print(result.attributes.title)
print(result.attributes.content)
print(result.attributes.published_at)
```

---

## get_current_user

Get the profile of the currently authenticated Patreon user.

### Parameters

None.

### Example

```lua
local result = app.integrations.patreon.get_current_user()

print("Connected as: " .. result.attributes.full_name)
print("Email: " .. result.attributes.email)
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.patreon.function_name({...})

-- Explicit default (portable across setups)
app.integrations.patreon.default.function_name({...})

-- Named accounts
app.integrations.patreon.main_creator.function_name({...})
app.integrations.patreon.side_project.function_name({...})
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.patreon.list_campaigns({})
print(result)

Functions

list_campaigns Read

List all campaigns for the authenticated Patreon creator. Returns campaign IDs, names, descriptions, and patron counts.

Lua path
app.integrations.patreon.list_campaigns
Full name
patreon.patreon_list_campaigns
ParameterTypeRequiredDescription
No parameters.
get_campaign Read

Get detailed information about a single Patreon campaign by its ID. Returns full campaign data including description, patron count, and creation date.

Lua path
app.integrations.patreon.get_campaign
Full name
patreon.patreon_get_campaign
ParameterTypeRequiredDescription
campaign_id string yes The ID of the campaign to retrieve.
list_members Read

List members (patrons) for a Patreon campaign. Returns member IDs, names, email addresses, pledge amounts, and patron status.

Lua path
app.integrations.patreon.list_members
Full name
patreon.patreon_list_members
ParameterTypeRequiredDescription
campaign_id string yes The ID of the campaign to list members for.
get_member Read

Get detailed information about a single Patreon member by their ID. Returns member data including pledge details, patron status, and tier information.

Lua path
app.integrations.patreon.get_member
Full name
patreon.patreon_get_member
ParameterTypeRequiredDescription
member_id string yes The ID of the member to retrieve.
list_posts Read

List posts for a Patreon campaign. Returns post IDs, titles, publication dates, and content metadata.

Lua path
app.integrations.patreon.list_posts
Full name
patreon.patreon_list_posts
ParameterTypeRequiredDescription
campaign_id string yes The ID of the campaign to list posts for.
get_post Read

Get detailed information about a single Patreon post by its ID. Returns full post data including title, content, publish date, and tier access.

Lua path
app.integrations.patreon.get_post
Full name
patreon.patreon_get_post
ParameterTypeRequiredDescription
post_id string yes The ID of the post to retrieve.
get_current_user Read

Get the profile of the currently authenticated Patreon user. Useful to verify the connection and see account details.

Lua path
app.integrations.patreon.get_current_user
Full name
patreon.patreon_get_current_user
ParameterTypeRequiredDescription
No parameters.