KosmoKrator

sales

Gainsight Lua API for KosmoKrator Agents

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

7 functions 7 read 0 write Manual OAuth token auth

Lua Namespace

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

Gainsight — Lua API Reference

list_companies

List companies from Gainsight.

Parameters

NameTypeRequiredDescription
pageintegernoPage number for pagination (starting from 1)
limitintegernoMaximum number of companies to return (default: 50)
searchstringnoSearch term to filter companies by name

Response

Returns an object with:

FieldTypeDescription
companiesarrayArray of company objects
countintegerNumber of companies returned
totalRecordsintegerTotal matching records (if available)

Example

local result = app.integrations.gainsight.list_companies({
  search = "Acme"
})

for _, company in ipairs(result.companies) do
  print(company.name .. " — Health: " .. company.healthScore)
end

get_company

Get detailed information about a specific company.

Parameters

NameTypeRequiredDescription
companyIdstringyesThe unique company identifier

Example

local result = app.integrations.gainsight.get_company({
  companyId = "1A2B3C4D"
})

print("Company: " .. result.name)
print("ARR: " .. result.arr)
print("Health Score: " .. result.healthScore)
print("Lifecycle Stage: " .. result.lifecycleStage)

list_users

List users in the Gainsight tenant.

Parameters

NameTypeRequiredDescription
pageintegernoPage number for pagination (starting from 1)
limitintegernoMaximum number of users to return (default: 50)
rolestringnoFilter users by role (e.g., “Admin”, “CSM”, “Manager”)

Response

Returns an object with:

FieldTypeDescription
usersarrayArray of user objects
countintegerNumber of users returned
totalRecordsintegerTotal matching records (if available)

Example

local result = app.integrations.gainsight.list_users({
  role = "CSM"
})

for _, user in ipairs(result.users) do
  print(user.name .. " — " .. user.email .. " — " .. user.role)
end

get_user

Get detailed information about a specific user.

Parameters

NameTypeRequiredDescription
userIdstringyesThe unique user identifier

Example

local result = app.integrations.gainsight.get_user({
  userId = "5E6F7G8H"
})

print("Name: " .. result.name)
print("Email: " .. result.email)
print("Role: " .. result.role)

list_surveys

List surveys from Gainsight.

Parameters

NameTypeRequiredDescription
pageintegernoPage number for pagination (starting from 1)
limitintegernoMaximum number of surveys to return (default: 50)
statusstringnoFilter surveys by status (e.g., “active”, “draft”, “closed”)

Response

Returns an object with:

FieldTypeDescription
surveysarrayArray of survey objects
countintegerNumber of surveys returned
totalRecordsintegerTotal matching records (if available)

Example

local result = app.integrations.gainsight.list_surveys({
  status = "active"
})

for _, survey in ipairs(result.surveys) do
  print(survey.name .. " — Responses: " .. survey.responseCount)
end

get_survey

Get detailed information about a specific survey.

Parameters

NameTypeRequiredDescription
surveyIdstringyesThe unique survey identifier

Example

local result = app.integrations.gainsight.get_survey({
  surveyId = "9I0J1K2L"
})

print("Survey: " .. result.name)
print("Type: " .. result.type)
print("Status: " .. result.status)
print("Responses: " .. result.responseCount)

get_current_user

Get the currently authenticated Gainsight user profile.

Parameters

None.

Example

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

print("Logged in as: " .. result.name)
print("Email: " .. result.email)
print("Role: " .. result.role)

Multi-Account Usage

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

-- Default account (always works)
app.integrations.gainsight.list_companies({})

-- Explicit default (portable across setups)
app.integrations.gainsight.default.list_companies({})

-- Named accounts
app.integrations.gainsight.us_tenant.list_companies({})
app.integrations.gainsight.eu_tenant.list_companies({})

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

Raw agent markdown
# Gainsight — Lua API Reference

## list_companies

List companies from Gainsight.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number for pagination (starting from 1) |
| `limit` | integer | no | Maximum number of companies to return (default: 50) |
| `search` | string | no | Search term to filter companies by name |

### Response

Returns an object with:

| Field | Type | Description |
|-------|------|-------------|
| `companies` | array | Array of company objects |
| `count` | integer | Number of companies returned |
| `totalRecords` | integer | Total matching records (if available) |

### Example

```lua
local result = app.integrations.gainsight.list_companies({
  search = "Acme"
})

for _, company in ipairs(result.companies) do
  print(company.name .. " — Health: " .. company.healthScore)
end
```

---

## get_company

Get detailed information about a specific company.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `companyId` | string | yes | The unique company identifier |

### Example

```lua
local result = app.integrations.gainsight.get_company({
  companyId = "1A2B3C4D"
})

print("Company: " .. result.name)
print("ARR: " .. result.arr)
print("Health Score: " .. result.healthScore)
print("Lifecycle Stage: " .. result.lifecycleStage)
```

---

## list_users

