KosmoKrator

productivity

Freshworks CRM Lua API for KosmoKrator Agents

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

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.

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 Freshworks CRM workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.freshworks_crm.list_contacts({page = 1, per_page = 1}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("freshworks-crm"))' --json
kosmo integrations:lua --eval 'print(docs.read("freshworks-crm.list_contacts"))' --json

Workflow file

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

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

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

MCP-only Lua

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

Freshworks CRM Lua API Reference

Namespace: freshworks-crm

Freshworks CRM tools call Freshsales/Freshworks CRM REST endpoints under a base URL ending in /crm/sales, for example https://example.myfreshworks.com/crm/sales.

Contacts

local contacts = app.integrations["freshworks-crm"].freshworks_crm_list_contacts({
  page = 1,
  per_page = 25,
})

local contact = app.integrations["freshworks-crm"].freshworks_crm_get_contact({ id = 123 })

local created = app.integrations["freshworks-crm"].freshworks_crm_create_contact({
  first_name = "Ada",
  last_name = "Example",
  email = "ada@example.test",
})

app.integrations["freshworks-crm"].freshworks_crm_update_contact({
  id = 123,
  job_title = "VP Sales",
})

app.integrations["freshworks-crm"].freshworks_crm_delete_contact({ id = 123 })

Contact filters and views:

local filters = app.integrations["freshworks-crm"].freshworks_crm_list_contact_filters({})

local view = app.integrations["freshworks-crm"].freshworks_crm_get_contact_view({
  view_id = 3,
  page = 1,
  per_page = 25,
})

Sales Accounts And Deals

local accounts = app.integrations["freshworks-crm"].freshworks_crm_list_accounts({ page = 1 })

local account = app.integrations["freshworks-crm"].freshworks_crm_create_account({
  name = "Example Corp",
  website = "https://example.test",
})

local deals = app.integrations["freshworks-crm"].freshworks_crm_list_deals({
  page = 1,
  per_page = 25,
})

local deal = app.integrations["freshworks-crm"].freshworks_crm_create_deal({
  name = "Example Renewal",
  amount = 25000,
  sales_account_id = 456,
})

Accounts and deals each have matching get, update, delete, filter-list, view, and bulk-upsert tools where supported by Freshworks CRM.

Tasks And Appointments

local tasks = app.integrations["freshworks-crm"].freshworks_crm_list_tasks({
  filter = "open",
  page = 1,
})

local task = app.integrations["freshworks-crm"].freshworks_crm_create_task({
  title = "Follow up",
  targetable_id = 123,
  targetable_type = "Contact",
})

local appointments = app.integrations["freshworks-crm"].freshworks_crm_list_appointments({
  filter = "upcoming",
})

local appointment = app.integrations["freshworks-crm"].freshworks_crm_create_appointment({
  title = "Discovery call",
  targetable_id = 123,
  targetable_type = "Contact",
})

Tasks and appointments each have matching get, update, and delete tools.

Notes, Calls, And Activities

local note = app.integrations["freshworks-crm"].freshworks_crm_create_note({
  description = "Buyer asked about implementation timeline.",
  targetable_id = 123,
  targetable_type = "Contact",
})

local call = app.integrations["freshworks-crm"].freshworks_crm_create_phone_call({
  targetable_id = 123,
  targetable_type = "Contact",
  phone_number = "+15550101010",
  direction = "outgoing",
})

local activities = app.integrations["freshworks-crm"].freshworks_crm_list_sales_activities({
  page = 1,
  per_page = 25,
})

local activity = app.integrations["freshworks-crm"].freshworks_crm_create_sales_activity({
  title = "Demo completed",
  targetable_id = 678,
  targetable_type = "Deal",
})

Notes and sales activities have matching get, update, and delete tools.

Search And Metadata

local me = app.integrations["freshworks-crm"].freshworks_crm_get_current_user({})

local results = app.integrations["freshworks-crm"].freshworks_crm_search({
  q = "Example Corp",
})

local lookup = app.integrations["freshworks-crm"].freshworks_crm_lookup({
  q = "ada@example.test",
})

