KosmoKrator

crm

ActiveCampaign Lua API for KosmoKrator Agents

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

15 functions 7 read 8 write API key auth

Lua Namespace

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

ActiveCampaign Integration

Manage contacts, lists, deals, automations, and notes in ActiveCampaign.

Authentication

This integration uses an API Key and Account Name for authentication.

  • API Key: Found in Settings → Developer → API Access in your ActiveCampaign account.
  • Account Name: The subdomain from your ActiveCampaign URL (e.g., mycompany from mycompany.activehosted.com).

Configuration

FieldTypeRequiredDescription
api_keysecretYour ActiveCampaign API key
account_namestringYour ActiveCampaign account name (subdomain)

Tools

activecampaign_list_contacts

List contacts with pagination, search, and filters.

Type: read

Parameters:

ParameterTypeRequiredDescription
limitintegerNoNumber of contacts per page (default: 20, max: 100)
offsetintegerNoOffset for pagination
searchstringNoSearch by email or name
filtersobjectNoAdditional filters (e.g., {"status": "-1"}, {"listid": 5})

Example:

activecampaign_list_contacts({ search = "[email protected]", limit = 10 })

activecampaign_get_contact

Get details of a specific contact by ID.

Type: read

Parameters:

ParameterTypeRequiredDescription
contact_idintegerThe ActiveCampaign contact ID

Example:

activecampaign_get_contact({ contact_id = 123 })

activecampaign_create_contact

Create a new contact.

Type: write

Parameters:

ParameterTypeRequiredDescription
emailstringContact email address
firstNamestringNoFirst name
lastNamestringNoLast name
phonestringNoPhone number

Example:

activecampaign_create_contact({
  email = "[email protected]",
  firstName = "Jane",
  lastName = "Doe",
  phone = "+1234567890"
})

activecampaign_update_contact

Update an existing contact.

Type: write

Parameters:

ParameterTypeRequiredDescription
contact_idintegerThe contact ID to update
emailstringNoUpdated email
firstNamestringNoUpdated first name
lastNamestringNoUpdated last name
phonestringNoUpdated phone
fieldsobjectNoCustom field values (e.g., {"field[1]": "value"})

Example:

activecampaign_update_contact({
  contact_id = 123,
  firstName = "John",
  lastName = "Updated"
})

activecampaign_delete_contact

Delete a contact permanently.

Type: write

Parameters:

ParameterTypeRequiredDescription
contact_idintegerThe contact ID to delete

Example:

activecampaign_delete_contact({ contact_id = 123 })

activecampaign_list_lists

List all contact lists.

Type: read

Parameters:

ParameterTypeRequiredDescription
limitintegerNoNumber of lists per page (default: 20)
offsetintegerNoOffset for pagination

Example:

activecampaign_list_lists({ limit = 50 })

activecampaign_get_list

Get details of a specific list.

Type: read

Parameters:

ParameterTypeRequiredDescription
list_idintegerThe list ID

Example:

activecampaign_get_list({ list_id = 5 })

activecampaign_add_contact_to_list

Subscribe a contact to a list.

Type: write

Parameters:

ParameterTypeRequiredDescription
contact_idintegerThe contact ID
list_idintegerThe list ID to subscribe to

Example:

activecampaign_add_contact_to_list({
  contact_id = 123,
  list_id = 5
})

activecampaign_remove_contact_from_list

Unsubscribe a contact from a list.

Type: write

Parameters:

ParameterTypeRequiredDescription
contact_idintegerThe contact ID
list_idintegerThe list ID to unsubscribe from

Example:

activecampaign_remove_contact_from_list({
  contact_id = 123,
  list_id = 5
})

activecampaign_list_deals

List deals with filters.

Type: read

Parameters:

ParameterTypeRequiredDescription
limitintegerNoNumber of deals per page (default: 20)
offsetintegerNoOffset for pagination
searchstringNoSearch by deal title
filtersobjectNoFilters (e.g., {"pipeline": 1, "stage": 2, "status": 0}). Status: 0=open, 1=won, 2=lost, 3=abandoned

Example:

activecampaign_list_deals({ filters = { status = 0 }, limit = 25 })

activecampaign_get_deal

Get details of a specific deal.

Type: read

Parameters:

ParameterTypeRequiredDescription
deal_idintegerThe deal ID

Example:

activecampaign_get_deal({ deal_id = 42 })

activecampaign_create_deal

Create a new deal.

Type: write

Parameters:

ParameterTypeRequiredDescription
titlestringDeal title
valuenumberDeal value
contact_idintegerAssociated contact ID
stageintegerPipeline stage ID
pipelineintegerNoPipeline ID (default pipeline if omitted)

