analytics
Delighted Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Delighted KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.delighted.*.
Use lua_read_doc("integrations.delighted") 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
Delighted workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.delighted.send_person_survey({}))' --json kosmo integrations:lua --eval 'print(docs.read("delighted"))' --json
kosmo integrations:lua --eval 'print(docs.read("delighted.send_person_survey"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local delighted = app.integrations.delighted
local result = delighted.send_person_survey({})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.delighted, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.delighted.default.* or app.integrations.delighted.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Delighted, use the narrower 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.
Delighted
Use the delighted namespace to manage Delighted CX survey workflows: sending surveys, reading responses, retrieving metrics, managing people, unsubscribes, bounces, and Autopilot memberships.
Authentication uses Basic auth with the private Delighted API key as the username and an empty password. Agents should not pass the API key manually.
Common workflows
- Use
delighted_send_personwithemailto create/update a person and schedule a survey. - Use
delighted_list_survey_responseswith pagination and date filters to export feedback. - Use
delighted_get_metricsfor NPS and response breakdowns. - Use
delighted_create_survey_responsewhen a score/comment was collected outside Delighted. - Use
delighted_delete_pending_survey_requestbefore rescheduling or cancelling a queued survey request. - Use
delighted_unsubscribe_person,delighted_list_unsubscribes, anddelighted_list_bouncesto keep contact eligibility clean. - Use the email and SMS Autopilot membership tools to add, list, or remove people from recurring surveys.
Examples
delighted_send_person({
email = "[email protected]",
payload = {
name = "Example Customer",
properties = {
plan = "pro"
}
}
})
delighted_list_survey_responses({
payload = {
since = 1777833600,
per_page = 100
}
})
delighted_delete_person({
person_identifier = "email:[email protected]"
})
The raw delighted_api_get, delighted_api_post, and delighted_api_delete tools only accept relative paths such as /v1/metrics.json; full URLs are rejected.
Raw agent markdown
# Delighted
Use the `delighted` namespace to manage Delighted CX survey workflows: sending surveys, reading responses, retrieving metrics, managing people, unsubscribes, bounces, and Autopilot memberships.
Authentication uses Basic auth with the private Delighted API key as the username and an empty password. Agents should not pass the API key manually.
## Common workflows
- Use `delighted_send_person` with `email` to create/update a person and schedule a survey.
- Use `delighted_list_survey_responses` with pagination and date filters to export feedback.
- Use `delighted_get_metrics` for NPS and response breakdowns.
- Use `delighted_create_survey_response` when a score/comment was collected outside Delighted.
- Use `delighted_delete_pending_survey_request` before rescheduling or cancelling a queued survey request.
- Use `delighted_unsubscribe_person`, `delighted_list_unsubscribes`, and `delighted_list_bounces` to keep contact eligibility clean.
- Use the email and SMS Autopilot membership tools to add, list, or remove people from recurring surveys.
## Examples
```lua
delighted_send_person({
email = "[email protected]",
payload = {
name = "Example Customer",
properties = {
plan = "pro"
}
}
})
```
```lua
delighted_list_survey_responses({
payload = {
since = 1777833600,
per_page = 100
}
})
```
```lua
delighted_delete_person({
person_identifier = "email:[email protected]"
})
```
The raw `delighted_api_get`, `delighted_api_post`, and `delighted_api_delete` tools only accept relative paths such as `/v1/metrics.json`; full URLs are rejected. local result = app.integrations.delighted.send_person_survey({})
print(result) Functions
send_person_survey Write
Create or update a person and schedule a survey.
- Lua path
app.integrations.delighted.send_person_survey- Full name
delighted.delighted_send_person
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_survey_responses Read
List survey responses.
- Lua path
app.integrations.delighted.list_survey_responses- Full name
delighted.delighted_list_survey_responses
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_metrics Read
Get account metrics and score breakdowns.
- Lua path
app.integrations.delighted.get_metrics- Full name
delighted.delighted_get_metrics
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
create_survey_response Write
Add a survey response manually.
- Lua path
app.integrations.delighted.create_survey_response- Full name
delighted.delighted_create_survey_response
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
delete_pending_survey_request Write
Delete pending survey requests for a person.
- Lua path
app.integrations.delighted.delete_pending_survey_request- Full name
delighted.delighted_delete_pending_survey_request
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
unsubscribe_person Write
Unsubscribe a person.
- Lua path
app.integrations.delighted.unsubscribe_person- Full name
delighted.delighted_unsubscribe_person
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_people Read
List people.
- Lua path
app.integrations.delighted.list_people- Full name
delighted.delighted_list_people
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_unsubscribes Read
List unsubscribed people.
- Lua path
app.integrations.delighted.list_unsubscribes- Full name
delighted.delighted_list_unsubscribes
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_bounces Read
List bounced people.
- Lua path
app.integrations.delighted.list_bounces- Full name
delighted.delighted_list_bounces
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
delete_person Write
Delete a person by identifier.
- Lua path
app.integrations.delighted.delete_person- Full name
delighted.delighted_delete_person
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_email_autopilot Read
Get email Autopilot configuration.
- Lua path
app.integrations.delighted.get_email_autopilot- Full name
delighted.delighted_get_autopilot_email
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_sms_autopilot Read
Get SMS Autopilot configuration.
- Lua path
app.integrations.delighted.get_sms_autopilot- Full name
delighted.delighted_get_autopilot_sms
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_email_autopilot_memberships Read
List people in email Autopilot.
- Lua path
app.integrations.delighted.list_email_autopilot_memberships- Full name
delighted.delighted_list_autopilot_email_memberships
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_sms_autopilot_memberships Read
List people in SMS Autopilot.
- Lua path
app.integrations.delighted.list_sms_autopilot_memberships- Full name
delighted.delighted_list_autopilot_sms_memberships
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
add_email_autopilot_membership Write
Add a person to email Autopilot.
- Lua path
app.integrations.delighted.add_email_autopilot_membership- Full name
delighted.delighted_add_autopilot_email_membership
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
add_sms_autopilot_membership Write
Add a person to SMS Autopilot.
- Lua path
app.integrations.delighted.add_sms_autopilot_membership- Full name
delighted.delighted_add_autopilot_sms_membership
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
remove_email_autopilot_membership Write
Remove a person from email Autopilot.
- Lua path
app.integrations.delighted.remove_email_autopilot_membership- Full name
delighted.delighted_remove_autopilot_email_membership
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
remove_sms_autopilot_membership Write
Remove a person from SMS Autopilot.
- Lua path
app.integrations.delighted.remove_sms_autopilot_membership- Full name
delighted.delighted_remove_autopilot_sms_membership
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
api_get Read
Call a safe relative Delighted GET path.
- Lua path
app.integrations.delighted.api_get- Full name
delighted.delighted_api_get
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
api_post Write
Call a safe relative Delighted POST path.
- Lua path
app.integrations.delighted.api_post- Full name
delighted.delighted_api_post
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
api_delete Write
Call a safe relative Delighted DELETE path.
- Lua path
app.integrations.delighted.api_delete- Full name
delighted.delighted_api_delete
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||