KosmoKrator

social-media

Typefully Lua API for KosmoKrator Agents

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

5 functions 4 read 1 write API key auth

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.

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

create_draft

Create a new draft in Typefully. Supports tweets, threads, and newsletters.

Parameters

NameTypeRequiredDescription
contentstringyesDraft content. For threads, separate tweets with four newlines (\n\n\n\n).
typestringnoDraft type: "tweet", "thread", or "mail". Auto-detected if omitted.
schedule_datestringnoISO 8601 date to schedule (e.g., "2026-04-10T09:00:00Z"). Omit to save unscheduled.
thread_connectorbooleannoAdd “Show more” between thread tweets (default: true).
is_tweet_pinbooleannoPin the tweet after publishing (default: false).
is_tweet_replybooleannoPublish as a reply (default: false). Requires reply_to.
reply_tostringnoTweet ID to reply to.
mail_subjectstringnoSubject line for newsletter drafts.
mail_subtitlestringnoSubtitle for newsletter drafts.
audience_idstringnoAudience ID for newsletter drafts.
label_idsarraynoLabel IDs to assign.

Examples

Simple tweet

local result = app.integrations.typefully.create_draft({
  content = "Hello world! This is my first scheduled tweet via the API."
})
print("Draft ID: " .. result.id)

Thread with scheduling

local result = app.integrations.typefully.create_draft({
  content = "🧵 Thread: 3 tips for better tweets\n\n\n\n1/ Keep it concise. Short tweets get more engagement.\n\n\n\n2/ Use a hook. Start with a bold statement or question.\n\n\n\n3/ End with a CTA. Tell people what to do next.",
  type = "thread",
  schedule_date = "2026-04-10T09:00:00Z"
})
print("Scheduled thread ID: " .. result.id)

Newsletter draft

local result = app.integrations.typefully.create_draft({
  content = "# Weekly Update\n\nHere's what happened this week...",
  type = "mail",
  mail_subject = "Weekly Update — April 2026",
  mail_subtitle = "News, updates, and tips"
})

list_scheduled

List scheduled drafts awaiting publication.

Parameters

NameTypeRequiredDescription
limitintegernoMax results (default: 20, max: 100).
offsetintegernoSkip N results for pagination (default: 0).

Example

local result = app.integrations.typefully.list_scheduled({
  limit = 10
})

for _, draft in ipairs(result.drafts or {}) do
  print(draft.id .. ": scheduled for " .. (draft.schedule_date or "unscheduled"))
end

list_published

List already published drafts.

Parameters

NameTypeRequiredDescription
limitintegernoMax results (default: 20, max: 100).
offsetintegernoSkip N results for pagination (default: 0).

Example

local result = app.integrations.typefully.list_published({
  limit = 10
})

for _, draft in ipairs(result.drafts or {}) do
  print(draft.id .. ": published " .. (draft.published_at or "unknown"))
end

get_draft

Get details of a specific draft by ID.

Parameters

NameTypeRequiredDescription
idstringyesThe Typefully draft ID.

Example

local result = app.integrations.typefully.get_draft({
  id = "abc123"
})

print("Content: " .. result.content)
print("Status: " .. (result.status or "unknown"))

get_current_user

Get the authenticated user’s Typefully profile.

Parameters

None.

Example

local result = app.integrations.typefully.get_current_user({})
print("Handle: @" .. (result.handle or "unknown"))
print("Name: " .. (result.name or "unknown"))

Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.typefully.work.function_name({...})
app.integrations.typefully.personal.function_name({...})

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

Raw agent markdown
# Typefully — Lua API Reference

## create_draft

Create a new draft in Typefully. Supports tweets, threads, and newsletters.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `content` | string | yes | Draft content. For threads, separate tweets with four newlines (`\n\n\n\n`). |
| `type` | string | no | Draft type: `"tweet"`, `"thread"`, or `"mail"`. Auto-detected if omitted. |
| `schedule_date` | string | no | ISO 8601 date to schedule (e.g., `"2026-04-10T09:00:00Z"`). Omit to save unscheduled. |
| `thread_connector` | boolean | no | Add "Show more" between thread tweets (default: `true`). |
| `is_tweet_pin` | boolean | no | Pin the tweet after publishing (default: `false`). |
| `is_tweet_reply` | boolean | no | Publish as a reply (default: `false`). Requires `reply_to`. |
| `reply_to` | string | no | Tweet ID to reply to. |
| `mail_subject` | string | no | Subject line for newsletter drafts. |
| `mail_subtitle` | string | no | Subtitle for newsletter drafts. |
| `audience_id` | string | no | Audience ID for newsletter drafts. |
| `label_ids` | array | no | Label IDs to assign. |

### Examples

#### Simple tweet

```lua
local result = app.integrations.typefully.create_draft({
  content = "Hello world! This is my first scheduled tweet via the API."
})
print("Draft ID: " .. result.id)
```

#### Thread with scheduling

