KosmoKrator

data

Outreach Lua API for KosmoKrator Agents

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

Lua Namespace

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

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.outreach.list_prospects({page_size = 1, page_number = 1, sort = "example_sort", filter = "example_filter"}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("outreach"))' --json
kosmo integrations:lua --eval 'print(docs.read("outreach.list_prospects"))' --json

Workflow file

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

workflow.lua
local outreach = app.integrations.outreach
local result = outreach.list_prospects({page_size = 1, page_number = 1, sort = "example_sort", filter = "example_filter"})

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

MCP-only Lua

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

Outreach — Lua API Reference

outreach_list_prospects

List prospects in Outreach with optional filtering, sorting, and pagination.

Parameters

NameTypeRequiredDescription
page_sizeintegernoNumber of prospects per page (default: 25, max: 100).
page_numberintegernoPage number to retrieve (1-based).
sortstringnoSort field, prefix with - for descending (e.g., "createdAt", "-updatedAt").
filterarraynoJSON:API filter parameters.

Example

local result = app.integrations.outreach.list_prospects({
  page_size = 10,
  page_number = 1,
  sort = "-createdAt"
})

for _, prospect in ipairs(result.data) do
  print(prospect.attributes.firstName .. " " .. prospect.attributes.lastName)
end

outreach_get_prospect

Get a single prospect by ID.

Parameters

NameTypeRequiredDescription
idintegeryesThe prospect ID.

Example

local result = app.integrations.outreach.get_prospect({ id = 12345 })
local attrs = result.data.attributes
print(attrs.firstName .. " " .. attrs.lastName)
print("Emails: " .. table.concat(attrs.emails or {}, ", "))

outreach_create_prospect

Create a new prospect in Outreach.

Parameters

NameTypeRequiredDescription
first_namestringnoThe prospect’s first name.
last_namestringnoThe prospect’s last name.
emailsarraynoArray of email addresses.
companystringnoThe prospect’s company name.

Example

local result = app.integrations.outreach.create_prospect({
  first_name = "Jane",
  last_name = "Doe",
  emails = { "jane@example.com" },
  company = "Acme Corp"
})

print("Created prospect ID: " .. result.data.id)

outreach_list_sequences

List sales sequences in Outreach.

Parameters

NameTypeRequiredDescription
page_sizeintegernoNumber of sequences per page (default: 25, max: 100).
page_numberintegernoPage number to retrieve (1-based).

Example

local result = app.integrations.outreach.list_sequences({
  page_size = 20,
  page_number = 1
})

for _, seq in ipairs(result.data) do
  print(seq.attributes.name)
end

outreach_get_sequence

Get a single sequence by ID.

Parameters

NameTypeRequiredDescription
idintegeryesThe sequence ID.

Example

local result = app.integrations.outreach.get_sequence({ id = 42 })
print("Sequence: " .. result.data.attributes.name)

outreach_list_accounts

List accounts (organizations) in Outreach.

Parameters

NameTypeRequiredDescription
page_sizeintegernoNumber of accounts per page (default: 25, max: 100).
page_numberintegernoPage number to retrieve (1-based).

Example

local result = app.integrations.outreach.list_accounts({
  page_size = 50
})

for _, account in ipairs(result.data) do
  print(account.attributes.name .. " (" .. (account.attributes.domain or "no domain") .. ")")
end

outreach_get_current_user

Get the currently authenticated Outreach user.

Parameters

None.

Example

local result = app.integrations.outreach.get_current_user({})
local user = result.data.attributes
print("Logged in as: " .. user.firstName .. " " .. user.lastName)
print("Email: " .. (user.email or "N/A"))

Multi-Account Usage

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

-- Default account (always works)
app.integrations.outreach.list_prospects({ page_size = 10 })

-- Explicit default (portable across setups)
app.integrations.outreach.default.list_prospects({ page_size = 10 })

-- Named accounts
app.integrations.outreach.production.list_prospects({ page_size = 10 })
app.integrations.outreach.staging.list_prospects({ page_size = 10 })

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

Raw agent markdown
# Outreach — Lua API Reference

## outreach_list_prospects

List prospects in Outreach with optional filtering, sorting, and pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_size` | integer | no | Number of prospects per page (default: 25, max: 100). |
| `page_number` | integer | no | Page number to retrieve (1-based). |
| `sort` | string | no | Sort field, prefix with `-` for descending (e.g., `"createdAt"`, `"-updatedAt"`). |
| `filter` | array | no | JSON:API filter parameters. |

### Example

```lua
local result = app.integrations.outreach.list_prospects({
  page_size = 10,
  page_number = 1,
  sort = "-createdAt"
})

for _, prospect in ipairs(result.data) do
  print(prospect.attributes.firstName .. " " .. prospect.attributes.lastName)
