KosmoKrator

productivity

Typefully Lua API for KosmoKrator Agents

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

Lua Namespace

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

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

Workflow file

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

workflow.lua
local typefully = app.integrations.typefully
local result = typefully.get_current_user({})

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

MCP-only Lua

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

Typefully

Lua API reference for the typefully integration package. This package targets Typefully API v2, which uses Authorization: Bearer <api_key> and scopes draft, media, tag, and queue operations under a social_set_id.

Start with typefully_list_social_sets to find the account or brand you want to publish from.

User and Social Sets

typefully_get_current_user

local user = typefully_get_current_user()
print(user.name or user.handle)

typefully_list_social_sets

local sets = typefully_list_social_sets({ limit = 20 })
for _, set in ipairs(sets.results or {}) do
  print(set.id, set.name, set.username)
end

typefully_get_social_set

local set = typefully_get_social_set({ social_set_id = "social-set-test" })
print(set.name)

Drafts

typefully_list_drafts

List drafts with optional status, tags, limit, offset, and sort filters. Common statuses include draft, scheduled, and published.

local drafts = typefully_list_drafts({
  social_set_id = "social-set-test",
  status = "scheduled",
  limit = 10,
  sort = "scheduled_date",
})

typefully_list_scheduled

Shortcut for listing drafts with status = "scheduled".

local scheduled = typefully_list_scheduled({
  social_set_id = "social-set-test",
  limit = 10,
})

typefully_list_published

Shortcut for listing drafts with status = "published".

local published = typefully_list_published({
  social_set_id = "social-set-test",
  limit = 10,
})

typefully_get_draft

local draft = typefully_get_draft({
  social_set_id = "social-set-test",
  draft_id = "draft-test",
})
print(draft.id, draft.status)

typefully_create_draft

For full v2 control, pass the Typefully platforms structure. Supported platform keys include x, linkedin, threads, bluesky, and mastodon.

local draft = typefully_create_draft({
  social_set_id = "social-set-test",
  platforms = {
    x = {
      enabled = true,
      posts = {
        { text = "Just shipped a new feature." },
      },
    },
    linkedin = {
      enabled = true,
      posts = {
        { text = "We just shipped a new feature for teams." },
      },
    },
  },
  tags = { "product-launch" },
})

For a simple single-platform draft, pass content and optionally platform.

local draft = typefully_create_draft({
  social_set_id = "social-set-test",
  platform = "x",
  content = "Simple draft from an agent.",
})

To schedule or publish immediately, set publish_at to an ISO 8601 datetime, "next-free-slot", or "now".

local scheduled = typefully_create_draft({
  social_set_id = "social-set-test",
  content = "Scheduled for the next free slot.",
  publish_at = "next-free-slot",
})

typefully_update_draft

Patch an existing draft. Only provided fields are sent.

local draft = typefully_update_draft({
  social_set_id = "social-set-test",
  draft_id = "draft-test",
  publish_at = "now",
  share = true,
})

typefully_delete_draft

local result = typefully_delete_draft({
  social_set_id = "social-set-test",
  draft_id = "draft-test",
})
print(result.deleted)

Media

typefully_request_media_upload

Request a presigned upload URL. Upload the file bytes to the returned URL outside this tool, then check media status and attach the media_id to a draft post.

local upload = typefully_request_media_upload({
  social_set_id = "social-set-test",
  file_name = "launch.png",
  file_type = "image/png",
})
print(upload.media_id, upload.upload_url)

typefully_get_media

local media = typefully_get_media({
  social_set_id = "social-set-test",
  media_id = "media-test",
})
print(media.status)

Attach ready media IDs in a draft:

local draft = typefully_create_draft({
  social_set_id = "social-set-test",
  platforms = {
    x = {
      enabled = true,
      posts = {
        { text = "Launch image attached.", media_ids = { "media-test" } },
      },
    },
  },
})

Tags

typefully_list_tags

