KosmoKrator

messaging

Crisp Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write API key auth

Lua Namespace

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

Crisp — Lua API Reference

list_conversations

List chat conversations for the website.

Parameters

NameTypeRequiredDescription
pageintegernoPage number (1-based). Default: 1
per_pageintegernoConversations per page (max 100). Default: 25

Example

local result = app.integrations.crisp.list_conversations({
  page = 1,
  per_page = 25
})

for _, conv in ipairs(result.data or {}) do
  print(conv.session_id .. " — " .. (conv.last_message or "no messages"))
end

get_conversation

Get details and messages of a specific conversation.

Parameters

NameTypeRequiredDescription
conversation_idstringyesThe conversation session ID

Example

local result = app.integrations.crisp.get_conversation({
  conversation_id = "session_abc123"
})

for _, msg in ipairs(result.data or {}) do
  print(msg.from .. ": " .. msg.content)
end

send_message

Send a message in a Crisp conversation.

Parameters

NameTypeRequiredDescription
conversation_idstringyesThe conversation session ID
textstringyesThe message text to send
typestringnoMessage type: "text" (default), "note", "file"
fromstringnoMessage origin: "operator" (default) or "user"

Example

local result = app.integrations.crisp.send_message({
  conversation_id = "session_abc123",
  text = "Hello! How can I help you today?",
  type = "text",
  from = "operator"
})

print("Message sent: " .. tostring(result.sent))

Send an internal note

local result = app.integrations.crisp.send_message({
  conversation_id = "session_abc123",
  text = "VIP customer — handle with priority.",
  type = "note",
  from = "operator"
})

list_contacts

List contacts for the website.

Parameters

NameTypeRequiredDescription
pageintegernoPage number (1-based). Default: 1
per_pageintegernoContacts per page (max 100). Default: 25

Example

local result = app.integrations.crisp.list_contacts({
  page = 1,
  per_page = 50
})

for _, contact in ipairs(result.data or {}) do
  print(contact.email .. " — " .. (contact.person.nickname or "unknown"))
end

get_contact

Get details of a specific contact.

Parameters

NameTypeRequiredDescription
contact_idstringyesThe contact identifier (email or Crisp contact ID)

Example

local result = app.integrations.crisp.get_contact({
  contact_id = "[email protected]"
})

local contact = result.data or {}
print("Name: " .. (contact.person.nickname or "N/A"))
print("Email: " .. (contact.person.email or "N/A"))

list_campaigns

List marketing campaigns for the website.

Parameters

NameTypeRequiredDescription
pageintegernoPage number (1-based). Default: 1
per_pageintegernoCampaigns per page (max 100). Default: 25

Example

local result = app.integrations.crisp.list_campaigns({
  page = 1,
  per_page = 25
})

for _, campaign in ipairs(result.data or {}) do
  print(campaign.name .. " — status: " .. campaign.state)
end

get_current_user

Get the authenticated Crisp user profile. Useful for verifying credentials.

Parameters

None.

Example

local result = app.integrations.crisp.get_current_user({})

local user = result.data or {}
print("Connected as: " .. (user.email or "unknown"))

Multi-Account Usage

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

-- Default account (always works)
app.integrations.crisp.list_conversations({...})

-- Explicit default (portable across setups)
app.integrations.crisp.default.list_conversations({...})

-- Named accounts
app.integrations.crisp.support.list_conversations({...})
app.integrations.crisp.sales.list_conversations({...})

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

Raw agent markdown
# Crisp — Lua API Reference

## list_conversations

List chat conversations for the website.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (1-based). Default: 1 |
| `per_page` | integer | no | Conversations per page (max 100). Default: 25 |

### Example

```lua
local result = app.integrations.crisp.list_conversations({
  page = 1,
  per_page = 25
})

for _, conv in ipairs(result.data or {}) do
  print(conv.session_id .. " — " .. (conv.last_message or "no messages"))
end
```

---

## get_conversation

Get details and messages of a specific conversation.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `conversation_id` | string | yes | The conversation session ID |

### Example

```lua
local result = app.integrations.crisp.get_conversation({
  conversation_id = "session_abc123"
})

for _, msg in ipairs(result.data or {}) do
  print(msg.from .. ": " .. msg.content)
end
```

---

## send_message

Send a message in a Crisp conversation.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `conversation_id` | string | yes | The conversation session ID |
| `text` | string | yes | The message text to send |
| `type` | string | no | Message type: `"text"` (default), `"note"`, `"file"` |
| `from` | string | no | Message origin: `"operator"` (default) or `"user"` |

### Example