Example:

activecampaign_create_deal({
  title = "New Enterprise Deal",
  value = 50000,
  contact_id = 123,
  stage = 1,
  pipeline = 2
})

activecampaign_update_deal

Update an existing deal.

Type: write

Parameters:

ParameterTypeRequiredDescription
deal_idintegerThe deal ID to update
titlestringNoUpdated title
valuenumberNoUpdated value
stageintegerNoUpdated stage ID
pipelineintegerNoUpdated pipeline ID
statusintegerNoStatus: 0=open, 1=won, 2=lost, 3=abandoned
ownerstringNoUpdated owner (user ID)
percentintegerNoUpdated percentage
fieldsobjectNoCustom fields

Example:

activecampaign_update_deal({
  deal_id = 42,
  status = 1,  -- Mark as won
  value = 55000
})

activecampaign_list_automations

List all automations.

Type: read

Parameters:

ParameterTypeRequiredDescription
limitintegerNoNumber of automations per page (default: 20)
offsetintegerNoOffset for pagination

Example:

activecampaign_list_automations({ limit = 50 })

activecampaign_create_note

Add a note to a contact.

Type: write

Parameters:

ParameterTypeRequiredDescription
contact_idintegerThe contact ID
notestringThe note text

Example:

activecampaign_create_note({
  contact_id = 123,
  note = "Called customer, they are interested in the enterprise plan."
})
Raw agent markdown
# ActiveCampaign Integration

Manage contacts, lists, deals, automations, and notes in ActiveCampaign.

## Authentication

This integration uses an **API Key** and **Account Name** for authentication.

- **API Key**: Found in Settings → Developer → API Access in your ActiveCampaign account.
- **Account Name**: The subdomain from your ActiveCampaign URL (e.g., `mycompany` from `mycompany.activehosted.com`).

## Configuration

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `api_key` | secret | ✅ | Your ActiveCampaign API key |
| `account_name` | string | ✅ | Your ActiveCampaign account name (subdomain) |

## Tools

### `activecampaign_list_contacts`

List contacts with pagination, search, and filters.

**Type**: read

**Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | Number of contacts per page (default: 20, max: 100) |
| `offset` | integer | No | Offset for pagination |
| `search` | string | No | Search by email or name |
| `filters` | object | No | Additional filters (e.g., `{"status": "-1"}`, `{"listid": 5}`) |

**Example**:

```lua
activecampaign_list_contacts({ search = "[email protected]", limit = 10 })
```

---

### `activecampaign_get_contact`

Get details of a specific contact by ID.

**Type**: read

**Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `contact_id` | integer | ✅ | The ActiveCampaign contact ID |

**Example**:

```lua
activecampaign_get_contact({ contact_id = 123 })
```

---

### `activecampaign_create_contact`

Create a new contact.

**Type**: write

**Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `email` | string | ✅ | Contact email address |
| `firstName` | string | No | First name |
| `lastName` | string | No | Last name |
| `phone` | string | No | Phone number |

**Example**:

```lua
activecampaign_create_contact({
  email = "[email protected]",
  firstName = "Jane",
  lastName = "Doe",
  phone = "+1234567890"
})
```

---

### `activecampaign_update_contact`

Update an existing contact.

**Type**: write

**Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `contact_id` | integer | ✅ | The contact ID to update |
| `email` | string | No | Updated email |
| `firstName` | string | No | Updated first name |
| `lastName` | string | No | Updated last name |
| `phone` | string | No | Updated phone |
| `fields` | object | No | Custom field values (e.g., `{"field[1]": "value"}`) |

**Example**:

```lua
activecampaign_update_contact({
  contact_id = 123,
  firstName = "John",
  lastName = "Updated"
})
```

---

### `activecampaign_delete_contact`

Delete a contact permanently.

**Type**: write

**Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `contact_id` | integer | ✅ | The contact ID to delete |

**Example**:

```lua
activecampaign_delete_contact({ contact_id = 123 })
```

---

### `activecampaign_list_lists`

List all contact lists.

**Type**: read

**Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | Number of lists per page (default: 20) |
| `offset` | integer | No | Offset for pagination |

**Example**:

```lua
activecampaign_list_lists({ limit = 50 })
```

---

### `activecampaign_get_list`

Get details of a specific list.

**Type**: read

**Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `list_id` | integer | ✅ | The list ID |

**Example**:

```lua
activecampaign_get_list({ list_id = 5 })
```

---

### `activecampaign_add_contact_to_list`

Subscribe a contact to a list.

**Type**: write

**Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `contact_id` | integer | ✅ | The contact ID |
| `list_id` | integer | ✅ | The list ID to subscribe to |

**Example**:

