Let's build something great together

When you build integrations with ActiveCampaign, you can have a positive impact on small businesses across the world. This is where you can find ActiveCampaign API documentation, SDKs, support, and a community of developers like you.

Get Started    

A resource action object is composed to two items:

Key

JSON Type

name

string

run

object

*Resource Action Structure*

``` {.json} { "name": "", "run": {} } ```

name MUST correlate to one of the available action names. It is by the name value that actions are found and executed.

📘

Note

For a full list of available actions, see AVAILABLE ACTIONS

The run object is composed of commands to executed when an action is called.

📘

NOTE

For a full list of available commands, see RESOURCE COMMANDS

AVAILABLE ACTIONS

When creating actions, the name for an action must come from an action detailed below.

describe_connection

The describe_connection is called when displaying information about a connection within ActiveCampaign.

The describe_connection action is called as part of a marketer interaction within ActiveCampaign. For more information on the marketer interaction see the describe connection section within the configuration walkthrough.

Example Configuration

{
    "name": "describe_connection",
    "run": {
        "!pipe": [
            {
                "!http": {
                    "method": "GET",
                    "path": "/user"
                }
            },
            {
                "!jq": "{account_id: .email, description: [.alias, .email] | join(\" - \")}"
            }
        ]
    }
}

See: !pipe, !http

Context Variables

Only the general context variables are available with this command.

See describe_connection

Expected Result

The !jq command needs to be formatting data into a JSON object that contains the following key/value pairs.

Key

JSON Type

Description

account_id

string

A unique identifier for the account from the service provider

description

string

An account description. This value is shown to marketer

The list action is called when displaying a list of subscribable resources. The kind of resource depends on the service being integrated.

The list action is called as part of a marketer interaction within ActiveCampaign. For more information on the marketer interaction see the walkthrough-list section within the configuration walkthrough.

Example Configuration

{
    "name": "list",
    "run": {
        "!pipe": [
            {
                "!http": {
                    "method": "GET",
                    "path": "/repos"
                }
            },
            {
                "!jmespath": "[].{name: name, id: id}"
            }
        ]
    }
}

See: !pipe, !http, !jmespath

Context Variables

Only the general context variables are available with this command.

See list section within the Resource Commands

Expected Result {#resource-action-list-result}

The !jmespath command needs to be formatting data into a JSON object
that contains an id and name field.

Key

JSON Type

Description

id

string

A unique identifier for the resource from the service provider

name

string

The name of the resource for to display to the marketer

{
   "name": "",
   "id": ""
}

describe

The describe action is called when showing the available resource values and then how those resource values should be mapped to an ActiveCampaign asset.

The [describe]{.title-ref} action is called as part of a marketer interaction within ActiveCampaign. For more information on the marketer interaction see the walkthru-describe{.interpreted-text role="ref"} section within the configuration walkthrough <configuration_walkthrough>{.interpreted-text role="ref"}.

Example Configuration

{
    "name": "describe",
    "run": {
        "!pipe": [
            {
                "!http": {
                    "method": "GET",
                    "path": "/repos/${resource::id}"
                }
            },
            {
                "!jmespath": "[].{title: name, id: guid, type: field_type}"
            }
        ]
    }
}

See: !pipe, !http, !jmespath

Context Variables

See commands-command-context-describe{.interpreted-text role="ref"}

Expected Result

The expected result of this command is to have a list JSON object that
describes the available resource values.

Each JSON object needs to have the following key,value pairs defined:

Key

JSON Type

Description

id

string

A unique identifier for the resource attribute from the service provider

title

string

The title of the resource value for to display to the marketer so they map that value to a value within ActiveCampaign

type

string

Expected data type

parse_webhook

The parse_webhook action is called when a webhook payload has been received.

The parse_webhook action is called as part handling incoming data from an external resource provider. No user interaction required.

🚧

Warning

The expected content type of the webhook payload to be that of application/json.

Example Configuration {#resource-action-parse-webhook-config}

{
    "name": "parse_webhook",
    "run": {
        "!jmespath": "{submission_timestamp: submitted_on, answers: form[*].{id: field.id, value: field.value}, tags:["custom tag"]}"
    }
}

In the code above, when the parse_webhook is run the !jmespath
command extracts the needed data from the payload into the required
format.

Any value in the tags array will be prepended with the
"{slug}-{resource_name}-", then added to incoming contacts from the
integration. "{slug}" is defined in the app.json. While
{resource_name} is pulled from the external resource being used.

See: !jmespath

Expected Result

The expected result of the parse_webhook command is to have a JSON
object that looks like the following:

{
   "submission_timestamp": "2018-01-18T18:17:02Z",
   "answers": [
      {
         "id": "email",
         "value": "[email protected]"
      },
      {
         "id": "first_name",
         "value": "Timmy"
      }
   ],
   "tags": ["tag1", "tag2"]
}

Key

JSON Type

Description

submission_timestamp

string

A valid timestamp of when the acton or event occurred

answers

list

A list of objects; See below

tags (optional)

list

A list of strings

Each JSON object within the answers list needs to have the following key,value pairs defined:

Key

JSON Type

Description

id

string

A unique identifier for the resource attribute from the service provider

value

string, number, list

The value associated to resource attribute. When value is a list, that list must contain either strings or numbers.

🚧

Warning

The id within this object MUST BE associated to the id provided within the describe action.

Context Variables

See parse_webhook context variables <commands-command-context-parse-webhook>{.interpreted-text role="ref"}

subscribe

The subscribe action is called when creating a webhook for a specific resource. Once a webhook has been created, the resource has been "subscribed".

The subscribe action is called as part of a marketer interaction within ActiveCampaign. For more information on the marketer interaction see the walkthru_subscribe{.interpreted-text role="ref"}
section within the configuration walkthrough <configuration_walkthrough>{.interpreted-text role="ref"}.

Example Configuration

{
    "name": "subscribe",
    "run": {
        "!http": {
            "method": "POST",
            "path": "/repos/${subscription::external_resource_id}/hooks"
        }
    }
}

In the code above, when the subscribe action is run an !http
command is executed. The !http command sends an HTTP POST request to
the path specified.

See: http , Command Context

Expected Results

The expected result of the subscribe command is to have a webhook created on the service provider. Once the webhook has been created on the service provider, ActiveCampaign should receive webhook payloads for the marketer from that service provider.

Context Variables

See subscribe context variables

unsubscribe

The unsubscribe action is called when a webhook should be deleted for a specific resource. Once a webhook has been deleted, the resource has been "unsubscribed".

The unsubscribe action is called as part of a marketer interaction within ActiveCampaign. For more information on the marketer interaction see the unsubscribe section within the configuration walkthrough.

Example Configuration

{
    "name": "unsubscribe",
    "run": {
        "!http": {
            "method": "DELETE",
            "path": "/repos/${subscription::external_resource_id}/hooks/${webhook::id}"
        }
    }
}

In the code above, when the unsubscribe action is run an !http command is executed. The !http command sends an HTTP DELETE request to the path specified.

See: !http

Expected Results

The expected result of the unsubscribe command is to have a webhook
removed from the service provider. Once the webhook has been removed
from the service provider, ActiveCampaign should no longer receive
webhook payloads for the marketer from that service provider.

Context Variables

See unsubscribe context variables

Updated 4 months ago

Actions


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.