local contact_fields = app.integrations["freshworks-crm"].freshworks_crm_list_contact_fields({})
local account_fields = app.integrations["freshworks-crm"].freshworks_crm_list_account_fields({})
local deal_fields = app.integrations["freshworks-crm"].freshworks_crm_list_deal_fields({})
local activity_fields = app.integrations["freshworks-crm"].freshworks_crm_list_sales_activity_fields({})

Multi-Account

Hosts can expose account-scoped namespaces. The functions are identical; only credentials differ.

app.integrations["freshworks-crm"].default.freshworks_crm_list_contacts({ page = 1 })
app.integrations["freshworks-crm"].eu_team.freshworks_crm_list_deals({ page = 1 })
Raw agent markdown
# Freshworks CRM Lua API Reference

Namespace: `freshworks-crm`

Freshworks CRM tools call Freshsales/Freshworks CRM REST endpoints under a base URL ending in `/crm/sales`, for example `https://example.myfreshworks.com/crm/sales`.

## Contacts

```lua
local contacts = app.integrations["freshworks-crm"].freshworks_crm_list_contacts({
  page = 1,
  per_page = 25,
})

local contact = app.integrations["freshworks-crm"].freshworks_crm_get_contact({ id = 123 })

local created = app.integrations["freshworks-crm"].freshworks_crm_create_contact({
  first_name = "Ada",
  last_name = "Example",
  email = "ada@example.test",
})

app.integrations["freshworks-crm"].freshworks_crm_update_contact({
  id = 123,
  job_title = "VP Sales",
})

app.integrations["freshworks-crm"].freshworks_crm_delete_contact({ id = 123 })
```

Contact filters and views:

```lua
local filters = app.integrations["freshworks-crm"].freshworks_crm_list_contact_filters({})

local view = app.integrations["freshworks-crm"].freshworks_crm_get_contact_view({
  view_id = 3,
  page = 1,
  per_page = 25,
})
```

## Sales Accounts And Deals

```lua
local accounts = app.integrations["freshworks-crm"].freshworks_crm_list_accounts({ page = 1 })

local account = app.integrations["freshworks-crm"].freshworks_crm_create_account({
  name = "Example Corp",
  website = "https://example.test",
})

local deals = app.integrations["freshworks-crm"].freshworks_crm_list_deals({
  page = 1,
  per_page = 25,
})

local deal = app.integrations["freshworks-crm"].freshworks_crm_create_deal({
  name = "Example Renewal",
  amount = 25000,
  sales_account_id = 456,
})
```

Accounts and deals each have matching `get`, `update`, `delete`, filter-list, view, and bulk-upsert tools where supported by Freshworks CRM.

## Tasks And Appointments

```lua
local tasks = app.integrations["freshworks-crm"].freshworks_crm_list_tasks({
  filter = "open",
  page = 1,
})

local task = app.integrations["freshworks-crm"].freshworks_crm_create_task({
  title = "Follow up",
  targetable_id = 123,
  targetable_type = "Contact",
})

local appointments = app.integrations["freshworks-crm"].freshworks_crm_list_appointments({
  filter = "upcoming",
})

local appointment = app.integrations["freshworks-crm"].freshworks_crm_create_appointment({
  title = "Discovery call",
  targetable_id = 123,
  targetable_type = "Contact",
})
```

Tasks and appointments each have matching `get`, `update`, and `delete` tools.

## Notes, Calls, And Activities

```lua
local note = app.integrations["freshworks-crm"].freshworks_crm_create_note({
  description = "Buyer asked about implementation timeline.",
  targetable_id = 123,
  targetable_type = "Contact",
})

local call = app.integrations["freshworks-crm"].freshworks_crm_create_phone_call({
  targetable_id = 123,
  targetable_type = "Contact",
  phone_number = "+15550101010",
  direction = "outgoing",
})

local activities = app.integrations["freshworks-crm"].freshworks_crm_list_sales_activities({
  page = 1,
  per_page = 25,
})

local activity = app.integrations["freshworks-crm"].freshworks_crm_create_sales_activity({
  title = "Demo completed",
  targetable_id = 678,
  targetable_type = "Deal",
})
```

