KosmoKrator

productivity

Sprout Social Lua API for KosmoKrator Agents

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

Lua Namespace

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

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

Workflow file

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

workflow.lua
local sproutsocial = app.integrations.sproutsocial
local result = sproutsocial.list_profiles({})

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

MCP-only Lua

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

Sprout Social — Lua API Reference

list_profiles

List all social media profiles connected to the Sprout Social account.

Parameters

None.

Example

local result = app.integrations.sproutsocial.list_profiles()

for _, profile in ipairs(result) do
  print(profile.id .. ": " .. profile.service .. " (" .. profile.service_username .. ")")
end

get_profile

Get details of a specific social profile.

Parameters

NameTypeRequiredDescription
profileIdstringyesThe social profile ID

Example

local result = app.integrations.sproutsocial.get_profile({
  profileId = "123456"
})
print(result.service)
print(result.service_username)

list_posts

List posts across social profiles with optional filtering.

Parameters

NameTypeRequiredDescription
countintegernoNumber of posts to return per page
pageintegernoPage number for pagination
statusstringnoFilter by status: “sent”, “scheduled”, or “draft”

Example

local result = app.integrations.sproutsocial.list_posts({
  status = "scheduled",
  count = 20,
  page = 1
})

for _, post in ipairs(result.posts) do
  print(post.id .. ": " .. post.text .. " @ " .. post.scheduled_at)
end

create_post

Create and schedule a new social media post.

Parameters

NameTypeRequiredDescription
textstringyesThe text content of the post
profileIdsarrayyesProfile IDs to publish to
scheduledAtstringnoISO 8601 timestamp (e.g., "2025-02-01T09:00:00Z")
mediaobjectnoMedia attachments (photo, link, etc.)

Example

local result = app.integrations.sproutsocial.create_post({
  text = "Check out our latest blog post! https://example.com/blog",
  profileIds = {"123456", "789012"},
  scheduledAt = "2025-02-01T09:00:00Z"
})
print("Created post: " .. result.id)

list_messages

List inbox messages and conversations.

Parameters

NameTypeRequiredDescription
countintegernoNumber of messages to return per page
pageintegernoPage number for pagination

Example

local result = app.integrations.sproutsocial.list_messages({
  count = 10
})

for _, msg in ipairs(result.messages) do
  print(msg.id .. ": " .. msg.sender .. " - " .. msg.snippet)
end

get_message

Get details of a specific message by ID.

Parameters

NameTypeRequiredDescription
messageIdstringyesThe message ID to retrieve

Example

local result = app.integrations.sproutsocial.get_message({
  messageId = "msg_abc123"
})
print(result.sender)
print(result.content)

get_current_user

Get the currently authenticated Sprout Social user profile.

Parameters

None.

Example

local result = app.integrations.sproutsocial.get_current_user()
print("Logged in as: " .. (result.name or ""))
print("Email: " .. (result.email or ""))

Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.sproutsocial.client_acct.function_name({...})
app.integrations.sproutsocial.agency.function_name({...})

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

Raw agent markdown
# Sprout Social — Lua API Reference

## list_profiles

List all social media profiles connected to the Sprout Social account.

### Parameters

None.

### Example

```lua
local result = app.integrations.sproutsocial.list_profiles()

for _, profile in ipairs(result) do
  print(profile.id .. ": " .. profile.service .. " (" .. profile.service_username .. ")")
end
```

---

## get_profile

Get details of a specific social profile.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `profileId` | string | yes | The social profile ID |

### Example

```lua
local result = app.integrations.sproutsocial.get_profile({
  profileId = "123456"
})
print(result.service)
print(result.service_username)
```

---

## list_posts

List posts across social profiles with optional filtering.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `count` | integer | no | Number of posts to return per page |
| `page` | integer | no | Page number for pagination |
| `status` | string | no | Filter by status: "sent", "scheduled", or "draft" |

### Example

```lua
local result = app.integrations.sproutsocial.list_posts({
  status = "scheduled",
  count = 20,
  page = 1
})

for _, post in ipairs(result.posts) do
  print(post.id .. ": " .. post.text .. " @ " .. post.scheduled_at)
end
```

---

## create_post