local tags = typefully_list_tags({ social_set_id = "social-set-test" })

typefully_create_tag

local tag = typefully_create_tag({
  social_set_id = "social-set-test",
  name = "Product Launch",
})

Queue

typefully_get_queue

Inspect upcoming scheduled content for a social set where the endpoint is available.

local queue = typefully_get_queue({
  social_set_id = "social-set-test",
  limit = 10,
})

Return Shapes

Typefully v2 list endpoints commonly return paginated objects with fields such as results, count, limit, and offset. Draft and media tools return the Typefully API object for the requested resource. Delete tools return a compact confirmation object:

{ deleted = true, draft_id = "draft-test" }

Multi-Account Usage

Use the namespace prefix assigned by the host:

local sets = ns_typefully_work.typefully_list_social_sets({ limit = 10 })
Raw agent markdown
# Typefully

Lua API reference for the `typefully` integration package. This package targets Typefully API v2, which uses `Authorization: Bearer <api_key>` and scopes draft, media, tag, and queue operations under a `social_set_id`.

Start with `typefully_list_social_sets` to find the account or brand you want to publish from.

## User and Social Sets

### `typefully_get_current_user`

```lua
local user = typefully_get_current_user()
print(user.name or user.handle)
```

### `typefully_list_social_sets`

```lua
local sets = typefully_list_social_sets({ limit = 20 })
for _, set in ipairs(sets.results or {}) do
  print(set.id, set.name, set.username)
end
```

### `typefully_get_social_set`

```lua
local set = typefully_get_social_set({ social_set_id = "social-set-test" })
print(set.name)
```

## Drafts

### `typefully_list_drafts`

List drafts with optional `status`, `tags`, `limit`, `offset`, and `sort` filters. Common statuses include `draft`, `scheduled`, and `published`.

```lua
local drafts = typefully_list_drafts({
  social_set_id = "social-set-test",
  status = "scheduled",
  limit = 10,
  sort = "scheduled_date",
})
```

### `typefully_list_scheduled`

Shortcut for listing drafts with `status = "scheduled"`.

```lua
local scheduled = typefully_list_scheduled({
  social_set_id = "social-set-test",
  limit = 10,
})
```

### `typefully_list_published`

Shortcut for listing drafts with `status = "published"`.

```lua
local published = typefully_list_published({
  social_set_id = "social-set-test",
  limit = 10,
})
```

### `typefully_get_draft`

```lua
local draft = typefully_get_draft({
  social_set_id = "social-set-test",
  draft_id = "draft-test",
})
print(draft.id, draft.status)
```

### `typefully_create_draft`

For full v2 control, pass the Typefully `platforms` structure. Supported platform keys include `x`, `linkedin`, `threads`, `bluesky`, and `mastodon`.

```lua
local draft = typefully_create_draft({
  social_set_id = "social-set-test",
  platforms = {
    x = {
      enabled = true,
      posts = {
        { text = "Just shipped a new feature." },
      },
    },
    linkedin = {
      enabled = true,
      posts = {
        { text = "We just shipped a new feature for teams." },
      },
    },
  },
  tags = { "product-launch" },
})
```

For a simple single-platform draft, pass `content` and optionally `platform`.

```lua
local draft = typefully_create_draft({
  social_set_id = "social-set-test",
  platform = "x",
  content = "Simple draft from an agent.",
})
```

To schedule or publish immediately, set `publish_at` to an ISO 8601 datetime, `"next-free-slot"`, or `"now"`.

```lua
local scheduled = typefully_create_draft({
  social_set_id = "social-set-test",
  content = "Scheduled for the next free slot.",
  publish_at = "next-free-slot",
})
```

### `typefully_update_draft`

Patch an existing draft. Only provided fields are sent.

```lua
local draft = typefully_update_draft({
  social_set_id = "social-set-test",
  draft_id = "draft-test",
  publish_at = "now",
  share = true,
})
```

### `typefully_delete_draft`