```lua
activecampaign_add_contact_to_list({
  contact_id = 123,
  list_id = 5
})
```

---

### `activecampaign_remove_contact_from_list`

Unsubscribe a contact from a list.

**Type**: write

**Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `contact_id` | integer | ✅ | The contact ID |
| `list_id` | integer | ✅ | The list ID to unsubscribe from |

**Example**:

```lua
activecampaign_remove_contact_from_list({
  contact_id = 123,
  list_id = 5
})
```

---

### `activecampaign_list_deals`

List deals with filters.

**Type**: read

**Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | Number of deals per page (default: 20) |
| `offset` | integer | No | Offset for pagination |
| `search` | string | No | Search by deal title |
| `filters` | object | No | Filters (e.g., `{"pipeline": 1, "stage": 2, "status": 0}`). Status: 0=open, 1=won, 2=lost, 3=abandoned |

**Example**:

```lua
activecampaign_list_deals({ filters = { status = 0 }, limit = 25 })
```

---

### `activecampaign_get_deal`

Get details of a specific deal.

**Type**: read

**Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `deal_id` | integer | ✅ | The deal ID |

**Example**:

```lua
activecampaign_get_deal({ deal_id = 42 })
```

---

### `activecampaign_create_deal`

Create a new deal.

**Type**: write

**Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `title` | string | ✅ | Deal title |
| `value` | number | ✅ | Deal value |
| `contact_id` | integer | ✅ | Associated contact ID |
| `stage` | integer | ✅ | Pipeline stage ID |
| `pipeline` | integer | No | Pipeline ID (default pipeline if omitted) |

**Example**:

```lua
activecampaign_create_deal({
  title = "New Enterprise Deal",
  value = 50000,
  contact_id = 123,
  stage = 1,
  pipeline = 2
})
```

---

### `activecampaign_update_deal`

Update an existing deal.

**Type**: write

**Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `deal_id` | integer | ✅ | The deal ID to update |
| `title` | string | No | Updated title |
| `value` | number | No | Updated value |
| `stage` | integer | No | Updated stage ID |
| `pipeline` | integer | No | Updated pipeline ID |
| `status` | integer | No | Status: 0=open, 1=won, 2=lost, 3=abandoned |
| `owner` | string | No | Updated owner (user ID) |
| `percent` | integer | No | Updated percentage |
| `fields` | object | No | Custom fields |

**Example**:

```lua
activecampaign_update_deal({
  deal_id = 42,
  status = 1,  -- Mark as won
  value = 55000
})
```

---

### `activecampaign_list_automations`

List all automations.

**Type**: read

**Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | Number of automations per page (default: 20) |
| `offset` | integer | No | Offset for pagination |

**Example**:

```lua
activecampaign_list_automations({ limit = 50 })
```

---

### `activecampaign_create_note`

Add a note to a contact.

**Type**: write

**Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `contact_id` | integer | ✅ | The contact ID |
| `note` | string | ✅ | The note text |

**Example**:

```lua
activecampaign_create_note({
  contact_id = 123,
  note = "Called customer, they are interested in the enterprise plan."
})
```

Metadata-Derived Lua Example

local result = app.integrations.activecampaign.activecampaign_list_contacts({
  limit = 1,
  offset = 1,
  search = "example_search",
  filters = "example_filters"
})
print(result)

Functions

activecampaign_list_contacts

List contacts from ActiveCampaign. Supports pagination, search by email or name, and filtering by list, status, and other criteria.

Operation
Read read
Full name
activecampaign.activecampaign_list_contacts
ParameterTypeRequiredDescription
limit integer no Number of contacts to return per page (default: 20, max: 100).
offset integer no Offset for pagination (e.g., 20 to skip the first page).
search string no Search term to filter contacts by email, name, or other fields.
filters object no Additional filters as key-value pairs (e.g., {"status": "-1"} for unsubscribed, {"listid": 5}).

activecampaign_get_contact

Get details of a specific ActiveCampaign contact by ID, including email, name, phone, and custom fields.

Operation
Read read
Full name
activecampaign.activecampaign_get_contact
ParameterTypeRequiredDescription
contact_id integer yes The ActiveCampaign contact ID.

activecampaign_create_contact

Create a new contact in ActiveCampaign. Requires an email address; firstName, lastName, and phone are optional.

Operation
Write write
Full name
activecampaign.activecampaign_create_contact
ParameterTypeRequiredDescription
email string yes The contact email address.
firstName string no The contact first name.
lastName string no The contact last name.
phone string no The contact phone number.

activecampaign_update_contact

Update an existing contact in ActiveCampaign. Provide the contact ID and any fields to update (email, firstName, lastName, phone, or custom fields).