Notes and sales activities have matching `get`, `update`, and `delete` tools.

## Search And Metadata

```lua
local me = app.integrations["freshworks-crm"].freshworks_crm_get_current_user({})

local results = app.integrations["freshworks-crm"].freshworks_crm_search({
  q = "Example Corp",
})

local lookup = app.integrations["freshworks-crm"].freshworks_crm_lookup({
  q = "ada@example.test",
})

local contact_fields = app.integrations["freshworks-crm"].freshworks_crm_list_contact_fields({})
local account_fields = app.integrations["freshworks-crm"].freshworks_crm_list_account_fields({})
local deal_fields = app.integrations["freshworks-crm"].freshworks_crm_list_deal_fields({})
local activity_fields = app.integrations["freshworks-crm"].freshworks_crm_list_sales_activity_fields({})
```

## Multi-Account

Hosts can expose account-scoped namespaces. The functions are identical; only credentials differ.

```lua
app.integrations["freshworks-crm"].default.freshworks_crm_list_contacts({ page = 1 })
app.integrations["freshworks-crm"].eu_team.freshworks_crm_list_deals({ page = 1 })
```
Metadata-derived Lua example
local result = app.integrations.freshworks_crm.list_contacts({page = 1, per_page = 1})
print(result)

Functions

list_contacts Read

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

Lua path
app.integrations.freshworks_crm.list_contacts
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).
get_contact Read

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

Lua path
app.integrations.freshworks_crm.get_contact
Full name
freshworks-crm.freshworks_crm_get_contact
ParameterTypeRequiredDescription
id integer yes The contact ID.
create_contact Write

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

Lua path
app.integrations.freshworks_crm.create_contact
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.
update_contact Write

Update a contact.

Lua path
app.integrations.freshworks_crm.update_contact
Full name
freshworks-crm.freshworks_crm_update_contact
ParameterTypeRequiredDescription
No parameters.
delete_contact Write

Delete a contact.

Lua path
app.integrations.freshworks_crm.delete_contact
Full name
freshworks-crm.freshworks_crm_delete_contact
ParameterTypeRequiredDescription
No parameters.
list_contact_filters Read

List contact filters.

Lua path
app.integrations.freshworks_crm.list_contact_filters
Full name
freshworks-crm.freshworks_crm_list_contact_filters
ParameterTypeRequiredDescription
No parameters.
get_contact_view Read

Fetch contacts from a view.

Lua path
app.integrations.freshworks_crm.get_contact_view
Full name
freshworks-crm.freshworks_crm_get_contact_view
ParameterTypeRequiredDescription
No parameters.
bulk_upsert_contacts Write

Bulk upsert contacts.

Lua path
app.integrations.freshworks_crm.bulk_upsert_contacts
Full name
freshworks-crm.freshworks_crm_bulk_upsert_contacts
ParameterTypeRequiredDescription
No parameters.
list_accounts Read

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

Lua path
app.integrations.freshworks_crm.list_accounts
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).
get_account Read

Get a sales account.

Lua path
app.integrations.freshworks_crm.get_account
Full name
freshworks-crm.freshworks_crm_get_account
ParameterTypeRequiredDescription
No parameters.
create_account Write

Create a sales account.

Lua path
app.integrations.freshworks_crm.create_account
Full name
freshworks-crm.freshworks_crm_create_account
ParameterTypeRequiredDescription
No parameters.
update_account Write

Update a sales account.

Lua path
app.integrations.freshworks_crm.update_account
Full name
freshworks-crm.freshworks_crm_update_account
ParameterTypeRequiredDescription
No parameters.
delete_account Write

Delete a sales account.

Lua path
app.integrations.freshworks_crm.delete_account
Full name
freshworks-crm.freshworks_crm_delete_account
ParameterTypeRequiredDescription
No parameters.
list_account_filters Read

List sales account filters.