```lua
local result = typefully_delete_draft({
  social_set_id = "social-set-test",
  draft_id = "draft-test",
})
print(result.deleted)
```

## Media

### `typefully_request_media_upload`

Request a presigned upload URL. Upload the file bytes to the returned URL outside this tool, then check media status and attach the `media_id` to a draft post.

```lua
local upload = typefully_request_media_upload({
  social_set_id = "social-set-test",
  file_name = "launch.png",
  file_type = "image/png",
})
print(upload.media_id, upload.upload_url)
```

### `typefully_get_media`

```lua
local media = typefully_get_media({
  social_set_id = "social-set-test",
  media_id = "media-test",
})
print(media.status)
```

Attach ready media IDs in a draft:

```lua
local draft = typefully_create_draft({
  social_set_id = "social-set-test",
  platforms = {
    x = {
      enabled = true,
      posts = {
        { text = "Launch image attached.", media_ids = { "media-test" } },
      },
    },
  },
})
```

## Tags

### `typefully_list_tags`

```lua
local tags = typefully_list_tags({ social_set_id = "social-set-test" })
```

### `typefully_create_tag`

```lua
local tag = typefully_create_tag({
  social_set_id = "social-set-test",
  name = "Product Launch",
})
```

## Queue

### `typefully_get_queue`

Inspect upcoming scheduled content for a social set where the endpoint is available.

```lua
local queue = typefully_get_queue({
  social_set_id = "social-set-test",
  limit = 10,
})
```

## Return Shapes

Typefully v2 list endpoints commonly return paginated objects with fields such as `results`, `count`, `limit`, and `offset`. Draft and media tools return the Typefully API object for the requested resource. Delete tools return a compact confirmation object:

```lua
{ deleted = true, draft_id = "draft-test" }
```

## Multi-Account Usage

Use the namespace prefix assigned by the host:

```lua
local sets = ns_typefully_work.typefully_list_social_sets({ limit = 10 })
```
Metadata-derived Lua example
local result = app.integrations.typefully.get_current_user({})
print(result)

Functions

get_current_user Read

Get the authenticated Typefully user profile.

Lua path
app.integrations.typefully.get_current_user
Full name
typefully.typefully_get_current_user
ParameterTypeRequiredDescription
No parameters.
list_social_sets Read

List Typefully social sets available to the authenticated API key.

Lua path
app.integrations.typefully.list_social_sets
Full name
typefully.typefully_list_social_sets
ParameterTypeRequiredDescription
limit integer no Maximum number of social sets to return.
offset integer no Number of social sets to skip for pagination.
get_social_set Read

Get Typefully social set details by ID.

Lua path
app.integrations.typefully.get_social_set
Full name
typefully.typefully_get_social_set
ParameterTypeRequiredDescription
social_set_id string yes Typefully social set ID.
list_drafts Read

List Typefully drafts for a social set with optional status, tag, and sorting filters.

Lua path
app.integrations.typefully.list_drafts
Full name
typefully.typefully_list_drafts
ParameterTypeRequiredDescription
social_set_id string yes Typefully social set ID.
status string no Draft status filter such as draft, scheduled, or published.
tags array no Tag slugs to filter by.
limit integer no Maximum number of drafts to return.
offset integer no Number of drafts to skip.
sort string no Sort field such as created_at, updated_at, scheduled_date, or published_at.
list_scheduled Read

List scheduled Typefully drafts for a social set.

Lua path
app.integrations.typefully.list_scheduled
Full name
typefully.typefully_list_scheduled
ParameterTypeRequiredDescription
social_set_id string yes Typefully social set ID.
limit integer no Maximum number of drafts to return.
offset integer no Number of drafts to skip for pagination.
sort string no Sort field such as scheduled_date, created_at, updated_at, or published_at.
list_published Read

List published Typefully drafts for a social set.

