Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 129 additions & 0 deletions flows/active-campaign/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
---
name: active-campaign
description: |
ActiveCampaign integration flows for the One CLI. Manage contacts, deals,
and tags in your ActiveCampaign CRM with ready-to-run workflows.
triggers:
- "activecampaign"
- "active campaign"
- "create contact activecampaign"
- "search contacts activecampaign"
- "create deal activecampaign"
- "/active-campaign"
---

# ActiveCampaign Flows

Ready-to-run workflows for ActiveCampaign via the [One CLI](https://github.com/withoneai/one).

## Setup

```bash
npm i -g @withone/cli # Install One CLI
one add active-campaign # Connect your ActiveCampaign account
one --agent list # Find your connection key
```

## Discovery

Creating deals requires pipeline (`group`) and `stage` IDs. Filtering contacts may need `listId` or `tagId`. Find them with:

```bash
# List pipelines (to get group/pipeline IDs and their stages)
one --agent actions search active-campaign "list pipelines"
one --agent actions execute active-campaign <list-pipelines-action-id> <your-connection-key>

# List tags (to get tagId)
one --agent actions search active-campaign "list tags"
one --agent actions execute active-campaign <list-tags-action-id> <your-connection-key>

# List contact lists (to get listId)
one --agent actions search active-campaign "list lists"
one --agent actions execute active-campaign <list-lists-action-id> <your-connection-key>
```

## Flows

### Create Contact

Create a new contact with email, name, phone, custom fields, and an optional tag.

```bash
one flow execute activecampaign-create-contact.flow.json \
--input activeCampaignConnectionKey="<your-key>" \
--input email="alice@example.com" \
--input firstName="Alice" \
--input lastName="Smith"
```

**Inputs:**

| Input | Required | Description |
|-------|----------|-------------|
| `activeCampaignConnectionKey` | Yes | ActiveCampaign connection key |
| `email` | Yes | Contact email address |
| `firstName` | No | First name |
| `lastName` | No | Last name |
| `phone` | No | Phone number |
| `fieldValues` | No | Custom field values (array of `{field, value}`) |
| `tagId` | No | Tag ID to apply after creation |

**What it does under the hood:**

1. Builds contact payload with standard and custom fields
2. Creates the contact via `POST /api/3/contacts`
3. Optionally adds a tag via `POST /api/3/contactTags`

### Create Deal

Create a deal in the ActiveCampaign CRM pipeline.

```bash
one flow execute activecampaign-create-deal.flow.json \
--input activeCampaignConnectionKey="<your-key>" \
--input title="Enterprise License" \
--input value=50000 \
--input group="1" \
--input stage="1"
```

**Inputs:**

| Input | Required | Description |
|-------|----------|-------------|
| `activeCampaignConnectionKey` | Yes | ActiveCampaign connection key |
| `title` | Yes | Deal title |
| `value` | No | Deal value in cents (default 0) |
| `currency` | No | 3-letter currency code (default 'usd') |
| `group` | Yes | Pipeline ID |
| `stage` | Yes | Stage ID within the pipeline |
| `owner` | No | Owner user ID |
| `contactId` | No | Contact ID to associate |
| `description` | No | Deal description |

### Search Contacts

Search and filter contacts by email, name, list, or tag.

```bash
one flow execute activecampaign-search-contacts.flow.json \
--input activeCampaignConnectionKey="<your-key>" \
--input email="alice@example.com"
```

**Inputs:**

| Input | Required | Description |
|-------|----------|-------------|
| `activeCampaignConnectionKey` | Yes | ActiveCampaign connection key |
| `email` | No | Filter by email |
| `search` | No | Free-text search term |
| `listId` | No | Filter by list ID |
| `tagId` | No | Filter by tag ID |
| `limit` | No | Results to return (max 100, default 20) |

## Adapting These Flows

- **Tag + deal pipeline**: Chain `activecampaign-create-contact` into `activecampaign-create-deal` using the returned contact ID.
- **Bulk import**: Use the ActiveCampaign bulk import action for large contact lists.
- **Lead scoring**: Search contacts, then update scores via the update contact action.
98 changes: 98 additions & 0 deletions flows/active-campaign/activecampaign-create-contact.flow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"key": "activecampaign-create-contact",
"name": "Create a Contact in ActiveCampaign",
"description": "Create a new contact in ActiveCampaign with email, name, phone, and custom fields. Optionally tag the contact after creation.",
"version": "1",
"inputs": {
"activeCampaignConnectionKey": {
"type": "string",
"required": true,
"description": "ActiveCampaign connection key",
"connection": { "platform": "active-campaign" }
},
"email": {
"type": "string",
"required": true,
"description": "Contact email address"
},
"firstName": {
"type": "string",
"required": false,
"description": "First name"
},
"lastName": {
"type": "string",
"required": false,
"description": "Last name"
},
"phone": {
"type": "string",
"required": false,
"description": "Phone number"
},
"fieldValues": {
"type": "array",
"required": false,
"description": "Custom field values. Array of {field: fieldId, value: fieldValue} objects."
},
"tagId": {
"type": "string",
"required": false,
"description": "Tag ID to apply to the contact after creation"
}
},
"steps": [
{
"id": "buildContact",
"name": "Build contact payload",
"type": "code",
"code": {
"source": "const { email, firstName, lastName, phone, fieldValues } = $.input;\nif (!email) throw new Error('email is required');\nconst contact = { email };\nif (firstName) contact.firstName = firstName;\nif (lastName) contact.lastName = lastName;\nif (phone) contact.phone = phone;\nif (fieldValues && fieldValues.length > 0) contact.fieldValues = fieldValues;\nreturn { contact };"
}
},
{
"id": "createContact",
"name": "Create contact via ActiveCampaign API",
"type": "action",
"action": {
"platform": "active-campaign",
"actionId": "conn_mod_def::GJzzagLoQHU::D64WeRT1TmmUoyaJJ5t0IQ",
"connectionKey": "$.input.activeCampaignConnectionKey",
"data": "$.steps.buildContact.output"
}
},
{
"id": "prepareTag",
"name": "Check if tag should be applied",
"type": "code",
"code": {
"source": "const tagId = $.input.tagId;\nconst contactId = $.steps.createContact.response?.contact?.id;\nreturn { shouldTag: !!(tagId && contactId), contactId: contactId || '', tagId: tagId || '' };"
}
},
{
"id": "addTag",
"name": "Add tag to contact",
"type": "action",
"if": "$.steps.prepareTag.output.shouldTag",
"action": {
"platform": "active-campaign",
"actionId": "conn_mod_def::GJzz1X7lVnA::mVcMrPArQXaEMz_uM-ecUA",
"connectionKey": "$.input.activeCampaignConnectionKey",
"data": {
"contactTag": {
"contact": "$.steps.prepareTag.output.contactId",
"tag": "$.steps.prepareTag.output.tagId"
}
}
}
},
{
"id": "formatResult",
"name": "Format the response",
"type": "code",
"code": {
"source": "const resp = $.steps.createContact.response || {};\nconst contact = resp.contact || {};\nconst tagged = $.steps.addTag?.response?.contactTag ? true : false;\nreturn {\n contactId: contact.id || '',\n email: contact.email || $.input.email,\n firstName: contact.firstName || '',\n lastName: contact.lastName || '',\n created: !!contact.id,\n tagged,\n summary: contact.id\n ? `Created contact ${contact.email || $.input.email}${tagged ? ' (tagged)' : ''}`\n : 'Failed to create contact'\n};"
}
}
]
}
85 changes: 85 additions & 0 deletions flows/active-campaign/activecampaign-create-deal.flow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"key": "activecampaign-create-deal",
"name": "Create a Deal in ActiveCampaign",
"description": "Create a new deal in ActiveCampaign CRM with title, value, pipeline, stage, and contact association.",
"version": "1",
"inputs": {
"activeCampaignConnectionKey": {
"type": "string",
"required": true,
"description": "ActiveCampaign connection key",
"connection": { "platform": "active-campaign" }
},
"title": {
"type": "string",
"required": true,
"description": "Deal title"
},
"value": {
"type": "number",
"required": false,
"default": 0,
"description": "Deal value in cents (e.g., 10000 = $100.00)"
},
"currency": {
"type": "string",
"required": false,
"default": "usd",
"description": "3-letter currency code (e.g., 'usd')"
},
"group": {
"type": "string",
"required": true,
"description": "Pipeline ID (called 'group' in the API)"
},
"stage": {
"type": "string",
"required": true,
"description": "Stage ID within the pipeline"
},
"owner": {
"type": "string",
"required": false,
"description": "Deal owner user ID"
},
"contactId": {
"type": "string",
"required": false,
"description": "Contact ID to associate with the deal"
},
"description": {
"type": "string",
"required": false,
"description": "Deal description"
}
},
"steps": [
{
"id": "buildDeal",
"name": "Build deal payload",
"type": "code",
"code": {
"source": "const { title, value, currency, group, stage, owner, contactId, description } = $.input;\nif (!title || !group || !stage) throw new Error('title, group (pipeline ID), and stage are required');\nconst deal = { title, group, stage };\ndeal.value = value || 0;\ndeal.currency = currency || 'usd';\nif (owner) deal.owner = owner;\nif (contactId) deal.contact = contactId;\nif (description) deal.description = description;\nreturn { deal };"
}
},
{
"id": "createDeal",
"name": "Create deal via ActiveCampaign API",
"type": "action",
"action": {
"platform": "active-campaign",
"actionId": "conn_mod_def::GJzzlr7LEzc::T-RiAlnkS1G_sapuArW0cg",
"connectionKey": "$.input.activeCampaignConnectionKey",
"data": "$.steps.buildDeal.output"
}
},
{
"id": "formatResult",
"name": "Format the response",
"type": "code",
"code": {
"source": "const resp = $.steps.createDeal.response || {};\nconst deal = resp.deal || {};\nreturn {\n dealId: deal.id || '',\n title: deal.title || $.input.title,\n value: deal.value || 0,\n currency: deal.currency || 'usd',\n stage: deal.stage || '',\n created: !!deal.id,\n summary: deal.id ? `Created deal \"${deal.title || $.input.title}\"` : 'Failed to create deal'\n};"
}
}
]
}
69 changes: 69 additions & 0 deletions flows/active-campaign/activecampaign-search-contacts.flow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"key": "activecampaign-search-contacts",
"name": "Search Contacts in ActiveCampaign",
"description": "Search, list, and filter contacts in ActiveCampaign by email, name, tag, list, or custom query parameters.",
"version": "1",
"inputs": {
"activeCampaignConnectionKey": {
"type": "string",
"required": true,
"description": "ActiveCampaign connection key",
"connection": { "platform": "active-campaign" }
},
"email": {
"type": "string",
"required": false,
"description": "Filter by email address"
},
"search": {
"type": "string",
"required": false,
"description": "Search term to match against name, email, or other fields"
},
"listId": {
"type": "string",
"required": false,
"description": "Filter by list ID"
},
"tagId": {
"type": "string",
"required": false,
"description": "Filter by tag ID"
},
"limit": {
"type": "number",
"required": false,
"default": 20,
"description": "Number of contacts to return (max 100)"
}
},
"steps": [
{
"id": "buildQuery",
"name": "Build query parameters",
"type": "code",
"code": {
"source": "const { email, search, listId, tagId, limit } = $.input;\nconst params = { limit: String(Math.min(limit || 20, 100)) };\nif (email) params.email = email;\nif (search) params.search = search;\nif (listId) params.listid = listId;\nif (tagId) params.tagid = tagId;\nreturn { params };"
}
},
{
"id": "searchContacts",
"name": "Search contacts via ActiveCampaign API",
"type": "action",
"action": {
"platform": "active-campaign",
"actionId": "conn_mod_def::GJzzbG2HP0U::-KANfSK3RtSbF1PHyI_6dQ",
"connectionKey": "$.input.activeCampaignConnectionKey",
"queryParams": "$.steps.buildQuery.output.params"
}
},
{
"id": "formatResult",
"name": "Format the response",
"type": "code",
"code": {
"source": "const resp = $.steps.searchContacts.response || {};\nconst contacts = resp.contacts || [];\nreturn {\n contacts: contacts.map(c => ({\n id: c.id,\n email: c.email,\n firstName: c.firstName,\n lastName: c.lastName,\n phone: c.phone,\n createdDate: c.cdate,\n tags: c.tags || []\n })),\n count: contacts.length,\n summary: `Found ${contacts.length} contact${contacts.length === 1 ? '' : 's'}`\n};"
}
}
]
}
Loading