KosmoKrator

communication

Intercom Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write Bearer token auth

Lua Namespace

Agents call this integration through app.integrations.intercom.*. Use lua_read_doc("integrations.intercom") 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.

Client for the Intercom REST API covering conversations, contacts, and companies — Lua API Reference

intercom_list_conversations

List Intercom conversations with pagination and sorting. Returns conversation IDs, created dates, and state.

Parameters

NameTypeRequiredDescription
limitintegernoMaximum number of conversations to return (default 20).
starting_afterstringnoPagination cursor from a previous response.
sort_orderstringnoSort order: “asc” or “desc”.
statusstringnoFilter by conversation status: “open”, “closed”, or “all”.

Example

local result = app.integrations.intercom.intercom_list_conversations({
  limit = 20
  starting_after = ""
  sort_order = "desc"
})

intercom_get_conversation

Retrieve an Intercom conversation by its ID. Returns the full conversation including message parts, contacts, and metadata.

Parameters

NameTypeRequiredDescription
conversation_idstringyesIntercom conversation ID.

Example

local result = app.integrations.intercom.intercom_get_conversation({
  conversation_id = "12345"
})

intercom_create_conversation

Create a new conversation in Intercom. Requires a user_id (Intercom contact ID) and a message body. Returns the created conversation with its ID.

Parameters

NameTypeRequiredDescription
user_idstringyesIntercom contact ID (user) to create the conversation for.
bodystringyesInitial message body for the conversation.

Example

local result = app.integrations.intercom.intercom_create_conversation({
  user_id = "67890"
  body = "Hello, I need help with my account."
})

intercom_list_contacts

List Intercom contacts with pagination. Returns contact IDs, emails, names, and roles.

Parameters

NameTypeRequiredDescription
limitintegernoMaximum number of contacts to return (default 20).
starting_afterstringnoPagination cursor from a previous response.

Example

local result = app.integrations.intercom.intercom_list_contacts({
  limit = 20
  starting_after = ""
})

intercom_get_contact

Retrieve an Intercom contact by its ID. Returns the contact’s ID, email, name, phone, role, and custom attributes.

Parameters

NameTypeRequiredDescription
contact_idstringyesIntercom contact ID.

Example

local result = app.integrations.intercom.intercom_get_contact({
  contact_id = "67890"
})

intercom_list_companies

List Intercom companies with pagination. Returns company IDs, names, employee counts, and industry.

Parameters

NameTypeRequiredDescription
limitintegernoMaximum number of companies to return (default 20).
starting_afterstringnoPagination cursor from a previous response.

Example

local result = app.integrations.intercom.intercom_list_companies({
  limit = 20
  starting_after = ""
})

intercom_get_current_user

Retrieve the currently authenticated Intercom admin user. Returns the admin’s ID, name, email, and avatar. Useful for identifying which workspace or token is in use.

Example

local result = app.integrations.intercom.intercom_get_current_user({
})

Multi-Account Usage

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

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

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

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

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

Raw agent markdown
# Client for the Intercom REST API covering conversations, contacts, and companies — Lua API Reference

## intercom_list_conversations

List Intercom conversations with pagination and sorting.
Returns conversation IDs, created dates, and state.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of conversations to return (default 20). |
| `starting_after` | string | no | Pagination cursor from a previous response. |
| `sort_order` | string | no | Sort order: "asc" or "desc". |
| `status` | string | no | Filter by conversation status: "open", "closed", or "all". |

### Example

```lua
local result = app.integrations.intercom.intercom_list_conversations({
  limit = 20
  starting_after = ""
  sort_order = "desc"
})
```

## intercom_get_conversation

Retrieve an Intercom conversation by its ID.
Returns the full conversation including message parts, contacts, and metadata.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `conversation_id` | string | yes | Intercom conversation ID. |

### Example

```lua
local result = app.integrations.intercom.intercom_get_conversation({
  conversation_id = "12345"
})
```

## intercom_create_conversation

Create a new conversation in Intercom.
Requires a user_id (Intercom contact ID) and a message body.
Returns the created conversation with its ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `user_id` | string | yes | Intercom contact ID (user) to create the conversation for. |
| `body` | string | yes | Initial message body for the conversation. |