Lua path
app.integrations.typefully.list_published
Full name
typefully.typefully_list_published
ParameterTypeRequiredDescription
social_set_id string yes Typefully social set ID.
limit integer no Maximum number of drafts to return.
offset integer no Number of drafts to skip for pagination.
sort string no Sort field such as published_at, created_at, updated_at, or scheduled_date.
get_draft Read

Get one Typefully draft by social set ID and draft ID.

Lua path
app.integrations.typefully.get_draft
Full name
typefully.typefully_get_draft
ParameterTypeRequiredDescription
social_set_id string yes Typefully social set ID.
draft_id string yes Typefully draft ID.
create_draft Write

Create a Typefully v2 draft for a social set. Use platforms for full multi-platform control, or content plus platform for a simple post.

Lua path
app.integrations.typefully.create_draft
Full name
typefully.typefully_create_draft
ParameterTypeRequiredDescription
social_set_id string yes Typefully social set ID. Get it from typefully_list_social_sets.
platforms object no Full v2 platforms payload keyed by x, linkedin, threads, bluesky, or mastodon.
content string no Simple content shortcut when platforms is omitted.
platform string no Simple shortcut platform when platforms is omitted. Defaults to x.
posts array no Simple shortcut posts array. Each item may contain text and media_ids.
publish_at string no ISO 8601 datetime, "now", or "next-free-slot". Omit to save as draft.
title string no Optional internal draft title.
tags array no Tag slugs to assign to the draft.
share boolean no Whether to generate or enable public sharing for the draft.
reply_to string no Optional post URL or platform reference to publish as a reply.
update_draft Write

Update a Typefully draft, including platforms, publish_at, tags, share, or title.

Lua path
app.integrations.typefully.update_draft
Full name
typefully.typefully_update_draft
ParameterTypeRequiredDescription
social_set_id string yes Typefully social set ID.
draft_id string yes Typefully draft ID.
platforms object no Updated v2 platforms payload.
publish_at string no ISO 8601 datetime, "now", or "next-free-slot".
title string no Updated internal title.
tags array no Updated tag slugs.
share boolean no Whether public sharing is enabled.
reply_to string no Reply target reference.
delete_draft Write

Delete a Typefully draft by social set ID and draft ID.

Lua path
app.integrations.typefully.delete_draft
Full name
typefully.typefully_delete_draft
ParameterTypeRequiredDescription
social_set_id string yes Typefully social set ID.
draft_id string yes Typefully draft ID.
request_media_upload Write

Request a presigned Typefully media upload URL for a social set.

Lua path
app.integrations.typefully.request_media_upload
Full name
typefully.typefully_request_media_upload
ParameterTypeRequiredDescription
social_set_id string yes Typefully social set ID.
file_name string yes File name to upload.
file_type string no Optional MIME type if required by Typefully.
file_size integer no Optional file size in bytes if required by Typefully.
get_media Read

Get processing status and URLs for Typefully media by media ID.

Lua path
app.integrations.typefully.get_media
Full name
typefully.typefully_get_media
ParameterTypeRequiredDescription
social_set_id string yes Typefully social set ID.
media_id string yes Typefully media ID.
list_tags Read

List tags for a Typefully social set.

Lua path
app.integrations.typefully.list_tags
Full name
typefully.typefully_list_tags
ParameterTypeRequiredDescription
social_set_id string yes Typefully social set ID.
limit integer no Maximum number of tags to return.
offset integer no Number of tags to skip.
create_tag Write

Create a tag for a Typefully social set.

Lua path
app.integrations.typefully.create_tag
Full name
typefully.typefully_create_tag
ParameterTypeRequiredDescription
social_set_id string yes Typefully social set ID.
name string yes Tag display name.
get_queue Read

Get upcoming scheduled content for a Typefully social set.

Lua path
app.integrations.typefully.get_queue
Full name
typefully.typefully_get_queue
ParameterTypeRequiredDescription
social_set_id string yes Typefully social set ID.
limit integer no Maximum number of queue items to return.
offset integer no Number of queue items to skip.