KosmoKrator

email

Vero Lua API for KosmoKrator Agents

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

6 functions 5 read 1 write API token auth

Lua Namespace

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

Vero — Lua API Reference

identify_user

Identify (create or update) a user in Vero with email, name, and custom attributes.

Parameters

NameTypeRequiredDescription
idstringyesUnique user identifier (e.g., database ID or UUID)
emailstringyesUser email address
namestringnoDisplay name for the user
dataobjectnoCustom user attributes as key-value pairs

Example

app.integrations.vero.identify_user({
  id = "usr_123",
  email = "[email protected]",
  name = "John Doe",
  data = {
    plan = "premium",
    signup_date = "2025-01-15",
    company = "Acme Inc"
  }
})

track_event

Track a behavioral event for a user. Events can trigger automated email campaigns in Vero.

Parameters

NameTypeRequiredDescription
identitystringyesUser ID or email address identifying the user
event_namestringyesName of the event (e.g., “Logged in”, “Purchased”)
dataobjectnoEvent-specific data as key-value pairs

Example

app.integrations.vero.track_event({
  identity = "usr_123",
  event_name = "Purchased",
  data = {
    product = "Widget",
    price = 29.99,
    currency = "USD"
  }
})

update_user

Update a user’s email address and/or custom attributes in Vero.

Parameters

NameTypeRequiredDescription
idstringyesUnique user identifier to update
emailstringnoNew email address for the user
dataobjectnoAttributes to update as key-value pairs

Example

app.integrations.vero.update_user({
  id = "usr_123",
  email = "[email protected]",
  data = {
    plan = "enterprise",
    company = "Big Corp"
  }
})

unsubscribe

Unsubscribe a user from all Vero email campaigns.

Parameters

NameTypeRequiredDescription
idstringyesUnique user identifier to unsubscribe

Example

app.integrations.vero.unsubscribe({
  id = "usr_123"
})

resubscribe

Resubscribe a previously unsubscribed user to Vero email campaigns.

Parameters

NameTypeRequiredDescription
idstringyesUnique user identifier to resubscribe

Example

app.integrations.vero.resubscribe({
  id = "usr_123"
})

get_current_user

Get the profile of the currently authenticated Vero user. Useful for verifying API connectivity.

Parameters

None.

Example

local user = app.integrations.vero.get_current_user({})
print("Account: " .. (user.email or "unknown"))

Common Workflows

Onboard a new user and trigger welcome email

-- Step 1: Identify the user
app.integrations.vero.identify_user({
  id = "usr_456",
  email = "[email protected]",
  name = "Jane Smith",
  data = {
    plan = "free",
    signup_date = "2025-06-15"
  }
})

-- Step 2: Track the signup event (triggers welcome campaign)
app.integrations.vero.track_event({
  identity = "usr_456",
  event_name = "Signed up",
  data = {
    source = "landing_page",
    plan = "free"
  }
})

Upgrade a user’s plan

-- Update user attributes
app.integrations.vero.update_user({
  id = "usr_456",
  data = {
    plan = "premium",
    upgraded_at = "2025-07-01"
  }
})

-- Track the upgrade event
app.integrations.vero.track_event({
  identity = "usr_456",
  event_name = "Upgraded plan",
  data = {
    from_plan = "free",
    to_plan = "premium"
  }
})

Handle a user leaving

-- Track churn event
app.integrations.vero.track_event({
  identity = "usr_456",
  event_name = "Cancelled subscription",
  data = {
    reason = "too_expensive",
    last_plan = "premium"
  }
})

-- Unsubscribe from emails
app.integrations.vero.unsubscribe({
  id = "usr_456"
})

Multi-Account Usage

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

-- Default account (always works)
app.integrations.vero.identify_user({id = "1", email = "[email protected]"})

-- Explicit default (portable across setups)
app.integrations.vero.default.identify_user({id = "1", email = "[email protected]"})

-- Named accounts
app.integrations.vero.marketing.identify_user({id = "1", email = "[email protected]"})
app.integrations.vero.transactional.track_event({identity = "1", event_name = "Order shipped"})

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

Raw agent markdown
# Vero — Lua API Reference

## identify_user

Identify (create or update) a user in Vero with email, name, and custom attributes.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | Unique user identifier (e.g., database ID or UUID) |
| `email` | string | yes | User email address |
| `name` | string | no | Display name for the user |
| `data` | object | no | Custom user attributes as key-value pairs |

### Example

```lua
app.integrations.vero.identify_user({
  id = "usr_123",
  email = "[email protected]",
  name = "John Doe",
  data = {
    plan = "premium",
    signup_date = "2025-01-15",
    company = "Acme Inc"
  }
})
```

---

## track_event

Track a behavioral event for a user. Events can trigger automated email campaigns in Vero.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `identity` | string | yes | User ID or email address identifying the user |
| `event_name` | string | yes | Name of the event (e.g., "Logged in", "Purchased") |
| `data` | object | no | Event-specific data as key-value pairs |

### Example

```lua
app.integrations.vero.track_event({
  identity = "usr_123",
  event_name = "Purchased",
  data = {
    product = "Widget",
    price = 29.99,
    currency = "USD"
  }
})
```