Operation
Write write
Full name
activecampaign.activecampaign_update_contact
ParameterTypeRequiredDescription
contact_id integer yes The ActiveCampaign contact ID to update.
email string no Updated email address.
firstName string no Updated first name.
lastName string no Updated last name.
phone string no Updated phone number.
fields object no Custom field values as key-value pairs (e.g., {"field[1]": "value"}).

activecampaign_delete_contact

Delete a contact from ActiveCampaign. This action is permanent and cannot be undone.

Operation
Write write
Full name
activecampaign.activecampaign_delete_contact
ParameterTypeRequiredDescription
contact_id integer yes The ActiveCampaign contact ID to delete.

activecampaign_list_lists

List all contact lists in ActiveCampaign. Returns list IDs, names, and subscriber counts.

Operation
Read read
Full name
activecampaign.activecampaign_list_lists
ParameterTypeRequiredDescription
limit integer no Number of lists to return per page (default: 20).
offset integer no Offset for pagination.

activecampaign_get_list

Get details of a specific ActiveCampaign list by ID, including name, subscriber count, and settings.

Operation
Read read
Full name
activecampaign.activecampaign_get_list
ParameterTypeRequiredDescription
list_id integer yes The ActiveCampaign list ID.

activecampaign_add_contact_to_list

Subscribe a contact to a list in ActiveCampaign. The contact will be added to the specified list.

Operation
Write write
Full name
activecampaign.activecampaign_add_contact_to_list
ParameterTypeRequiredDescription
contact_id integer yes The ActiveCampaign contact ID.
list_id integer yes The ActiveCampaign list ID to subscribe the contact to.

activecampaign_remove_contact_from_list

Unsubscribe a contact from a list in ActiveCampaign. The contact will be removed from the specified list.

Operation
Write write
Full name
activecampaign.activecampaign_remove_contact_from_list
ParameterTypeRequiredDescription
contact_id integer yes The ActiveCampaign contact ID.
list_id integer yes The ActiveCampaign list ID to unsubscribe the contact from.

activecampaign_list_deals

List deals from ActiveCampaign. Supports pagination, search, and filtering by pipeline, stage, status, or owner.

Operation
Read read
Full name
activecampaign.activecampaign_list_deals
ParameterTypeRequiredDescription
limit integer no Number of deals to return per page (default: 20).
offset integer no Offset for pagination.
search string no Search term to filter deals by title.
filters object no Additional filters (e.g., {"pipeline": 1, "stage": 2, "status": 0}, status: 0=open, 1=won, 2=lost, 3=abandoned).

activecampaign_get_deal

Get details of a specific ActiveCampaign deal by ID, including title, value, stage, pipeline, and associated contact.

Operation
Read read
Full name
activecampaign.activecampaign_get_deal
ParameterTypeRequiredDescription
deal_id integer yes The ActiveCampaign deal ID.

activecampaign_create_deal

Create a new deal in ActiveCampaign. Requires a title, value, contact ID, and stage. Optionally specify a pipeline.

Operation
Write write
Full name
activecampaign.activecampaign_create_deal
ParameterTypeRequiredDescription
title string yes The deal title.
value number yes The deal value (e.g., 5000 for $5,000).
contact_id integer yes The associated contact ID.
stage integer yes The pipeline stage ID to place the deal in.
pipeline integer no The pipeline ID. If omitted, the default pipeline is used.

activecampaign_update_deal

Update an existing deal in ActiveCampaign. Provide the deal ID and any fields to update (title, value, stage, pipeline, status, etc.).

Operation
Write write
Full name
activecampaign.activecampaign_update_deal
ParameterTypeRequiredDescription
deal_id integer yes The ActiveCampaign deal ID to update.
title string no Updated deal title.
value number no Updated deal value.
stage integer no Updated pipeline stage ID.
pipeline integer no Updated pipeline ID.
status integer no Deal status: 0=open, 1=won, 2=lost, 3=abandoned.
owner string no Updated deal owner (user ID).
percent integer no Updated deal percentage (custom field).
fields object no Additional custom fields as key-value pairs.

activecampaign_list_automations

List all automations in ActiveCampaign. Returns automation IDs, names, status, and trigger counts.

Operation
Read read
Full name
activecampaign.activecampaign_list_automations
ParameterTypeRequiredDescription
limit integer no Number of automations to return per page (default: 20).
offset integer no Offset for pagination.

activecampaign_create_note

Create a note attached to a contact in ActiveCampaign. Provide the contact ID and note text.

Operation
Write write
Full name
activecampaign.activecampaign_create_note
ParameterTypeRequiredDescription
contact_id integer yes The ActiveCampaign contact ID to attach the note to.
note string yes The note text content.