KosmoKrator

sales

Freshworks CRM Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write API key auth

Lua Namespace

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

Freshworks CRM — Lua API Reference

list_contacts

List contacts in Freshworks CRM with pagination.

Parameters

NameTypeRequiredDescription
pageintegernoPage number (default: 1)
per_pageintegernoResults per page (default: 20, max: 100)

Example

local result = app.integrations.freshworks_crm.list_contacts({
  page = 1,
  per_page = 20
})

for _, contact in ipairs(result.contacts) do
  print(contact.first_name .. " " .. contact.last_name .. " - " .. (contact.email or "no email"))
end

get_contact

Get a single contact by ID.

Parameters

NameTypeRequiredDescription
idintegeryesThe contact ID

Example

local result = app.integrations.freshworks_crm.get_contact({ id = 12345 })
local contact = result.contact
print(contact.first_name .. " " .. contact.last_name)
print("Email: " .. (contact.email or "N/A"))

create_contact

Create a new contact in Freshworks CRM.

Parameters

NameTypeRequiredDescription
first_namestringnoFirst name
last_namestringnoLast name
emailstringnoEmail address
mobile_numberstringnoMobile phone number

At least one field must be provided.

Example

local result = app.integrations.freshworks_crm.create_contact({
  first_name = "Jane",
  last_name = "Smith",
  email = "[email protected]",
  mobile_number = "+1234567890"
})

print("Created contact ID: " .. result.contact.id)

list_deals

List deals with pagination and optional stage filter.

Parameters

NameTypeRequiredDescription
pageintegernoPage number (default: 1)
per_pageintegernoResults per page (default: 20, max: 100)
stageintegernoFilter by deal stage ID

Example

local result = app.integrations.freshworks_crm.list_deals({
  page = 1,
  per_page = 20,
  stage = 5
})

for _, deal in ipairs(result.deals) do
  print(deal.name .. " - Amount: " .. deal.amount)
end

get_deal

Get a single deal by ID.

Parameters

NameTypeRequiredDescription
idintegeryesThe deal ID

Example

local result = app.integrations.freshworks_crm.get_deal({ id = 67890 })
local deal = result.deal
print(deal.name .. " - " .. deal.amount .. " " .. deal.currency)

list_accounts

List sales accounts with pagination.

Parameters

NameTypeRequiredDescription
pageintegernoPage number (default: 1)
per_pageintegernoResults per page (default: 20, max: 100)

Example

local result = app.integrations.freshworks_crm.list_accounts({
  page = 1,
  per_page = 20
})

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

get_current_user

Get the currently authenticated Freshworks CRM user.

Parameters

None.

Example

local result = app.integrations.freshworks_crm.get_current_user({})
local user = result.user
print("Connected as: " .. user.first_name .. " " .. user.last_name .. " (" .. user.email .. ")")

Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.freshworks_crm.us_team.function_name({...})
app.integrations.freshworks_crm.eu_team.function_name({...})

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

Raw agent markdown
# Freshworks CRM — Lua API Reference

## list_contacts

List contacts in Freshworks CRM with pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (default: 1) |
| `per_page` | integer | no | Results per page (default: 20, max: 100) |

### Example

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

for _, contact in ipairs(result.contacts) do
  print(contact.first_name .. " " .. contact.last_name .. " - " .. (contact.email or "no email"))
end
```

---

## get_contact

Get a single contact by ID.

### Parameters

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

### Example

```lua
local result = app.integrations.freshworks_crm.get_contact({ id = 12345 })
local contact = result.contact
print(contact.first_name .. " " .. contact.last_name)
print("Email: " .. (contact.email or "N/A"))
```

---

## create_contact

Create a new contact in Freshworks CRM.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `first_name` | string | no | First name |
| `last_name` | string | no | Last name |
| `email` | string | no | Email address |
| `mobile_number` | string | no | Mobile phone number |

At least one field must be provided.

### Example

```lua
local result = app.integrations.freshworks_crm.create_contact({
  first_name = "Jane",
  last_name = "Smith",
  email = "[email protected]",
  mobile_number = "+1234567890"
})