Create and schedule a new social media post.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `text` | string | yes | The text content of the post |
| `profileIds` | array | yes | Profile IDs to publish to |
| `scheduledAt` | string | no | ISO 8601 timestamp (e.g., `"2025-02-01T09:00:00Z"`) |
| `media` | object | no | Media attachments (photo, link, etc.) |

### Example

```lua
local result = app.integrations.sproutsocial.create_post({
  text = "Check out our latest blog post! https://example.com/blog",
  profileIds = {"123456", "789012"},
  scheduledAt = "2025-02-01T09:00:00Z"
})
print("Created post: " .. result.id)
```

---

## list_messages

List inbox messages and conversations.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `count` | integer | no | Number of messages to return per page |
| `page` | integer | no | Page number for pagination |

### Example

```lua
local result = app.integrations.sproutsocial.list_messages({
  count = 10
})

for _, msg in ipairs(result.messages) do
  print(msg.id .. ": " .. msg.sender .. " - " .. msg.snippet)
end
```

---

## get_message

Get details of a specific message by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `messageId` | string | yes | The message ID to retrieve |

### Example

```lua
local result = app.integrations.sproutsocial.get_message({
  messageId = "msg_abc123"
})
print(result.sender)
print(result.content)
```

---

## get_current_user

Get the currently authenticated Sprout Social user profile.

### Parameters

None.

### Example

```lua
local result = app.integrations.sproutsocial.get_current_user()
print("Logged in as: " .. (result.name or ""))
print("Email: " .. (result.email or ""))
```

---

## Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.sproutsocial.client_acct.function_name({...})
app.integrations.sproutsocial.agency.function_name({...})
```

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

Functions

list_profiles Read

List all social media profiles connected to the Sprout Social account. Returns profile IDs, service types (e.g., Twitter, Facebook, LinkedIn), and display names.

Lua path
app.integrations.sproutsocial.list_profiles
Full name
sproutsocial.sproutsocial_list_profiles
ParameterTypeRequiredDescription
No parameters.
get_profile Read

Get details of a specific social media profile in Sprout Social by its ID. Returns profile service type, display name, and account metadata.

Lua path
app.integrations.sproutsocial.get_profile
Full name
sproutsocial.sproutsocial_get_profile
ParameterTypeRequiredDescription
profileId string yes The social profile ID to retrieve.
list_posts Read

List posts across social profiles in Sprout Social. Optionally filter by status (sent, scheduled, draft) and paginate results.

Lua path
app.integrations.sproutsocial.list_posts
Full name
sproutsocial.sproutsocial_list_posts
ParameterTypeRequiredDescription
count integer no Number of posts to return per page.
page integer no Page number for pagination.
status string no Filter by post status: "sent", "scheduled", or "draft".
create_post Write

Create and schedule a new social media post in Sprout Social. Provide the text content, target profile IDs, and optionally a scheduled time or media attachments.

Lua path
app.integrations.sproutsocial.create_post
Full name
sproutsocial.sproutsocial_create_post
ParameterTypeRequiredDescription
text string yes The text content of the post.
profileIds array yes Array of Sprout Social profile IDs to publish the post to.
scheduledAt string no ISO 8601 timestamp for when the post should be sent (e.g., "2025-02-01T09:00:00Z").
media object no Media attachments such as photo URL, link, or thumbnail.
list_messages Read

List inbox messages and conversations in Sprout Social. Returns message IDs, sender info, and content snippets with pagination support.

Lua path
app.integrations.sproutsocial.list_messages
Full name
sproutsocial.sproutsocial_list_messages
ParameterTypeRequiredDescription
count integer no Number of messages to return per page.
page integer no Page number for pagination.
get_message Read

Get details of a specific message in Sprout Social by its ID. Returns sender info, message content, attachments, and conversation metadata.

Lua path
app.integrations.sproutsocial.get_message
Full name
sproutsocial.sproutsocial_get_message
ParameterTypeRequiredDescription
messageId string yes The message ID to retrieve.
get_current_user Read

Get the currently authenticated Sprout Social user profile. Returns the user name, email, and account info.

Lua path
app.integrations.sproutsocial.get_current_user
Full name
sproutsocial.sproutsocial_get_current_user
ParameterTypeRequiredDescription
No parameters.