productivity
Novu Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Novu KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.novu.*.
Use lua_read_doc("integrations.novu") 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
Novu workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.novu.list_notifications({page = 1, limit = 1, channel = "example_channel"}))' --json kosmo integrations:lua --eval 'print(docs.read("novu"))' --json
kosmo integrations:lua --eval 'print(docs.read("novu.list_notifications"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local novu = app.integrations.novu
local result = novu.list_notifications({page = 1, limit = 1, channel = "example_channel"})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.novu, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.novu.default.* or app.integrations.novu.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Novu, 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.
Novu — Lua API Reference
list_notifications
List notifications from Novu with optional filtering.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number (1-based, default: 1) |
limit | integer | no | Items per page (default: 10, max: 100) |
channel | string | no | Filter by channel: in_app, email, sms, chat, push |
Examples
-- List recent notifications
local result = app.integrations.novu.list_notifications({
page = 1,
limit = 20
})
-- Filter by email channel
local result = app.integrations.novu.list_notifications({
channel = "email",
limit = 50
})
get_notification
Get details of a specific notification.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | The notification ID |
Example
local result = app.integrations.novu.get_notification({
id = "notification-id-here"
})
list_subscribers
List all notification subscribers.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number (0-based, default: 0) |
limit | integer | no | Items per page (default: 10, max: 100) |
Example
local result = app.integrations.novu.list_subscribers({
page = 0,
limit = 50
})
for _, subscriber in ipairs(result.data) do
print(subscriber.email)
end
get_subscriber
Get details of a specific subscriber.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | The subscriber ID |
Example
local result = app.integrations.novu.get_subscriber({
id = "subscriber-id-here"
})
print(result.email)
print(result.first_name)
create_subscriber
Create a new notification subscriber.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
email | string | yes | Email address |
firstName | string | no | First name |
lastName | string | no | Last name |
phone | string | no | Phone number (e.g., “+1234567890”) |
Example
local result = app.integrations.novu.create_subscriber({
email = "john@example.com",
firstName = "John",
lastName = "Doe",
phone = "+1234567890"
})
print("Created subscriber: " .. result.id)
trigger_event
Trigger a notification event to one or more subscribers.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | yes | Workflow trigger key / template name |
to | string | yes | Subscriber ID, email, or JSON array of recipients |
payload | object | no | Key-value template variables |
Examples
-- Trigger to a single subscriber by email
local result = app.integrations.novu.trigger_event({
name = "onboarding-welcome",
to = "john@example.com",
payload = { name = "John", plan = "Pro" }
})
-- Trigger to a single subscriber by ID
local result = app.integrations.novu.trigger_event({
name = "order-confirmation",
to = "subscriber-id-here",
payload = { orderNumber = "ORD-123", total = "$99.00" }
})
-- Trigger to multiple recipients
local result = app.integrations.novu.trigger_event({
name = "team-update",
to = '["alice@example.com", "bob@example.com"]',
payload = { message = "Sprint review tomorrow at 3pm" }
})
get_current_user
Get the currently authenticated Novu user.
Parameters
None.
Example
local result = app.integrations.novu.get_current_user({})
print("Logged in as: " .. result.email)
print("Organization: " .. result.organization.name)
Multi-Account Usage
If you have multiple Novu accounts configured, use account-specific namespaces:
-- Default account (always works)
app.integrations.novu.function_name({...})
-- Explicit default (portable across setups)
app.integrations.novu.default.function_name({...})
-- Named accounts
app.integrations.novu.production.function_name({...})
app.integrations.novu.staging.function_name({...})
All functions are identical across accounts — only the credentials differ.
Raw agent markdown
# Novu — Lua API Reference
## list_notifications
List notifications from Novu with optional filtering.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (1-based, default: 1) |
| `limit` | integer | no | Items per page (default: 10, max: 100) |
| `channel` | string | no | Filter by channel: `in_app`, `email`, `sms`, `chat`, `push` |
### Examples
```lua
-- List recent notifications
local result = app.integrations.novu.list_notifications({
page = 1,
limit = 20
})
-- Filter by email channel
local result = app.integrations.novu.list_notifications({
channel = "email",
limit = 50
})
```
---
## get_notification
Get details of a specific notification.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The notification ID |
### Example
```lua
local result = app.integrations.novu.get_notification({
id = "notification-id-here"
})
```
---
## list_subscribers
List all notification subscribers.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (0-based, default: 0) |
| `limit` | integer | no | Items per page (default: 10, max: 100) |
### Example
```lua
local result = app.integrations.novu.list_subscribers({
page = 0,
limit = 50
})
for _, subscriber in ipairs(result.data) do
print(subscriber.email)
end
```
---
## get_subscriber
Get details of a specific subscriber.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The subscriber ID |
### Example
```lua
local result = app.integrations.novu.get_subscriber({
id = "subscriber-id-here"
})
print(result.email)
print(result.first_name)
```
---
## create_subscriber
Create a new notification subscriber.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `email` | string | yes | Email address |
| `firstName` | string | no | First name |
| `lastName` | string | no | Last name |
| `phone` | string | no | Phone number (e.g., "+1234567890") |
### Example
```lua
local result = app.integrations.novu.create_subscriber({
email = "john@example.com",
firstName = "John",
lastName = "Doe",
phone = "+1234567890"
})
print("Created subscriber: " .. result.id)
```
---
## trigger_event
Trigger a notification event to one or more subscribers.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | Workflow trigger key / template name |
| `to` | string | yes | Subscriber ID, email, or JSON array of recipients |
| `payload` | object | no | Key-value template variables |
### Examples
```lua
-- Trigger to a single subscriber by email
local result = app.integrations.novu.trigger_event({
name = "onboarding-welcome",
to = "john@example.com",
payload = { name = "John", plan = "Pro" }
})
-- Trigger to a single subscriber by ID
local result = app.integrations.novu.trigger_event({
name = "order-confirmation",
to = "subscriber-id-here",
payload = { orderNumber = "ORD-123", total = "$99.00" }
})
-- Trigger to multiple recipients
local result = app.integrations.novu.trigger_event({
name = "team-update",
to = '["alice@example.com", "bob@example.com"]',
payload = { message = "Sprint review tomorrow at 3pm" }
})
```
---
## get_current_user
Get the currently authenticated Novu user.
### Parameters
None.
### Example
```lua
local result = app.integrations.novu.get_current_user({})
print("Logged in as: " .. result.email)
print("Organization: " .. result.organization.name)
```
---
## Multi-Account Usage
If you have multiple Novu accounts configured, use account-specific namespaces:
```lua
-- Default account (always works)
app.integrations.novu.function_name({...})
-- Explicit default (portable across setups)
app.integrations.novu.default.function_name({...})
-- Named accounts
app.integrations.novu.production.function_name({...})
app.integrations.novu.staging.function_name({...})
```
All functions are identical across accounts — only the credentials differ. local result = app.integrations.novu.list_notifications({page = 1, limit = 1, channel = "example_channel"})
print(result) Functions
list_notifications Read
List notifications from Novu. Returns a paginated list of notifications, optionally filtered by channel (e.g., in_app, email, sms, chat, push).
- Lua path
app.integrations.novu.list_notifications- Full name
novu.novu_list_notifications
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number for pagination (1-based, default: 1). |
limit | integer | no | Number of notifications per page (default: 10, max: 100). |
channel | string | no | Filter by notification channel. Options: in_app, email, sms, chat, push. |
get_notification Read
Get details of a specific notification in Novu by its ID. Returns the full notification object including status, channel data, and content.
- Lua path
app.integrations.novu.get_notification- Full name
novu.novu_get_notification
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | The notification ID. |
list_subscribers Read
List subscribers from Novu. Returns a paginated list of all notification subscribers with their details.
- Lua path
app.integrations.novu.list_subscribers- Full name
novu.novu_list_subscribers
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number for pagination (0-based, default: 0). |
limit | integer | no | Number of subscribers per page (default: 10, max: 100). |
get_subscriber Read
Get details of a specific subscriber in Novu by their ID. Returns the subscriber profile including email, phone, and preferences.
- Lua path
app.integrations.novu.get_subscriber- Full name
novu.novu_get_subscriber
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | The subscriber ID. |
create_subscriber Write
Create a new subscriber in Novu. Requires an email address. Optionally include first name, last name, and phone number.
- Lua path
app.integrations.novu.create_subscriber- Full name
novu.novu_create_subscriber
| Parameter | Type | Required | Description |
|---|---|---|---|
email | string | yes | The subscriber's email address. |
firstName | string | no | The subscriber's first name. |
lastName | string | no | The subscriber's last name. |
phone | string | no | The subscriber's phone number (e.g., "+1234567890"). |
trigger_event Write
Trigger a notification event in Novu. Sends a notification based on a workflow template to one or more subscribers. The "to" field can be a subscriber ID, email address, or an array of recipients.
- Lua path
app.integrations.novu.trigger_event- Full name
novu.novu_trigger_event
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | The workflow trigger key / template name (e.g., "onboarding-welcome"). |
to | string | yes | Recipient — a subscriber ID, email address, or JSON-encoded array of recipient identifiers. |
payload | object | no | Key-value pairs to pass as template variables (e.g., {"name": "John", "plan": "Pro"}). |
get_current_user Read
Get the currently authenticated Novu user. Returns user profile information including name, email, and organization details.
- Lua path
app.integrations.novu.get_current_user- Full name
novu.novu_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||