Lua path
app.integrations.freshworks_crm.list_account_filters
Full name
freshworks-crm.freshworks_crm_list_account_filters
ParameterTypeRequiredDescription
No parameters.
bulk_upsert_accounts Write

Bulk upsert accounts.

Lua path
app.integrations.freshworks_crm.bulk_upsert_accounts
Full name
freshworks-crm.freshworks_crm_bulk_upsert_accounts
ParameterTypeRequiredDescription
No parameters.
list_deals Read

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

Lua path
app.integrations.freshworks_crm.list_deals
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).
get_deal Read

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

Lua path
app.integrations.freshworks_crm.get_deal
Full name
freshworks-crm.freshworks_crm_get_deal
ParameterTypeRequiredDescription
id integer yes The deal ID.
create_deal Write

Create a deal.

Lua path
app.integrations.freshworks_crm.create_deal
Full name
freshworks-crm.freshworks_crm_create_deal
ParameterTypeRequiredDescription
No parameters.
update_deal Write

Update a deal.

Lua path
app.integrations.freshworks_crm.update_deal
Full name
freshworks-crm.freshworks_crm_update_deal
ParameterTypeRequiredDescription
No parameters.
delete_deal Write

Delete a deal.

Lua path
app.integrations.freshworks_crm.delete_deal
Full name
freshworks-crm.freshworks_crm_delete_deal
ParameterTypeRequiredDescription
No parameters.
list_deal_filters Read

List deal filters.

Lua path
app.integrations.freshworks_crm.list_deal_filters
Full name
freshworks-crm.freshworks_crm_list_deal_filters
ParameterTypeRequiredDescription
No parameters.
get_deal_view Read

Fetch deals from a view.

Lua path
app.integrations.freshworks_crm.get_deal_view
Full name
freshworks-crm.freshworks_crm_get_deal_view
ParameterTypeRequiredDescription
No parameters.
bulk_upsert_deals Write

Bulk upsert deals.

Lua path
app.integrations.freshworks_crm.bulk_upsert_deals
Full name
freshworks-crm.freshworks_crm_bulk_upsert_deals
ParameterTypeRequiredDescription
No parameters.
list_tasks Read

List tasks.

Lua path
app.integrations.freshworks_crm.list_tasks
Full name
freshworks-crm.freshworks_crm_list_tasks
ParameterTypeRequiredDescription
No parameters.
get_task Read

Get a task.

Lua path
app.integrations.freshworks_crm.get_task
Full name
freshworks-crm.freshworks_crm_get_task
ParameterTypeRequiredDescription
No parameters.
create_task Write

Create a task.

Lua path
app.integrations.freshworks_crm.create_task
Full name
freshworks-crm.freshworks_crm_create_task
ParameterTypeRequiredDescription
No parameters.
update_task Write

Update a task.

Lua path
app.integrations.freshworks_crm.update_task
Full name
freshworks-crm.freshworks_crm_update_task
ParameterTypeRequiredDescription
No parameters.
delete_task Write

Delete a task.

Lua path
app.integrations.freshworks_crm.delete_task
Full name
freshworks-crm.freshworks_crm_delete_task
ParameterTypeRequiredDescription
No parameters.
list_appointments Read

List appointments.

Lua path
app.integrations.freshworks_crm.list_appointments
Full name
freshworks-crm.freshworks_crm_list_appointments
ParameterTypeRequiredDescription
No parameters.
get_appointment Read

Get an appointment.

Lua path
app.integrations.freshworks_crm.get_appointment
Full name
freshworks-crm.freshworks_crm_get_appointment
ParameterTypeRequiredDescription
No parameters.
create_appointment Write

Create an appointment.

Lua path
app.integrations.freshworks_crm.create_appointment
Full name
freshworks-crm.freshworks_crm_create_appointment
ParameterTypeRequiredDescription
No parameters.
update_appointment Write

Update an appointment.

Lua path
app.integrations.freshworks_crm.update_appointment
Full name
freshworks-crm.freshworks_crm_update_appointment
ParameterTypeRequiredDescription
No parameters.
delete_appointment Write

Delete an appointment.