---

## update_user

Update a user's email address and/or custom attributes in Vero.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | Unique user identifier to update |
| `email` | string | no | New email address for the user |
| `data` | object | no | Attributes to update as key-value pairs |

### Example

```lua
app.integrations.vero.update_user({
  id = "usr_123",
  email = "[email protected]",
  data = {
    plan = "enterprise",
    company = "Big Corp"
  }
})
```

---

## unsubscribe

Unsubscribe a user from all Vero email campaigns.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | Unique user identifier to unsubscribe |

### Example

```lua
app.integrations.vero.unsubscribe({
  id = "usr_123"
})
```

---

## resubscribe

Resubscribe a previously unsubscribed user to Vero email campaigns.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | Unique user identifier to resubscribe |

### Example

```lua
app.integrations.vero.resubscribe({
  id = "usr_123"
})
```

---

## get_current_user

Get the profile of the currently authenticated Vero user. Useful for verifying API connectivity.

### Parameters

None.

### Example

```lua
local user = app.integrations.vero.get_current_user({})
print("Account: " .. (user.email or "unknown"))
```

---

## Common Workflows

### Onboard a new user and trigger welcome email

```lua
-- Step 1: Identify the user
app.integrations.vero.identify_user({
  id = "usr_456",
  email = "[email protected]",
  name = "Jane Smith",
  data = {
    plan = "free",
    signup_date = "2025-06-15"
  }
})

-- Step 2: Track the signup event (triggers welcome campaign)
app.integrations.vero.track_event({
  identity = "usr_456",
  event_name = "Signed up",
  data = {
    source = "landing_page",
    plan = "free"
  }
})
```

### Upgrade a user's plan

```lua
-- Update user attributes
app.integrations.vero.update_user({
  id = "usr_456",
  data = {
    plan = "premium",
    upgraded_at = "2025-07-01"
  }
})

-- Track the upgrade event
app.integrations.vero.track_event({
  identity = "usr_456",
  event_name = "Upgraded plan",
  data = {
    from_plan = "free",
    to_plan = "premium"
  }
})
```

### Handle a user leaving

```lua
-- Track churn event
app.integrations.vero.track_event({
  identity = "usr_456",
  event_name = "Cancelled subscription",
  data = {
    reason = "too_expensive",
    last_plan = "premium"
  }
})

-- Unsubscribe from emails
app.integrations.vero.unsubscribe({
  id = "usr_456"
})
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.vero.identify_user({id = "1", email = "[email protected]"})

-- Explicit default (portable across setups)
app.integrations.vero.default.identify_user({id = "1", email = "[email protected]"})

-- Named accounts
app.integrations.vero.marketing.identify_user({id = "1", email = "[email protected]"})
app.integrations.vero.transactional.track_event({identity = "1", event_name = "Order shipped"})
```

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

Metadata-Derived Lua Example

local result = app.integrations.vero.vero_get_current_user({})
print(result)

Functions

vero_get_current_user

Get the profile of the currently authenticated Vero user. Useful for verifying API connectivity and checking account details.

Operation
Read read
Full name
vero.vero_get_current_user
ParameterTypeRequiredDescription
No parameters.

vero_identify_user

Identify (create or update) a user in Vero. Pass a unique user ID, email, optional name, and any custom attributes in the data object. This creates the user if they don't exist, or updates their profile if they do.

Operation
Read read
Full name
vero.vero_identify_user
ParameterTypeRequiredDescription
id string yes Unique user identifier (e.g., database ID or UUID).
email string yes User email address.
name string no Display name for the user.
data object no Custom user attributes as key-value pairs (e.g., {"plan": "premium", "signup_date": "2025-01-15"}).

vero_resubscribe

Resubscribe a previously unsubscribed user to Vero email campaigns. The user will start receiving emails again.

Operation
Read read
Full name
vero.vero_resubscribe
ParameterTypeRequiredDescription
id string yes Unique user identifier to resubscribe.

vero_track_event

Track a behavioral event for a user in Vero. Events can trigger automated email campaigns. Pass a user identity (ID or email), event name, and optional event data.

Operation
Read read
Full name
vero.vero_track_event
ParameterTypeRequiredDescription
identity string yes User ID or email address identifying the user.
event_name string yes Name of the event to track (e.g., "Logged in", "Added to cart", "Purchased").
data object no Event-specific data as key-value pairs (e.g., {"product": "Widget", "price": 29.99}).

vero_unsubscribe

Unsubscribe a user from all Vero email campaigns. The user will no longer receive any email communication.

Operation
Read read
Full name
vero.vero_unsubscribe
ParameterTypeRequiredDescription
id string yes Unique user identifier to unsubscribe.

vero_update_user

Update a user's profile in Vero. Pass the user ID, an optional new email, and a data object with attributes to update.

Operation
Write write
Full name
vero.vero_update_user
ParameterTypeRequiredDescription
id string yes Unique user identifier to update.
email string no New email address for the user.
data object no Attributes to update as key-value pairs (e.g., {"plan": "enterprise", "company": "Acme Inc"}).