productivity
Buffer Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Buffer KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.buffer.*.
Use lua_read_doc("integrations.buffer") 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
Buffer workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.buffer.list_profiles({}))' --json kosmo integrations:lua --eval 'print(docs.read("buffer"))' --json
kosmo integrations:lua --eval 'print(docs.read("buffer.list_profiles"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local buffer = app.integrations.buffer
local result = buffer.list_profiles({})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.buffer, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.buffer.default.* or app.integrations.buffer.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Buffer, 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.
Buffer - Lua API Reference
Namespace: app.integrations.buffer
This package covers Buffer’s documented legacy REST API for profiles, schedules,
updates, links, user, and configuration metadata. It also includes
graphql() for the current Buffer GraphQL API beta at https://api.buffer.com.
Profiles And Schedules
local profiles = app.integrations.buffer.list_profiles()
local profile = app.integrations.buffer.get_profile({
profileId = "profile_123"
})
local schedules = app.integrations.buffer.list_profile_schedules({
profileId = "profile_123"
})
Replace a profile’s posting schedules:
local result = app.integrations.buffer.update_profile_schedules({
profileId = "profile_123",
payload = {
schedules = {
{ days = { "mon", "wed", "fri" }, times = { "09:00", "15:30" } }
}
}
})
Updates
Create or immediately publish an update:
local result = app.integrations.buffer.create_update({
text = "New post from our site https://example.test/post",
profileIds = { "profile_123", "profile_456" },
scheduledAt = "2026-06-01T09:00:00Z",
media = {
link = "https://example.test/post",
title = "Example post",
description = "Short summary"
}
})
List pending and sent updates:
local pending = app.integrations.buffer.list_pending_updates({
profileId = "profile_123",
count = 20,
page = 1,
utc = true
})
local sent = app.integrations.buffer.list_sent_updates({
profileId = "profile_123",
filter = "all"
})
Manage pending updates:
app.integrations.buffer.reorder_updates({
profileId = "profile_123",
order = { "update_1", "update_2" },
offset = 0
})
app.integrations.buffer.shuffle_updates({
profileId = "profile_123",
count = 10
})
app.integrations.buffer.update_update({
updateId = "update_123",
payload = {
text = "Edited post text",
scheduled_at = "2026-06-01T10:00:00Z"
}
})
app.integrations.buffer.share_update({ updateId = "update_123" })
app.integrations.buffer.move_update_to_top({ updateId = "update_123" })
app.integrations.buffer.destroy_update({ updateId = "update_123" })
Links, Info, And User
local shares = app.integrations.buffer.get_link_shares({
url = "https://example.test/post"
})
local config = app.integrations.buffer.get_info_configuration()
local user = app.integrations.buffer.get_current_user()
deauthorize_user() revokes the current token. Treat it as destructive:
-- app.integrations.buffer.deauthorize_user()
GraphQL Beta
The current Buffer API is GraphQL and supports post creation/deletion/retrieval,
idea creation, account retrieval, organization retrieval, and channel retrieval.
Use graphql() when an operation belongs to the beta GraphQL API rather than
the legacy REST surface.
local result = app.integrations.buffer.graphql({
query = [[
query GetOrganizations {
account {
organizations {
id
}
}
}
]]
})
For mutations, pass variables explicitly:
local result = app.integrations.buffer.graphql({
query = [[
mutation Example($text: String) {
createPost(text: $text) {
id
}
}
]],
variables = {
text = "Draft from an integration"
}
})
Multi-Account Usage
app.integrations.buffer.list_profiles()
app.integrations.buffer.default.list_profiles()
app.integrations.buffer.client_acct.list_profiles()
All functions are identical across accounts. Only the credentials differ.
Raw agent markdown
# Buffer - Lua API Reference
Namespace: `app.integrations.buffer`
This package covers Buffer's documented legacy REST API for profiles, schedules,
updates, links, user, and configuration metadata. It also includes
`graphql()` for the current Buffer GraphQL API beta at `https://api.buffer.com`.
## Profiles And Schedules
```lua
local profiles = app.integrations.buffer.list_profiles()
local profile = app.integrations.buffer.get_profile({
profileId = "profile_123"
})
local schedules = app.integrations.buffer.list_profile_schedules({
profileId = "profile_123"
})
```
Replace a profile's posting schedules:
```lua
local result = app.integrations.buffer.update_profile_schedules({
profileId = "profile_123",
payload = {
schedules = {
{ days = { "mon", "wed", "fri" }, times = { "09:00", "15:30" } }
}
}
})
```
## Updates
Create or immediately publish an update:
```lua
local result = app.integrations.buffer.create_update({
text = "New post from our site https://example.test/post",
profileIds = { "profile_123", "profile_456" },
scheduledAt = "2026-06-01T09:00:00Z",
media = {
link = "https://example.test/post",
title = "Example post",
description = "Short summary"
}
})
```
List pending and sent updates:
```lua
local pending = app.integrations.buffer.list_pending_updates({
profileId = "profile_123",
count = 20,
page = 1,
utc = true
})
local sent = app.integrations.buffer.list_sent_updates({
profileId = "profile_123",
filter = "all"
})
```
Manage pending updates:
```lua
app.integrations.buffer.reorder_updates({
profileId = "profile_123",
order = { "update_1", "update_2" },
offset = 0
})
app.integrations.buffer.shuffle_updates({
profileId = "profile_123",
count = 10
})
app.integrations.buffer.update_update({
updateId = "update_123",
payload = {
text = "Edited post text",
scheduled_at = "2026-06-01T10:00:00Z"
}
})
app.integrations.buffer.share_update({ updateId = "update_123" })
app.integrations.buffer.move_update_to_top({ updateId = "update_123" })
app.integrations.buffer.destroy_update({ updateId = "update_123" })
```
## Links, Info, And User
```lua
local shares = app.integrations.buffer.get_link_shares({
url = "https://example.test/post"
})
local config = app.integrations.buffer.get_info_configuration()
local user = app.integrations.buffer.get_current_user()
```
`deauthorize_user()` revokes the current token. Treat it as destructive:
```lua
-- app.integrations.buffer.deauthorize_user()
```
## GraphQL Beta
The current Buffer API is GraphQL and supports post creation/deletion/retrieval,
idea creation, account retrieval, organization retrieval, and channel retrieval.
Use `graphql()` when an operation belongs to the beta GraphQL API rather than
the legacy REST surface.
```lua
local result = app.integrations.buffer.graphql({
query = [[
query GetOrganizations {
account {
organizations {
id
}
}
}
]]
})
```
For mutations, pass variables explicitly:
```lua
local result = app.integrations.buffer.graphql({
query = [[
mutation Example($text: String) {
createPost(text: $text) {
id
}
}
]],
variables = {
text = "Draft from an integration"
}
})
```
## Multi-Account Usage
```lua
app.integrations.buffer.list_profiles()
app.integrations.buffer.default.list_profiles()
app.integrations.buffer.client_acct.list_profiles()
```
All functions are identical across accounts. Only the credentials differ. local result = app.integrations.buffer.list_profiles({})
print(result) Functions
list_profiles Read
List all social media profiles connected to the Buffer account. Returns profile IDs, service types (e.g., Twitter, Facebook, LinkedIn), and display names.
- Lua path
app.integrations.buffer.list_profiles- Full name
buffer.buffer_list_profiles
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_profile Read
Get details of a specific social media profile in Buffer by its ID. Returns profile service type, display name, and account metadata.
- Lua path
app.integrations.buffer.get_profile- Full name
buffer.buffer_get_profile
| Parameter | Type | Required | Description |
|---|---|---|---|
profileId | string | yes | The social profile ID to retrieve. |
list_profile_schedules Read
List posting schedules for a social profile.
- Lua path
app.integrations.buffer.list_profile_schedules- Full name
buffer.buffer_list_profile_schedules
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
update_profile_schedules Write
Replace posting schedules for a social profile.
- Lua path
app.integrations.buffer.update_profile_schedules- Full name
buffer.buffer_update_profile_schedules
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_pending_updates Read
List scheduled (pending) updates for a Buffer profile. Returns update IDs, text content, scheduled times, and status. Supports pagination.
- Lua path
app.integrations.buffer.list_pending_updates- Full name
buffer.buffer_list_pending_updates
| Parameter | Type | Required | Description |
|---|---|---|---|
profileId | string | yes | The social profile ID to list pending updates for. |
count | integer | no | Number of updates to return per page. |
page | integer | no | Page number for pagination. |
since | integer | no | Only return updates created after this Unix timestamp. |
utc | boolean | no | Return times relative to UTC. |
create_update Write
Create and schedule a new social media update in Buffer. Provide the text content, target profile IDs, and optionally a scheduled time or media attachments.
- Lua path
app.integrations.buffer.create_update- Full name
buffer.buffer_create_update
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | yes | The text content of the update to post. |
profileIds | array | yes | Array of Buffer profile IDs to publish the update to. |
shorten | boolean | no | Whether to automatically shorten links (default true). |
now | boolean | no | Post immediately instead of scheduling (default false). |
top | boolean | no | Add this update to the top of the buffer. |
scheduledAt | string | no | ISO 8601 timestamp for when the update should be sent (e.g., "2025-02-01T09:00:00Z"). |
media | object | no | Media attachments such as photo URL, link, or thumbnail. |
retweet | object | no | Twitter retweet payload such as tweet_id and optional comment. |
attachment | boolean | no | Whether Buffer should automatically populate media from links in the text. |
list_sent_updates Read
List already posted (sent) updates for a Buffer profile. Returns update IDs, text content, sent times, and engagement metrics. Supports pagination.
- Lua path
app.integrations.buffer.list_sent_updates- Full name
buffer.buffer_list_sent_updates
| Parameter | Type | Required | Description |
|---|---|---|---|
profileId | string | yes | The social profile ID to list sent updates for. |
count | integer | no | Number of updates to return per page. |
page | integer | no | Page number for pagination. |
since | integer | no | Only return updates sent after this Unix timestamp. |
utc | boolean | no | Return times relative to UTC. |
filter | string | no | Sent update filter, such as all or default. |
get_update Read
Get details of a specific Buffer update by its ID. Returns the update text, scheduled or sent time, social profiles, media, and delivery status.
- Lua path
app.integrations.buffer.get_update- Full name
buffer.buffer_get_update
| Parameter | Type | Required | Description |
|---|---|---|---|
updateId | string | yes | The update ID to retrieve. |
reorder_updates Write
Reorder pending updates for a profile.
- Lua path
app.integrations.buffer.reorder_updates- Full name
buffer.buffer_reorder_updates
| Parameter | Type | Required | Description |
|---|---|---|---|
profileId | string | yes | The social profile ID. |
order | array | yes | Ordered array of pending update IDs. |
offset | integer | no | Optional offset for partial reorder. |
utc | boolean | no | Return times relative to UTC. |
shuffle_updates Write
Randomize pending updates for a profile.
- Lua path
app.integrations.buffer.shuffle_updates- Full name
buffer.buffer_shuffle_updates
| Parameter | Type | Required | Description |
|---|---|---|---|
profileId | string | yes | The social profile ID. |
count | integer | no | Number of updates to return. |
utc | boolean | no | Return times relative to UTC. |
update_update Write
Edit an existing pending update.
- Lua path
app.integrations.buffer.update_update- Full name
buffer.buffer_update_update
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
destroy_update Write
Permanently delete a pending update.
- Lua path
app.integrations.buffer.destroy_update- Full name
buffer.buffer_destroy_update
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
move_update_top Write
Move a pending update to the top of the queue.
- Lua path
app.integrations.buffer.move_update_top- Full name
buffer.buffer_move_update_to_top
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_info_configuration Read
Get Buffer API service, limit, media, and analytics metadata.
- Lua path
app.integrations.buffer.get_info_configuration- Full name
buffer.buffer_get_info_configuration
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
deauthorize_user Write
Deauthorize the current Buffer API token.
- Lua path
app.integrations.buffer.deauthorize_user- Full name
buffer.buffer_deauthorize_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
graphql_operation Write
Execute a Buffer GraphQL API operation against the current beta API endpoint.
- Lua path
app.integrations.buffer.graphql_operation- Full name
buffer.buffer_graphql
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | yes | GraphQL query or mutation document. |
variables | object | no | GraphQL variables. |
operationName | string | no | Optional GraphQL operation name. |
get_current_user Read
Get the currently authenticated Buffer user profile. Returns the user name, email, and account info.
- Lua path
app.integrations.buffer.get_current_user- Full name
buffer.buffer_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||