Lua path
app.integrations.freshworks_crm.delete_appointment
Full name
freshworks-crm.freshworks_crm_delete_appointment
ParameterTypeRequiredDescription
No parameters.
create_note Write

Create a note.

Lua path
app.integrations.freshworks_crm.create_note
Full name
freshworks-crm.freshworks_crm_create_note
ParameterTypeRequiredDescription
No parameters.
get_note Read

Get a note.

Lua path
app.integrations.freshworks_crm.get_note
Full name
freshworks-crm.freshworks_crm_get_note
ParameterTypeRequiredDescription
No parameters.
update_note Write

Update a note.

Lua path
app.integrations.freshworks_crm.update_note
Full name
freshworks-crm.freshworks_crm_update_note
ParameterTypeRequiredDescription
No parameters.
delete_note Write

Delete a note.

Lua path
app.integrations.freshworks_crm.delete_note
Full name
freshworks-crm.freshworks_crm_delete_note
ParameterTypeRequiredDescription
No parameters.
create_phone_call Write

Create a manual phone call log.

Lua path
app.integrations.freshworks_crm.create_phone_call
Full name
freshworks-crm.freshworks_crm_create_phone_call
ParameterTypeRequiredDescription
No parameters.
list_sales_activities Read

List sales activities.

Lua path
app.integrations.freshworks_crm.list_sales_activities
Full name
freshworks-crm.freshworks_crm_list_sales_activities
ParameterTypeRequiredDescription
No parameters.
get_sales_activity Read

Get a sales activity.

Lua path
app.integrations.freshworks_crm.get_sales_activity
Full name
freshworks-crm.freshworks_crm_get_sales_activity
ParameterTypeRequiredDescription
No parameters.
create_sales_activity Write

Create a sales activity.

Lua path
app.integrations.freshworks_crm.create_sales_activity
Full name
freshworks-crm.freshworks_crm_create_sales_activity
ParameterTypeRequiredDescription
No parameters.
update_sales_activity Write

Update a sales activity.

Lua path
app.integrations.freshworks_crm.update_sales_activity
Full name
freshworks-crm.freshworks_crm_update_sales_activity
ParameterTypeRequiredDescription
No parameters.
delete_sales_activity Write

Delete a sales activity.

Lua path
app.integrations.freshworks_crm.delete_sales_activity
Full name
freshworks-crm.freshworks_crm_delete_sales_activity
ParameterTypeRequiredDescription
No parameters.
get_current_user Read

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

Lua path
app.integrations.freshworks_crm.get_current_user
Full name
freshworks-crm.freshworks_crm_get_current_user
ParameterTypeRequiredDescription
No parameters.
lookup Read

Run lookup search.

Lua path
app.integrations.freshworks_crm.lookup
Full name
freshworks-crm.freshworks_crm_lookup
ParameterTypeRequiredDescription
No parameters.
filtered_search_contact Read

Run filtered contact search.

Lua path
app.integrations.freshworks_crm.filtered_search_contact
Full name
freshworks-crm.freshworks_crm_filtered_search_contact
ParameterTypeRequiredDescription
No parameters.
list_contact_fields Read

List contact fields.

Lua path
app.integrations.freshworks_crm.list_contact_fields
Full name
freshworks-crm.freshworks_crm_list_contact_fields
ParameterTypeRequiredDescription
No parameters.
list_account_fields Read

List account fields.

Lua path
app.integrations.freshworks_crm.list_account_fields
Full name
freshworks-crm.freshworks_crm_list_account_fields
ParameterTypeRequiredDescription
No parameters.
list_deal_fields Read

List deal fields.

Lua path
app.integrations.freshworks_crm.list_deal_fields
Full name
freshworks-crm.freshworks_crm_list_deal_fields
ParameterTypeRequiredDescription
No parameters.
list_sales_activity_fields Read

List sales activity fields.

Lua path
app.integrations.freshworks_crm.list_sales_activity_fields
Full name
freshworks-crm.freshworks_crm_list_sales_activity_fields
ParameterTypeRequiredDescription
No parameters.