← ActiveCampaign

Add Contact to Automation with ActiveCampaign API

Pipedream makes it easy to connect APIs for ActiveCampaign and 800+ other apps remarkably fast.

Trigger workflow on
HTTP requests, schedules and app events
Next, do this
Add Contact to Automation with the ActiveCampaign API
No credit card required
Into to Pipedream
Watch us build a workflow
Watch us build a workflow
7 min
Watch now ➜
Trusted by 250,000+ developers from startups to Fortune 500 companies:
Trusted by 250,000+ developers from startups to Fortune 500 companies

Developers Pipedream

Getting Started

Create a workflow to Add Contact to Automation with the ActiveCampaign API. When you configure and deploy the workflow, it will run on Pipedream's servers 24x7 for free.

  1. Configure the Add Contact to Automation action
    1. Connect your ActiveCampaign account
    2. Optional- Configure automation
    3. Optional- Configure contact_id
    4. Optional- Configure contact_email
    5. Optional- Select a api_output
  2. Select a trigger to run your workflow on HTTP requests, schedules or app events
  3. Deploy the workflow
  4. Send a test event to validate your setup
  5. Turn on the trigger

Details

This is a pre-built, open source component from Pipedream's GitHub repo. The component is developed by Pipedream and the community, and verified and maintained by Pipedream.

To contribute an update to an existing component or create a new component, create a PR on GitHub. If you're new to Pipedream component development, you can start with quickstarts for trigger span and action development, and then review the component API reference.

Add Contact to Automation on ActiveCampaign
Description:Adds an existing contact to an existing automation.
Version:0.1.2
Key:activecampaign-add-contact-to-automation

Code

// legacy_hash_id: a_xqig4J
import { axios } from "@pipedream/platform";

export default {
  key: "activecampaign-add-contact-to-automation",
  name: "Add Contact to Automation",
  description: "Adds an existing contact to an existing automation.",
  version: "0.1.2",
  type: "action",
  props: {
    activecampaign: {
      type: "app",
      app: "activecampaign",
    },
    automation: {
      type: "string",
      description: "List segment ID (0 for no segment).",
      optional: true,
    },
    contact_id: {
      type: "string",
      optional: true,
    },
    contact_email: {
      type: "string",
      optional: true,
    },
    api_output: {
      type: "string",
      description: "Response format: `xml`, `json`, or `serialize` (default is `xml`)",
      optional: true,
      options: [
        "xml",
        "json",
        "serialize",
      ],
    },
  },
  async run({ $ }) {
  // See the API docs: https://www.activecampaign.com/api/example.php?call=automation_contact_add

    if (!this.automation || (!this.contact_id && !this.contact_email)) {
      throw new Error("Must provide automation, and one of contact_id or contact_email parameters.");
    }

    //Prepares query string parameters object of the request
    var queryParams = {
      api_action: "automation_contact_add",
      api_key: this.activecampaign.$auth.api_key,
      api_output: this.api_output,
    };

    //Prepares body parameters of the recrets. API endpoint not taking object, works as string.
    var data = `automation=${this.automation}&`;
    if (this.contact_id) {
      data += `contact_id=${this.contact_id}`;
    } else {
      data += `contact_email=${this.contact_email}`;
    }

    //Sends the request against Active Campaign API
    const config = {
      method: "post",
      url: `${this.activecampaign.$auth.base_url}/admin/api.php`,
      headers: {
        "Content-Type": "application/x-www-form-urlencoded",
      },
      params: queryParams,
      data,
    };

    return axios($, config);
  },
};

Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI and CLI.
LabelPropTypeDescription
ActiveCampaignactivecampaignappThis component uses the ActiveCampaign app.
automationstring

List segment ID (0 for no segment).

contact_idstring
contact_emailstring
api_outputstringSelect a value from the drop down menu:xmljsonserialize

Authentication

ActiveCampaign uses API keys for authentication. When you connect your ActiveCampaign account, Pipedream securely stores the keys so you can easily authenticate to ActiveCampaign APIs in both code and no-code steps.

You can find your Base URL and API Key in your Developer Settings in your account. See the ActiveCampaign API docs for more info.

About ActiveCampaign

Email marketing, marketing automation, and CRM tools