```lua
local result = app.integrations.crisp.send_message({
  conversation_id = "session_abc123",
  text = "Hello! How can I help you today?",
  type = "text",
  from = "operator"
})

print("Message sent: " .. tostring(result.sent))
```

### Send an internal note

```lua
local result = app.integrations.crisp.send_message({
  conversation_id = "session_abc123",
  text = "VIP customer — handle with priority.",
  type = "note",
  from = "operator"
})
```

---

## list_contacts

List contacts for the website.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (1-based). Default: 1 |
| `per_page` | integer | no | Contacts per page (max 100). Default: 25 |

### Example

```lua
local result = app.integrations.crisp.list_contacts({
  page = 1,
  per_page = 50
})

for _, contact in ipairs(result.data or {}) do
  print(contact.email .. " — " .. (contact.person.nickname or "unknown"))
end
```

---

## get_contact

Get details of a specific contact.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `contact_id` | string | yes | The contact identifier (email or Crisp contact ID) |

### Example

```lua
local result = app.integrations.crisp.get_contact({
  contact_id = "[email protected]"
})

local contact = result.data or {}
print("Name: " .. (contact.person.nickname or "N/A"))
print("Email: " .. (contact.person.email or "N/A"))
```

---

## list_campaigns

List marketing campaigns for the website.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (1-based). Default: 1 |
| `per_page` | integer | no | Campaigns per page (max 100). Default: 25 |

### Example

```lua
local result = app.integrations.crisp.list_campaigns({
  page = 1,
  per_page = 25
})

for _, campaign in ipairs(result.data or {}) do
  print(campaign.name .. " — status: " .. campaign.state)
end
```

---

## get_current_user

Get the authenticated Crisp user profile. Useful for verifying credentials.

### Parameters

None.

### Example

```lua
local result = app.integrations.crisp.get_current_user({})

local user = result.data or {}
print("Connected as: " .. (user.email or "unknown"))
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.crisp.list_conversations({...})

-- Explicit default (portable across setups)
app.integrations.crisp.default.list_conversations({...})

-- Named accounts
app.integrations.crisp.support.list_conversations({...})
app.integrations.crisp.sales.list_conversations({...})
```

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

Metadata-Derived Lua Example

local result = app.integrations.crisp.crisp_list_conversations({
  page = 1,
  per_page = 1
})
print(result)

Functions

crisp_list_conversations

List chat conversations from Crisp. Returns conversation sessions with status, participant info, and last message preview. Supports pagination.

Operation
Read read
Full name
crisp.crisp_list_conversations
ParameterTypeRequiredDescription
page integer no Page number (1-based). Default: 1.
per_page integer no Number of conversations per page (max 100). Default: 25.

crisp_get_conversation

Get details and messages of a specific Crisp conversation. Returns the full message thread including sender info, timestamps, and message content.

Operation
Read read
Full name
crisp.crisp_get_conversation
ParameterTypeRequiredDescription
conversation_id string yes The conversation session ID.

crisp_send_message

Send a message in a Crisp conversation. Posts as an operator by default. Use the "type" parameter to send text, notes, or file messages.

Operation
Write write
Full name
crisp.crisp_send_message
ParameterTypeRequiredDescription
conversation_id string yes The conversation session ID to send the message to.
text string yes The message text to send.
type string no Message type: "text" (default), "note" (internal note), "file", etc.
from string no Message origin: "operator" (default) or "user".

crisp_list_contacts

List contacts from Crisp. Returns contact profiles with email, name, and custom data. Supports pagination.

Operation
Read read
Full name
crisp.crisp_list_contacts
ParameterTypeRequiredDescription
page integer no Page number (1-based). Default: 1.
per_page integer no Number of contacts per page (max 100). Default: 25.

crisp_get_contact

Get details of a specific Crisp contact. Returns profile info, custom data, segments, and more.

Operation
Read read
Full name
crisp.crisp_get_contact
ParameterTypeRequiredDescription
contact_id string yes The contact identifier (email or Crisp contact ID).

crisp_list_campaigns

List marketing campaigns from Crisp. Returns campaigns with status, template details, and delivery statistics. Supports pagination.

Operation
Read read
Full name
crisp.crisp_list_campaigns
ParameterTypeRequiredDescription
page integer no Page number (1-based). Default: 1.
per_page integer no Number of campaigns per page (max 100). Default: 25.

crisp_get_current_user

Get the currently authenticated Crisp user profile. Useful for verifying credentials and identifying the connected operator.

Operation
Read read
Full name
crisp.crisp_get_current_user
ParameterTypeRequiredDescription
No parameters.