end
```

---

## outreach_get_prospect

Get a single prospect by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The prospect ID. |

### Example

```lua
local result = app.integrations.outreach.get_prospect({ id = 12345 })
local attrs = result.data.attributes
print(attrs.firstName .. " " .. attrs.lastName)
print("Emails: " .. table.concat(attrs.emails or {}, ", "))
```

---

## outreach_create_prospect

Create a new prospect in Outreach.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `first_name` | string | no | The prospect's first name. |
| `last_name` | string | no | The prospect's last name. |
| `emails` | array | no | Array of email addresses. |
| `company` | string | no | The prospect's company name. |

### Example

```lua
local result = app.integrations.outreach.create_prospect({
  first_name = "Jane",
  last_name = "Doe",
  emails = { "jane@example.com" },
  company = "Acme Corp"
})

print("Created prospect ID: " .. result.data.id)
```

---

## outreach_list_sequences

List sales sequences in Outreach.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_size` | integer | no | Number of sequences per page (default: 25, max: 100). |
| `page_number` | integer | no | Page number to retrieve (1-based). |

### Example

```lua
local result = app.integrations.outreach.list_sequences({
  page_size = 20,
  page_number = 1
})

for _, seq in ipairs(result.data) do
  print(seq.attributes.name)
end
```

---

## outreach_get_sequence

Get a single sequence by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The sequence ID. |

### Example

```lua
local result = app.integrations.outreach.get_sequence({ id = 42 })
print("Sequence: " .. result.data.attributes.name)
```

---

## outreach_list_accounts

List accounts (organizations) in Outreach.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_size` | integer | no | Number of accounts per page (default: 25, max: 100). |
| `page_number` | integer | no | Page number to retrieve (1-based). |

### Example

```lua
local result = app.integrations.outreach.list_accounts({
  page_size = 50
})

for _, account in ipairs(result.data) do
  print(account.attributes.name .. " (" .. (account.attributes.domain or "no domain") .. ")")
end
```

---

## outreach_get_current_user

Get the currently authenticated Outreach user.

### Parameters

None.

### Example

```lua
local result = app.integrations.outreach.get_current_user({})
local user = result.data.attributes
print("Logged in as: " .. user.firstName .. " " .. user.lastName)
print("Email: " .. (user.email or "N/A"))
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.outreach.list_prospects({ page_size = 10 })

-- Explicit default (portable across setups)
app.integrations.outreach.default.list_prospects({ page_size = 10 })

-- Named accounts
app.integrations.outreach.production.list_prospects({ page_size = 10 })
app.integrations.outreach.staging.list_prospects({ page_size = 10 })
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.outreach.list_prospects({page_size = 1, page_number = 1, sort = "example_sort", filter = "example_filter"})
print(result)

Functions

list_prospects Read

List prospects in Outreach with optional filtering, sorting, and pagination. Returns prospect records including names, emails, and company info.

Lua path
app.integrations.outreach.list_prospects
Full name
outreach.outreach_list_prospects
ParameterTypeRequiredDescription
page_size integer no Number of prospects to return per page (default: 25, max: 100).
page_number integer no Page number to retrieve (1-based).
sort string no Sort field and direction (e.g., "createdAt" or "-createdAt" for descending).
filter array no JSON:API filter parameters (e.g., {"email": "user@example.com"}).
get_prospect Read

Get a single prospect from Outreach by ID. Returns full prospect details including contact info, custom fields, and related data.

Lua path
app.integrations.outreach.get_prospect
Full name
outreach.outreach_get_prospect
ParameterTypeRequiredDescription
id integer yes The prospect ID.
create_prospect Write

Create a new prospect in Outreach. Provide first name, last name, emails, and optional company to add a contact to your prospect database.

Lua path
app.integrations.outreach.create_prospect
Full name
outreach.outreach_create_prospect
ParameterTypeRequiredDescription
first_name string no The prospect's first name.
last_name string no The prospect's last name.
emails array no Array of email addresses for the prospect (e.g., ["user@example.com"]).
company string no The prospect's company name.
list_sequences Read

List sales sequences in Outreach with optional pagination. Returns sequence details including name, status, and creation date.

Lua path
app.integrations.outreach.list_sequences
Full name
outreach.outreach_list_sequences
ParameterTypeRequiredDescription
page_size integer no Number of sequences to return per page (default: 25, max: 100).
page_number integer no Page number to retrieve (1-based).
get_sequence Read

Get a single sales sequence from Outreach by ID. Returns full sequence details including steps, settings, and associated metadata.

Lua path
app.integrations.outreach.get_sequence
Full name
outreach.outreach_get_sequence
ParameterTypeRequiredDescription
id integer yes The sequence ID.
list_accounts Read

List accounts (organizations) in Outreach with optional pagination. Returns account details including name, domain, and company information.

Lua path
app.integrations.outreach.list_accounts
Full name
outreach.outreach_list_accounts
ParameterTypeRequiredDescription
page_size integer no Number of accounts to return per page (default: 25, max: 100).
page_number integer no Page number to retrieve (1-based).
get_current_user Read

Get the currently authenticated Outreach user. Returns user profile details including name, email, and role.

Lua path
app.integrations.outreach.get_current_user
Full name
outreach.outreach_get_current_user
ParameterTypeRequiredDescription
No parameters.