print("Created contact ID: " .. result.contact.id)
```

---

## list_deals

List deals with pagination and optional stage filter.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (default: 1) |
| `per_page` | integer | no | Results per page (default: 20, max: 100) |
| `stage` | integer | no | Filter by deal stage ID |

### Example

```lua
local result = app.integrations.freshworks_crm.list_deals({
  page = 1,
  per_page = 20,
  stage = 5
})

for _, deal in ipairs(result.deals) do
  print(deal.name .. " - Amount: " .. deal.amount)
end
```

---

## get_deal

Get a single deal by ID.

### Parameters

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

### Example

```lua
local result = app.integrations.freshworks_crm.get_deal({ id = 67890 })
local deal = result.deal
print(deal.name .. " - " .. deal.amount .. " " .. deal.currency)
```

---

## list_accounts

List sales accounts with pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (default: 1) |
| `per_page` | integer | no | Results per page (default: 20, max: 100) |

### Example

```lua
local result = app.integrations.freshworks_crm.list_accounts({
  page = 1,
  per_page = 20
})

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

---

## get_current_user

Get the currently authenticated Freshworks CRM user.

### Parameters

None.

### Example

```lua
local result = app.integrations.freshworks_crm.get_current_user({})
local user = result.user
print("Connected as: " .. user.first_name .. " " .. user.last_name .. " (" .. user.email .. ")")
```

---

## Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.freshworks_crm.us_team.function_name({...})
app.integrations.freshworks_crm.eu_team.function_name({...})
```

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

Metadata-Derived Lua Example

local result = app.integrations.freshworks_crm.freshworks_crm_list_contacts({
  page = 1,
  per_page = 1
})
print(result)

Functions

freshworks_crm_list_contacts

List contacts in Freshworks CRM. Returns paginated results with contact details including name, email, phone, and company.

Operation
Read read
Full name
freshworks_crm.freshworks_crm_list_contacts
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
per_page integer no Number of contacts per page (default: 20, max: 100).

freshworks_crm_get_contact

Get a single contact from Freshworks CRM by ID. Returns full contact details including custom fields.

Operation
Read read
Full name
freshworks_crm.freshworks_crm_get_contact
ParameterTypeRequiredDescription
id integer yes The contact ID.

freshworks_crm_create_contact

Create a new contact in Freshworks CRM. Provide at least a first name or last name. Email and mobile number are optional.

Operation
Write write
Full name
freshworks_crm.freshworks_crm_create_contact
ParameterTypeRequiredDescription
first_name string no First name of the contact.
last_name string no Last name of the contact.
email string no Email address of the contact.
mobile_number string no Mobile phone number of the contact.

freshworks_crm_list_deals

List deals in Freshworks CRM. Returns paginated results with deal details. Optionally filter by deal stage.

Operation
Read read
Full name
freshworks_crm.freshworks_crm_list_deals
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
per_page integer no Number of deals per page (default: 20, max: 100).
stage integer no Filter deals by stage ID (e.g., pipeline stage).

freshworks_crm_get_deal

Get a single deal from Freshworks CRM by ID. Returns full deal details including amount, stage, associated contacts, and custom fields.

Operation
Read read
Full name
freshworks_crm.freshworks_crm_get_deal
ParameterTypeRequiredDescription
id integer yes The deal ID.

freshworks_crm_list_accounts

List sales accounts in Freshworks CRM. Returns paginated results with account details including name, domain, and industry.

Operation
Read read
Full name
freshworks_crm.freshworks_crm_list_accounts
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
per_page integer no Number of accounts per page (default: 20, max: 100).

freshworks_crm_get_current_user

Get the currently authenticated Freshworks CRM user. Useful for verifying credentials and understanding whose context the agent is operating in.

Operation
Read read
Full name
freshworks_crm.freshworks_crm_get_current_user
ParameterTypeRequiredDescription
No parameters.