```lua
local result = app.integrations.typefully.create_draft({
  content = "🧵 Thread: 3 tips for better tweets\n\n\n\n1/ Keep it concise. Short tweets get more engagement.\n\n\n\n2/ Use a hook. Start with a bold statement or question.\n\n\n\n3/ End with a CTA. Tell people what to do next.",
  type = "thread",
  schedule_date = "2026-04-10T09:00:00Z"
})
print("Scheduled thread ID: " .. result.id)
```

#### Newsletter draft

```lua
local result = app.integrations.typefully.create_draft({
  content = "# Weekly Update\n\nHere's what happened this week...",
  type = "mail",
  mail_subject = "Weekly Update — April 2026",
  mail_subtitle = "News, updates, and tips"
})
```

---

## list_scheduled

List scheduled drafts awaiting publication.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Max results (default: 20, max: 100). |
| `offset` | integer | no | Skip N results for pagination (default: 0). |

### Example

```lua
local result = app.integrations.typefully.list_scheduled({
  limit = 10
})

for _, draft in ipairs(result.drafts or {}) do
  print(draft.id .. ": scheduled for " .. (draft.schedule_date or "unscheduled"))
end
```

---

## list_published

List already published drafts.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Max results (default: 20, max: 100). |
| `offset` | integer | no | Skip N results for pagination (default: 0). |

### Example

```lua
local result = app.integrations.typefully.list_published({
  limit = 10
})

for _, draft in ipairs(result.drafts or {}) do
  print(draft.id .. ": published " .. (draft.published_at or "unknown"))
end
```

---

## get_draft

Get details of a specific draft by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The Typefully draft ID. |

### Example

```lua
local result = app.integrations.typefully.get_draft({
  id = "abc123"
})

print("Content: " .. result.content)
print("Status: " .. (result.status or "unknown"))
```

---

## get_current_user

Get the authenticated user's Typefully profile.

### Parameters

None.

### Example

```lua
local result = app.integrations.typefully.get_current_user({})
print("Handle: @" .. (result.handle or "unknown"))
print("Name: " .. (result.name or "unknown"))
```

---

## Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.typefully.work.function_name({...})
app.integrations.typefully.personal.function_name({...})
```

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

Metadata-Derived Lua Example

local result = app.integrations.typefully.typefully_create_draft({
  content = "example_content",
  type = "example_type",
  schedule_date = "example_schedule_date",
  thread_connector = true,
  is_tweet_pin = true,
  is_tweet_reply = true,
  reply_to = "example_reply_to",
  mail_subject = "example_mail_subject"
})
print(result)

Functions

typefully_create_draft

Create a new draft in Typefully. Supports tweets, threads, and newsletter drafts. Separate individual tweets in a thread with four newlines (\\n\\n\\n\\n).

Operation
Write write
Full name
typefully.typefully_create_draft
ParameterTypeRequiredDescription
content string yes The content of the draft. For threads, separate tweets with four newlines.
type string no The type of draft: "tweet", "thread", or "mail". Defaults to auto-detected based on content.
schedule_date string no ISO 8601 date to schedule the draft (e.g., "2026-04-10T09:00:00Z"). Omit to save as a draft without scheduling.
thread_connector boolean no Whether to add a "Show more" connector between tweets in a thread (default: true).
is_tweet_pin boolean no Pin the tweet after publishing (default: false).
is_tweet_reply boolean no Publish as a reply (requires reply_to, default: false).
reply_to string no Tweet ID to reply to (required if is_tweet_reply is true).
mail_subject string no Subject line for newsletter drafts (type "mail" only).
mail_subtitle string no Subtitle for newsletter drafts.
audience_id string no Typefully audience ID for newsletter drafts.
label_ids array no Array of label IDs to assign to the draft.

typefully_list_scheduled

List scheduled drafts in Typefully that are queued for publication. Returns draft content, scheduled dates, and metadata.

Operation
Read read
Full name
typefully.typefully_list_scheduled
ParameterTypeRequiredDescription
limit integer no Maximum number of drafts to return (default: 20, max: 100).
offset integer no Number of drafts to skip for pagination (default: 0).

typefully_list_published

List published drafts in Typefully. Returns content, publication dates, engagement metrics, and metadata.

Operation
Read read
Full name
typefully.typefully_list_published
ParameterTypeRequiredDescription
limit integer no Maximum number of drafts to return (default: 20, max: 100).
offset integer no Number of drafts to skip for pagination (default: 0).

typefully_get_draft

Get details of a specific Typefully draft by its ID. Returns full content, scheduling info, and metadata.

Operation
Read read
Full name
typefully.typefully_get_draft
ParameterTypeRequiredDescription
id string yes The Typefully draft ID.

typefully_get_current_user

Get the authenticated Typefully user's profile information, including handle, name, and account details.

Operation
Read read
Full name
typefully.typefully_get_current_user
ParameterTypeRequiredDescription
No parameters.