### Example

```lua
local result = app.integrations.intercom.intercom_create_conversation({
  user_id = "67890"
  body = "Hello, I need help with my account."
})
```

## intercom_list_contacts

List Intercom contacts with pagination.
Returns contact IDs, emails, names, and roles.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of contacts to return (default 20). |
| `starting_after` | string | no | Pagination cursor from a previous response. |

### Example

```lua
local result = app.integrations.intercom.intercom_list_contacts({
  limit = 20
  starting_after = ""
})
```

## intercom_get_contact

Retrieve an Intercom contact by its ID.
Returns the contact's ID, email, name, phone, role, and custom attributes.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `contact_id` | string | yes | Intercom contact ID. |

### Example

```lua
local result = app.integrations.intercom.intercom_get_contact({
  contact_id = "67890"
})
```

## intercom_list_companies

List Intercom companies with pagination.
Returns company IDs, names, employee counts, and industry.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of companies to return (default 20). |
| `starting_after` | string | no | Pagination cursor from a previous response. |

### Example

```lua
local result = app.integrations.intercom.intercom_list_companies({
  limit = 20
  starting_after = ""
})
```

## intercom_get_current_user

Retrieve the currently authenticated Intercom admin user.
Returns the admin's ID, name, email, and avatar.
Useful for identifying which workspace or token is in use.

### Example

```lua
local result = app.integrations.intercom.intercom_get_current_user({
})
```

---

## Multi-Account Usage

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

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

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

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

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

Metadata-Derived Lua Example

local result = app.integrations.intercom.intercom_list_conversations({
  limit = 1,
  starting_after = "example_starting_after",
  sort_order = "example_sort_order",
  status = "example_status"
})
print(result)

Functions

intercom_list_conversations

List Intercom conversations with pagination and sorting. Returns conversation IDs, created dates, and state. Use limit, starting_after, and sort_order for pagination and ordering.

Operation
Read read
Full name
intercom.intercom_list_conversations
ParameterTypeRequiredDescription
limit integer no Maximum number of conversations to return (default 20).
starting_after string no Pagination cursor from a previous response.
sort_order string no Sort order: "asc" or "desc".
status string no Filter by conversation status: "open", "closed", or "all".

intercom_get_conversation

Retrieve an Intercom conversation by its ID. Returns the full conversation including message parts, contacts, and metadata.

Operation
Read read
Full name
intercom.intercom_get_conversation
ParameterTypeRequiredDescription
conversation_id string yes Intercom conversation ID.

intercom_create_conversation

Create a new conversation in Intercom. Requires a user_id (Intercom contact ID) and a message body. Returns the created conversation with its ID.

Operation
Write write
Full name
intercom.intercom_create_conversation
ParameterTypeRequiredDescription
user_id string yes Intercom contact ID (user) to create the conversation for.
body string yes Initial message body for the conversation.

intercom_list_contacts

List Intercom contacts with pagination. Returns contact IDs, emails, names, and roles. Use limit and starting_after for pagination.

Operation
Read read
Full name
intercom.intercom_list_contacts
ParameterTypeRequiredDescription
limit integer no Maximum number of contacts to return (default 20).
starting_after string no Pagination cursor from a previous response.

intercom_get_contact

Retrieve an Intercom contact by its ID. Returns the contact's ID, email, name, phone, role, and custom attributes.

Operation
Read read
Full name
intercom.intercom_get_contact
ParameterTypeRequiredDescription
contact_id string yes Intercom contact ID.

intercom_list_companies

List Intercom companies with pagination. Returns company IDs, names, and employee counts. Use limit and starting_after for pagination.

Operation
Read read
Full name
intercom.intercom_list_companies
ParameterTypeRequiredDescription
limit integer no Maximum number of companies to return (default 20).
starting_after string no Pagination cursor from a previous response.

intercom_get_current_user

Retrieve the currently authenticated Intercom admin user. Returns the admin's ID, name, email, and avatar. Useful for identifying which workspace or token is in use.

Operation
Read read
Full name
intercom.intercom_get_current_user
ParameterTypeRequiredDescription
No parameters.