List users in the Gainsight tenant.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number for pagination (starting from 1) |
| `limit` | integer | no | Maximum number of users to return (default: 50) |
| `role` | string | no | Filter users by role (e.g., "Admin", "CSM", "Manager") |

### Response

Returns an object with:

| Field | Type | Description |
|-------|------|-------------|
| `users` | array | Array of user objects |
| `count` | integer | Number of users returned |
| `totalRecords` | integer | Total matching records (if available) |

### Example

```lua
local result = app.integrations.gainsight.list_users({
  role = "CSM"
})

for _, user in ipairs(result.users) do
  print(user.name .. " — " .. user.email .. " — " .. user.role)
end
```

---

## get_user

Get detailed information about a specific user.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `userId` | string | yes | The unique user identifier |

### Example

```lua
local result = app.integrations.gainsight.get_user({
  userId = "5E6F7G8H"
})

print("Name: " .. result.name)
print("Email: " .. result.email)
print("Role: " .. result.role)
```

---

## list_surveys

List surveys from Gainsight.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number for pagination (starting from 1) |
| `limit` | integer | no | Maximum number of surveys to return (default: 50) |
| `status` | string | no | Filter surveys by status (e.g., "active", "draft", "closed") |

### Response

Returns an object with:

| Field | Type | Description |
|-------|------|-------------|
| `surveys` | array | Array of survey objects |
| `count` | integer | Number of surveys returned |
| `totalRecords` | integer | Total matching records (if available) |

### Example

```lua
local result = app.integrations.gainsight.list_surveys({
  status = "active"
})

for _, survey in ipairs(result.surveys) do
  print(survey.name .. " — Responses: " .. survey.responseCount)
end
```

---

## get_survey

Get detailed information about a specific survey.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `surveyId` | string | yes | The unique survey identifier |

### Example

```lua
local result = app.integrations.gainsight.get_survey({
  surveyId = "9I0J1K2L"
})

print("Survey: " .. result.name)
print("Type: " .. result.type)
print("Status: " .. result.status)
print("Responses: " .. result.responseCount)
```

---

## get_current_user

Get the currently authenticated Gainsight user profile.

### Parameters

None.

### Example

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

print("Logged in as: " .. result.name)
print("Email: " .. result.email)
print("Role: " .. result.role)
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.gainsight.list_companies({})

-- Explicit default (portable across setups)
app.integrations.gainsight.default.list_companies({})

-- Named accounts
app.integrations.gainsight.us_tenant.list_companies({})
app.integrations.gainsight.eu_tenant.list_companies({})
```

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

Metadata-Derived Lua Example

local result = app.integrations.gainsight.gainsight_list_companies({
  page = 1,
  limit = 1,
  search = "example_search"
})
print(result)

Functions

gainsight_list_companies

List companies from Gainsight. Returns company details including name, industry, ARR, health score, and lifecycle stage.

Operation
Read read
Full name
gainsight.gainsight_list_companies
ParameterTypeRequiredDescription
page integer no Page number for pagination (starting from 1).
limit integer no Maximum number of companies to return (default: 50).
search string no Search term to filter companies by name.

gainsight_get_company

Get detailed information about a specific company in Gainsight, including health score, ARR, lifecycle stage, and CSM assignment.

Operation
Read read
Full name
gainsight.gainsight_get_company
ParameterTypeRequiredDescription
companyId string yes The unique company identifier (Gainsight Company ID).

gainsight_list_users

List users in the Gainsight tenant. Returns user details including name, email, role, and last active date.

Operation
Read read
Full name
gainsight.gainsight_list_users
ParameterTypeRequiredDescription
page integer no Page number for pagination (starting from 1).
limit integer no Maximum number of users to return (default: 50).
role string no Filter users by role (e.g., "Admin", "CSM", "Manager").

gainsight_get_user

Get detailed information about a specific user in Gainsight, including role, assigned accounts, and activity data.

Operation
Read read
Full name
gainsight.gainsight_get_user
ParameterTypeRequiredDescription
userId string yes The unique user identifier (Gainsight User ID).

gainsight_list_surveys

List surveys from Gainsight. Returns survey details including name, type, status, response count, and creation date.

Operation
Read read
Full name
gainsight.gainsight_list_surveys
ParameterTypeRequiredDescription
page integer no Page number for pagination (starting from 1).
limit integer no Maximum number of surveys to return (default: 50).
status string no Filter surveys by status (e.g., "active", "draft", "closed").

gainsight_get_survey

Get detailed information about a specific survey in Gainsight, including questions, response statistics, and distribution settings.

Operation
Read read
Full name
gainsight.gainsight_get_survey
ParameterTypeRequiredDescription
surveyId string yes The unique survey identifier (Gainsight Survey ID).

gainsight_get_current_user

Get the currently authenticated Gainsight user profile. Useful for verifying credentials and understanding whose data is being accessed.

Operation
Read read
Full name
gainsight.gainsight_get_current_user
ParameterTypeRequiredDescription
No parameters.